name: tests on: push: branches: - master pull_request: jobs: tests: name: ./test.sh (${{ matrix.name }}) runs-on: ${{ matrix.os }} strategy: fail-fast: false matrix: include: - os: ${{ github.repository == 'commaai/opendbc' && 'namespace-profile-amd64-8x16' || 'ubuntu-24.04' }} name: Linux - os: ${{ github.repository == 'commaai/opendbc' && 'namespace-profile-macos-8x14' || 'macos-latest' }} name: macOS steps: - uses: actions/checkout@v7 - uses: commaai/timeout@v1 with: timeout: ${{ github.repository == 'commaai/opendbc' && '90' || '999' }} - run: ./test.sh safety_tests: name: safety runs-on: ${{ github.repository == 'commaai/opendbc' && 'namespace-profile-amd64-8x16' || 'ubuntu-latest' }} steps: - uses: commaai/timeout@v1 with: timeout: ${{ github.repository == 'commaai/opendbc' && '60' || '999' }} - uses: actions/checkout@v7 - name: Run safety tests run: ./opendbc/safety/tests/test.sh mutation: name: Safety mutation tests (${{ matrix.name }}) runs-on: ${{ matrix.os }} timeout-minutes: 45 strategy: fail-fast: false matrix: include: - os: ${{ github.repository == 'commaai/opendbc' && 'namespace-profile-amd64-8x16' || 'ubuntu-latest' }} name: Linux - os: ${{ github.repository == 'commaai/opendbc' && 'namespace-profile-macos-8x14' || 'macos-latest' }} name: macOS steps: - uses: actions/checkout@v7 - name: Run mutation tests run: | source setup.sh python opendbc/safety/tests/mutation.py car_diff: name: car diff runs-on: ${{ github.repository == 'commaai/opendbc' && 'namespace-profile-amd64-8x16' || 'ubuntu-latest' }} env: GIT_REF: ${{ github.event_name == 'push' && github.ref == format('refs/heads/{0}', github.event.repository.default_branch) && github.event.before || format('origin/{0}', github.event.repository.default_branch) }} steps: - uses: actions/checkout@v7 with: fetch-depth: 0 - name: Test car diff if: github.event_name == 'pull_request' run: source setup.sh && python opendbc/car/tests/car_diff.py | tee diff.txt - name: Upload diff if: always() && github.event_name == 'pull_request' uses: actions/upload-artifact@v7 with: name: car_diff_${{ github.event.number }} path: diff.txt - name: Update refs if: github.repository == 'commaai/opendbc' && github.ref == 'refs/heads/master' run: source setup.sh && python opendbc/car/tests/car_diff.py --update-refs - name: Checkout ci-artifacts if: github.repository == 'commaai/opendbc' && github.ref == 'refs/heads/master' uses: actions/checkout@v7 with: repository: commaai/ci-artifacts ssh-key: ${{ secrets.CI_ARTIFACTS_DEPLOY_KEY }} path: ${{ github.workspace }}/ci-artifacts - name: Push refs if: github.repository == 'commaai/opendbc' && github.ref == 'refs/heads/master' working-directory: ${{ github.workspace }}/ci-artifacts run: | ls ${{ github.workspace }}/car_diff/*.zst 2>/dev/null || exit 0 git config user.name "GitHub Actions Bot" git config user.email "<>" git fetch origin car_diff || true git checkout car_diff 2>/dev/null || git checkout --orphan car_diff cp ${{ github.workspace }}/car_diff/*.zst . git add *.zst git commit -m "car_diff refs for ${{ github.sha }}" || echo "No changes to commit" git push origin car_diff test_models: name: test models runs-on: ${{ github.repository == 'commaai/opendbc' && 'namespace-profile-amd64-8x16' || 'ubuntu-latest' }} strategy: fail-fast: false matrix: job: [0, 1, 2, 3] env: CI: 1 steps: - uses: actions/checkout@v7 - run: ./setup.sh - name: Cache test routes id: routes-cache uses: actions/cache@v6 with: path: /tmp/comma_download_cache key: car_models-${{ hashFiles('opendbc/car/tests/test_models.py', 'opendbc/car/tests/routes.py') }}-${{ matrix.job }} - name: Test car models timeout-minutes: ${{ contains(runner.name, 'nsc') && (steps.routes-cache.outputs.cache-hit == 'true') && 2 || 8 }} run: source .venv/bin/activate && MAX_EXAMPLES=1 opendbc/car/tests/test_models.py env: NUM_JOBS: 4 JOB_ID: ${{ matrix.job }}