Repository navigation
ci: use fork LFS for replay generation #146
Workflow file for this run
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: tests | |
| on: | |
| push: | |
| branches: | |
| - master | |
| - 'nap-*' | |
| pull_request: | |
| workflow_dispatch: | |
| workflow_call: | |
| inputs: | |
| run_number: | |
| default: '1' | |
| required: true | |
| type: string | |
| concurrency: | |
| group: tests-ci-run-${{ inputs.run_number }}-${{ github.event_name == 'push' && github.ref == 'refs/heads/master' && github.run_id || github.head_ref || github.ref }}-${{ github.workflow }}-${{ github.event_name }} | |
| cancel-in-progress: true | |
| env: | |
| CI: 1 | |
| PYTHONPATH: ${{ github.workspace }} | |
| PYTEST: pytest --continue-on-collection-errors --durations=0 -n logical | |
| OPENPILOT_LFS_URL: https://github.com/${{ github.repository }}.git/info/lfs | |
| jobs: | |
| tesla_preap_longitudinal_regression: | |
| name: Tesla Pre-AP longitudinal regressions | |
| runs-on: ubuntu-24.04 | |
| timeout-minutes: 20 | |
| steps: | |
| - uses: actions/checkout@v6 | |
| with: | |
| submodules: true | |
| - name: Check workflow contract | |
| run: python3 .github/ci/test_tesla_preap_longitudinal_workflow.py | |
| - name: Set up dependencies | |
| uses: nick-fields/retry@7152eba30c6575329ac0576536151aca5a72780e | |
| with: | |
| timeout_minutes: 10 | |
| max_attempts: 3 | |
| command: ./tools/op.sh setup | |
| - name: Build focused test dependencies | |
| run: scons -j$(nproc) | |
| - name: Run focused longitudinal tests | |
| run: | | |
| pytest -q -n 0 \ | |
| selfdrive/controls/tests/test_following_distance.py \ | |
| selfdrive/controls/tests/test_tesla_preap_following.py \ | |
| selfdrive/controls/tests/test_tesla_preap_longcontrol.py \ | |
| opendbc_repo/opendbc/car/tesla/preap/tests/test_longitudinal_tuning.py \ | |
| opendbc_repo/opendbc/car/tesla/preap/tests/test_virtual_das.py \ | |
| opendbc_repo/opendbc/car/tesla/preap/tests/test_vdas_grade_control.py | |
| - name: Run historical mutation checks | |
| run: python .github/ci/tesla_preap_longitudinal_mutations.py | |
| build_release: | |
| name: build release | |
| runs-on: ${{ | |
| (github.repository == 'commaai/openpilot') && | |
| ((github.event_name != 'pull_request') || | |
| (github.event.pull_request.head.repo.full_name == 'commaai/openpilot')) | |
| && fromJSON('["namespace-profile-amd64-8x16"]') | |
| || fromJSON('["ubuntu-24.04"]') }} | |
| env: | |
| STRIPPED_DIR: /tmp/releasepilot | |
| PYTHONPATH: /tmp/releasepilot | |
| steps: | |
| - uses: actions/checkout@v6 | |
| with: | |
| submodules: true | |
| - name: Getting LFS files | |
| uses: nick-fields/retry@7152eba30c6575329ac0576536151aca5a72780e | |
| with: | |
| timeout_minutes: 2 | |
| max_attempts: 3 | |
| command: git config lfs.url "$OPENPILOT_LFS_URL" && git lfs pull | |
| - name: Build devel | |
| timeout-minutes: 1 | |
| run: TARGET_DIR=$STRIPPED_DIR release/build_stripped.sh | |
| - run: ./tools/op.sh setup | |
| - name: Install video encoding deps | |
| run: sudo apt-get install -y libva-dev libva-drm2 libdrm-dev | |
| - name: Build openpilot and run checks | |
| timeout-minutes: 30 | |
| working-directory: ${{ env.STRIPPED_DIR }} | |
| run: python3 system/manager/build.py | |
| - name: Run tests | |
| timeout-minutes: 1 | |
| working-directory: ${{ env.STRIPPED_DIR }} | |
| run: release/check-dirty.sh | |
| - name: Check submodules | |
| if: github.repository == 'commaai/openpilot' | |
| timeout-minutes: 3 | |
| run: release/check-submodules.sh | |
| build_mac: | |
| name: build macOS | |
| runs-on: ${{ ((github.repository == 'commaai/openpilot') && ((github.event_name != 'pull_request') || (github.event.pull_request.head.repo.full_name == 'commaai/openpilot'))) && 'namespace-profile-macos-8x14' || 'macos-latest' }} | |
| steps: | |
| - uses: actions/checkout@v6 | |
| with: | |
| submodules: true | |
| - name: Remove Homebrew from environment | |
| run: | | |
| FILTERED=$(echo "$PATH" | tr ':' '\n' | grep -v '/opt/homebrew' | tr '\n' ':') | |
| echo "PATH=${FILTERED}/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin" >> $GITHUB_ENV | |
| - run: ./tools/op.sh setup | |
| - name: Building openpilot | |
| run: scons | |
| static_analysis: | |
| name: static analysis | |
| runs-on: ${{ | |
| (github.repository == 'commaai/openpilot') && | |
| ((github.event_name != 'pull_request') || | |
| (github.event.pull_request.head.repo.full_name == 'commaai/openpilot')) | |
| && fromJSON('["namespace-profile-amd64-8x16"]') | |
| || fromJSON('["ubuntu-24.04"]') }} | |
| steps: | |
| - uses: actions/checkout@v6 | |
| with: | |
| submodules: true | |
| - run: ./tools/op.sh setup | |
| - name: Static analysis | |
| timeout-minutes: 1 | |
| run: scripts/lint/lint.sh | |
| unit_tests: | |
| name: unit tests | |
| runs-on: ${{ | |
| (github.repository == 'commaai/openpilot') && | |
| ((github.event_name != 'pull_request') || | |
| (github.event.pull_request.head.repo.full_name == 'commaai/openpilot')) | |
| && fromJSON('["namespace-profile-amd64-8x16"]') | |
| || fromJSON('["ubuntu-24.04"]') }} | |
| steps: | |
| - uses: actions/checkout@v6 | |
| with: | |
| submodules: true | |
| - run: ./tools/op.sh setup | |
| - name: Install extra deps | |
| run: | | |
| sudo apt-get install -y libva-dev libva-drm2 libdrm-dev | |
| uv pip install natsort | |
| - name: Build openpilot | |
| run: scons -j$(nproc) | |
| - name: Validate process replay release contracts | |
| run: | | |
| pytest -q -n 0 \ | |
| .github/ci/test_assemble_replay_release.py \ | |
| .github/ci/test_validate_process_replay_release.py | |
| - name: Run unit tests | |
| timeout-minutes: ${{ contains(runner.name, 'nsc') && 2 || 20 }} | |
| run: | | |
| source selfdrive/test/setup_xvfb.sh | |
| # Pre-compile Python bytecode so each pytest worker doesn't need to | |
| $PYTEST --collect-only -m 'not slow' -qq | |
| MAX_EXAMPLES=1 $PYTEST -m 'not slow' | |
| process_replay: | |
| name: process replay (${{ matrix.shard }}) | |
| runs-on: ubuntu-24.04 | |
| timeout-minutes: 20 | |
| permissions: | |
| contents: read | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| include: | |
| - shard: card | |
| filter_args: "--whitelist-procs card" | |
| expected_tasks: 16 | |
| - shard: controlsd | |
| filter_args: "--whitelist-procs controlsd" | |
| expected_tasks: 16 | |
| - shard: lagd | |
| filter_args: "--whitelist-procs lagd" | |
| expected_tasks: 16 | |
| - shard: other | |
| filter_args: "--blacklist-procs card controlsd lagd" | |
| expected_tasks: 18 | |
| steps: | |
| - uses: actions/checkout@d23441a48e516b6c34aea4fa41551a30e30af803 # v6.1.0 | |
| with: | |
| submodules: true | |
| persist-credentials: false | |
| - name: Set up dependencies | |
| uses: nick-fields/retry@7152eba30c6575329ac0576536151aca5a72780e | |
| with: | |
| timeout_minutes: 10 | |
| max_attempts: 3 | |
| command: ./tools/op.sh setup | |
| - name: Install video encoding deps | |
| run: sudo apt-get install -y libva-dev libva-drm2 libdrm-dev | |
| - name: Build openpilot | |
| run: scons -j$(nproc) | |
| - name: Verify shard inventory contracts | |
| env: | |
| SHARD: ${{ matrix.shard }} | |
| FILTER_ARGS: ${{ matrix.filter_args }} | |
| EXPECTED_TASKS: ${{ matrix.expected_tasks }} | |
| run: | | |
| set -euo pipefail | |
| REPLAY=selfdrive/test/process_replay/test_processes.py | |
| python3 - <<'PY' | |
| from openpilot.selfdrive.test.process_replay import test_processes as tp | |
| active_cases = tp.select_cases("active") | |
| staged_cases = tp.select_cases("staged") | |
| tp.assert_inventory_invariants(active_cases) | |
| tp.assert_inventory_invariants(staged_cases) | |
| assert len(active_cases) == 16, len(active_cases) | |
| assert len(staged_cases) == 18, len(staged_cases) | |
| active_tasks = tp.build_tasks(active_cases) | |
| staged_tasks = tp.build_tasks(staged_cases) | |
| assert len(active_tasks) == 66, len(active_tasks) | |
| assert len(staged_tasks) == 78, len(staged_tasks) | |
| active_counts = {name: len(tp.shard_task_ids(active_tasks, name)) for name in ("card", "controlsd", "lagd", "other")} | |
| assert active_counts == {"card": 16, "controlsd": 16, "lagd": 16, "other": 18}, active_counts | |
| assert sum(active_counts.values()) == 66 | |
| staged_counts = {name: len(tp.shard_task_ids(staged_tasks, name)) for name in ("card", "controlsd", "lagd", "other")} | |
| assert staged_counts == {"card": 18, "controlsd": 18, "lagd": 18, "other": 24}, staged_counts | |
| assert sum(staged_counts.values()) == 78 | |
| staged_task_ids = {task.task_id for task in staged_tasks} | |
| staged_union = set(tp.shard_task_ids(staged_tasks, "card")) | |
| staged_union |= set(tp.shard_task_ids(staged_tasks, "controlsd")) | |
| staged_union |= set(tp.shard_task_ids(staged_tasks, "lagd")) | |
| staged_union |= set(tp.shard_task_ids(staged_tasks, "other")) | |
| assert staged_union == staged_task_ids, (len(staged_union), len(staged_task_ids)) | |
| assert len(staged_union) == 78, len(staged_union) | |
| print("inventory unit checks passed:", active_counts, staged_counts) | |
| PY | |
| mapfile -t shard_tasks < <(${REPLAY} --inventory active --list-tasks ${FILTER_ARGS}) | |
| echo "shard=${SHARD} list-tasks count=${#shard_tasks[@]}" | |
| printf '%s\n' "${shard_tasks[@]}" | |
| test "${#shard_tasks[@]}" -eq "${EXPECTED_TASKS}" | |
| active_total="$(${REPLAY} --inventory active --list-tasks | wc -l)" | |
| staged_total="$(${REPLAY} --inventory staged --list-tasks | wc -l)" | |
| echo "active_total=${active_total} staged_total=${staged_total}" | |
| test "${active_total}" -eq 66 | |
| test "${staged_total}" -eq 78 | |
| - name: Run replay | |
| run: | | |
| set -euo pipefail | |
| OUT_DIR="selfdrive/test/process_replay/out/${{ matrix.shard }}" | |
| mkdir -p "${OUT_DIR}" | |
| selfdrive/test/process_replay/test_processes.py \ | |
| -j$(nproc) \ | |
| --inventory active \ | |
| --output-dir "${OUT_DIR}" \ | |
| ${{ matrix.filter_args }} | |
| - name: Print diff | |
| if: always() | |
| run: cat selfdrive/test/process_replay/out/${{ matrix.shard }}/diff.txt | |
| - uses: actions/upload-artifact@b7c566a772e6b6bfb58ed0dc250532a479d7789f # v6.0.0 | |
| if: always() | |
| with: | |
| name: process_replay_${{ matrix.shard }} | |
| path: | | |
| selfdrive/test/process_replay/out/${{ matrix.shard }}/diff.txt | |
| selfdrive/test/process_replay/out/${{ matrix.shard }}/results.json | |
| selfdrive/test/process_replay/fakedata | |
| if-no-files-found: error | |
| simulator_driving: | |
| name: simulator driving | |
| runs-on: ${{ | |
| (github.repository == 'commaai/openpilot') && | |
| ((github.event_name != 'pull_request') || | |
| (github.event.pull_request.head.repo.full_name == 'commaai/openpilot')) | |
| && fromJSON('["namespace-profile-amd64-8x16"]') | |
| || fromJSON('["ubuntu-24.04"]') }} | |
| if: false # FIXME: Started to timeout recently | |
| steps: | |
| - uses: actions/checkout@v6 | |
| with: | |
| submodules: true | |
| - run: ./tools/op.sh setup | |
| - name: Build openpilot | |
| run: scons -j$(nproc) | |
| - name: Driving test | |
| timeout-minutes: 2 | |
| run: | | |
| source selfdrive/test/setup_xvfb.sh | |
| pytest -s tools/sim/tests/test_metadrive_bridge.py | |
| create_ui_report: | |
| name: Create UI Report | |
| runs-on: ${{ | |
| (github.repository == 'commaai/openpilot') && | |
| ((github.event_name != 'pull_request') || | |
| (github.event.pull_request.head.repo.full_name == 'commaai/openpilot')) | |
| && fromJSON('["namespace-profile-amd64-8x16"]') | |
| || fromJSON('["ubuntu-24.04"]') }} | |
| steps: | |
| - uses: actions/checkout@v6 | |
| with: | |
| submodules: true | |
| - run: ./tools/op.sh setup | |
| - name: Install video encoding deps | |
| run: sudo apt-get install -y libva-dev libva-drm2 libdrm-dev | |
| - name: Build openpilot | |
| run: scons -j$(nproc) | |
| - name: Create UI Report | |
| run: | | |
| source selfdrive/test/setup_xvfb.sh | |
| python3 selfdrive/ui/tests/diff/replay.py | |
| python3 selfdrive/ui/tests/diff/replay.py --big | |
| - name: Upload UI Report | |
| uses: actions/upload-artifact@v6 | |
| with: | |
| name: ui-report-${{ inputs.run_number || '1' }}-${{ github.event_name == 'push' && github.ref == 'refs/heads/master' && 'master' || github.event.number }} | |
| path: selfdrive/ui/tests/diff/report |