Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
33 changes: 6 additions & 27 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,33 +2,12 @@ name: tests

on: [push, pull_request]

env:
REGISTRY: ghcr.io/commaai
BUILD: docker buildx build --pull --load --cache-to type=inline --cache-from $REGISTRY/rednose:latest -t rednose -f Dockerfile .
RUN: docker run rednose bash -c

jobs:
test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Build docker image
run: eval ${{ env.BUILD }}
- name: Static analysis
run: ${{ env.RUN }} "git init && git add -A && pre-commit run --all"
- name: Unit Tests
run: ${{ env.RUN }} "pytest"

docker_push:
name: docker push
runs-on: ubuntu-latest
if: github.ref == 'refs/heads/master' && github.event_name != 'pull_request' && github.repository == 'commaai/rednose'
strategy:
matrix:
os: [ubuntu-latest, macos-latest]
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v4
- name: Build Docker image
run: eval ${{ env.BUILD }}
- name: Push to dockerhub
run: |
docker login ghcr.io -u ${{ github.actor }} -p ${{ secrets.GITHUB_TOKEN }}
docker tag rednose ${{ env.REGISTRY }}/rednose:latest
docker push ${{ env.REGISTRY }}/rednose:latest
- uses: actions/checkout@v7
- run: ./test.sh
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,7 @@ celerybeat.pid
# Environments
.env
.venv
uv.lock
env/
venv/
ENV/
Expand Down
21 changes: 0 additions & 21 deletions .pre-commit-config.yaml

This file was deleted.

13 changes: 0 additions & 13 deletions Dockerfile

This file was deleted.

3 changes: 2 additions & 1 deletion SConstruct
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import os
import platform
import subprocess
import sysconfig
import numpy as np
Expand Down Expand Up @@ -45,7 +46,7 @@ envCython = env.Clone()
envCython["CCFLAGS"] += ["-Wno-#warnings", "-Wno-cpp", "-Wno-shadow", "-Wno-deprecated-declarations"]

envCython["LIBS"] = []
if arch == "Darwin":
if platform.system() == "Darwin":
envCython["LINKFLAGS"] = ["-bundle", "-undefined", "dynamic_lookup"]
elif arch == "aarch64":
envCython["LINKFLAGS"] = ["-shared"]
Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ dev = [
"pytest",
"pytest-xdist",
"ruff",
"pre-commit",
"mypy",
]

[build-system]
Expand Down
2 changes: 1 addition & 1 deletion rednose/helpers/sympy_helpers.py
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,7 @@ def sympy_into_c(sympy_functions, global_vars=None):

# add the output arguments
for a in r.arguments:
if type(a) == codegen.OutputArgument:
if type(a) is codegen.OutputArgument:
nargs.append(a)

# assert len(r.arguments) == len(args)+1
Expand Down
25 changes: 25 additions & 0 deletions test.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
#!/usr/bin/env bash
set -e

DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" >/dev/null && pwd)"
cd "$DIR"

# *** env setup ***
if ! command -v uv >/dev/null; then
curl -LsSf https://astral.sh/uv/install.sh | sh
export PATH="$HOME/.local/bin:$PATH"
fi
uv sync --extra dev

# *** build ***
uv run scons -j8

# *** lint + test ***
uv run ruff check .
uv run mypy --ignore-missing-imports .
uv run pytest

# *** all done ***
GREEN='\033[0;32m'
NC='\033[0m'
printf "\n${GREEN}All good!${NC} Finished lint and test in ${SECONDS}s\n"
Loading