@@ -15,10 +15,14 @@ jobs:
1515 matrix :
1616 include :
1717 - os : ${{ github.repository == 'commaai/opendbc' && 'namespace-profile-amd64-8x16' || 'ubuntu-24.04' }}
18- - os : macos-latest
18+ - os : ${{ github.repository == 'commaai/opendbc' && 'namespace-profile- macos-8x14' || 'macos- latest' }}
1919 steps :
20- - uses : commaai/timeout@v1
2120 - uses : actions/checkout@v4
21+ - uses : ./.github/workflows/cache
22+ id : cache
23+ - uses : commaai/timeout@v1
24+ with :
25+ timeout : ${{ github.repository == 'commaai/opendbc' && (steps.cache.outputs.cache-hit == 'true' && '60' || '90') || '999' }}
2226 - run : ./test.sh
2327
2428 safety_tests :
@@ -27,81 +31,71 @@ jobs:
2731 strategy :
2832 fail-fast : false
2933 matrix :
30- flags : ['', ' --ubsan']
34+ flags : ['--ubsan']
3135 steps :
3236 - uses : commaai/timeout@v1
37+ with :
38+ timeout : ${{ github.repository == 'commaai/opendbc' && '60' || '999' }}
3339 - uses : actions/checkout@v4
40+ - uses : ./.github/workflows/cache
3441 - name : Run safety tests
3542 run : ./opendbc/safety/tests/test.sh ${{ matrix.flags }}
3643
37- misra_linter :
38- name : MISRA C:2012 Linter
39- runs-on : ${{ github.repository == 'commaai/opendbc' && 'namespace-profile-amd64-8x16' || 'ubuntu-latest' }}
40- timeout-minutes : 20
41- steps :
42- - name : Set up
43- run : sudo apt-get install -y --no-install-recommends gcc-arm-none-eabi libnewlib-arm-none-eabi
44- - uses : actions/checkout@v4
45- - name : Restore cached cppcheck
46- uses : actions/cache@v4
47- with :
48- path : opendbc/safety/tests/misra/cppcheck/
49- key : cppcheck-cache-${{ runner.os }}-${{ github.ref }}
50- restore-keys : |
51- cppcheck-cache-${{ runner.os }}-${{ github.ref }}
52- cppcheck-cache-${{ runner.os }}-
53- - name : Run MISRA C:2012 analysis
54- timeout-minutes : ${{ ((steps.restore-scons-cache.outputs.cache-hit == 'true') && 1 || 2) }}
55- run : cd opendbc/safety/tests/misra && ./test_misra.sh
56- - name : Save cppcheck cache
57- uses : actions/cache@v4
58- with :
59- path : opendbc/safety/tests/misra/cppcheck/
60- key : cppcheck-cache-${{ runner.os }}-${{ github.ref }}
61-
62- misra_mutation :
63- name : MISRA C:2012 Mutation
64- runs-on : ${{ github.repository == 'commaai/opendbc' && 'namespace-profile-amd64-8x16' || 'ubuntu-latest' }}
65- timeout-minutes : 20
66- steps :
67- - name : Set up
68- run : sudo apt-get install -y --no-install-recommends gcc-arm-none-eabi libnewlib-arm-none-eabi
69- - uses : actions/checkout@v4
70- - name : Restore cached cppcheck
71- uses : actions/cache@v4
72- with :
73- path : opendbc/safety/tests/misra/cppcheck/
74- key : cppcheck-cache-${{ runner.os }}-${{ github.ref }}
75- restore-keys : |
76- cppcheck-cache-${{ runner.os }}-${{ github.ref }}
77- cppcheck-cache-${{ runner.os }}-
78- - name : MISRA mutation tests
79- timeout-minutes : 1
80- run : |
81- source setup.sh
82- scons -j8
83- cd opendbc/safety/tests/misra
84- ./install.sh # cppcheck
85- pytest -s -n8 --randomly-seed $RANDOM test_mutation.py
86- - name : Save cppcheck cache
87- uses : actions/cache@v4
88- with :
89- path : opendbc/safety/tests/misra/cppcheck/
90- key : cppcheck-cache-${{ runner.os }}-${{ github.ref }}
91-
9244 mutation :
9345 name : Safety mutation tests
9446 runs-on : ${{ github.repository == 'commaai/opendbc' && 'namespace-profile-amd64-8x16' || 'ubuntu-latest' }}
95- timeout-minutes : 20
47+ timeout-minutes : 45
9648 env :
97- GIT_REF : ${{ github.event_name == 'push' && github.ref == 'refs/heads/${{ github.event.repository.default_branch }}' && github.event.before || 'origin/${{ github.event.repository.default_branch }}' }}
49+ 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) }}
9850 steps :
9951 - uses : actions/checkout@v4
10052 with :
10153 fetch-depth : 0 # need master to get diff
54+ - uses : ./.github/workflows/cache
10255 - name : Run mutation tests
103- timeout-minutes : 5
10456 run : |
10557 source setup.sh
10658 scons -j8
10759 cd opendbc/safety/tests && ./mutation.sh
60+
61+ # TODO: this needs to move to opendbc
62+ test_models :
63+ name : test models
64+ runs-on : ${{ github.repository == 'commaai/opendbc' && 'namespace-profile-amd64-8x16' || 'ubuntu-latest' }}
65+ strategy :
66+ fail-fast : false
67+ matrix :
68+ job : [0, 1, 2, 3]
69+ env :
70+ BASE_IMAGE : openpilot-base
71+ BUILD : selfdrive/test/docker_build.sh base
72+ RUN : docker run --shm-size 2G -v $PWD:/tmp/openpilot -w /tmp/openpilot -e CI=1 -e PYTHONWARNINGS=error -e FILEREADER_CACHE=1 -e PYTHONPATH=/tmp/openpilot -e NUM_JOBS -e JOB_ID -e GITHUB_ACTION -e GITHUB_REF -e GITHUB_HEAD_REF -e GITHUB_SHA -e GITHUB_REPOSITORY -e GITHUB_RUN_ID -v $GITHUB_WORKSPACE/.ci_cache/scons_cache:/tmp/scons_cache -v $GITHUB_WORKSPACE/.ci_cache/comma_download_cache:/tmp/comma_download_cache -v $GITHUB_WORKSPACE/.ci_cache/openpilot_cache:/tmp/openpilot_cache $BASE_IMAGE /bin/bash -c
73+ PYTEST : pytest --continue-on-collection-errors --durations=0 --durations-min=5 -n logical
74+ steps :
75+ - uses : actions/checkout@v4
76+ with :
77+ repository : ' commaai/openpilot'
78+ ref : ' master'
79+ submodules : true
80+ - run : rm -rf opendbc_repo/
81+ - uses : actions/checkout@v4
82+ with :
83+ path : opendbc_repo
84+ - uses : ./.github/workflows/setup-with-retry
85+ id : setup-step
86+ - name : Cache test routes
87+ id : routes-cache
88+ uses : actions/cache@v4
89+ with :
90+ path : .ci_cache/comma_download_cache
91+ key : car_models-${{ hashFiles('selfdrive/car/tests/test_models.py', 'opendbc/car/tests/routes.py') }}-${{ matrix.job }}
92+ - name : Build openpilot
93+ run : ${{ env.RUN }} "scons -j$(nproc) common/ cereal/ selfdrive/pandad/ msgq_repo/ opendbc_repo"
94+ - name : Test car models
95+ timeout-minutes : ${{ contains(runner.name, 'nsc') && (steps.routes-cache.outputs.cache-hit == 'true') && ((steps.setup-step.outputs.duration < 18) && 1 || 2) || 6 }}
96+ run : |
97+ ${{ env.RUN }} "MAX_EXAMPLES=1 $PYTEST selfdrive/car/tests/test_models.py && \
98+ chmod -R 777 /tmp/comma_download_cache"
99+ env :
100+ NUM_JOBS : 4
101+ JOB_ID : ${{ matrix.job }}
0 commit comments