@@ -2,29 +2,31 @@ name: selfdrive
2
2
3
3
on :
4
4
push :
5
- branches-ignore :
6
- - ' testing-closet* '
5
+ branches :
6
+ - master
7
7
pull_request :
8
8
9
9
concurrency :
10
10
group : ${{ github.event_name == 'push' && github.ref == 'refs/heads/master' && github.run_id || github.head_ref || github.ref }}-${{ github.workflow }}-${{ github.event_name }}
11
11
cancel-in-progress : true
12
12
13
13
env :
14
+ PYTHONWARNINGS : error
15
+
14
16
BASE_IMAGE : openpilot-base
15
17
CL_BASE_IMAGE : openpilot-base-cl
16
18
DOCKER_REGISTRY : ghcr.io/commaai
17
19
AZURE_TOKEN : ${{ secrets.AZURE_COMMADATACI_OPENPILOTCI_TOKEN }}
18
20
19
21
DOCKER_LOGIN : docker login ghcr.io -u ${{ github.actor }} -p ${{ secrets.GITHUB_TOKEN }}
20
22
BUILD : |
21
- DOCKER_BUILDKIT=1 docker build --pull --build-arg BUILDKIT_INLINE_CACHE=1 --cache-from $DOCKER_REGISTRY/$BASE_IMAGE:latest -t $DOCKER_REGISTRY/$BASE_IMAGE:latest -t $BASE_IMAGE:latest -f Dockerfile.openpilot_base .
23
+ DOCKER_BUILDKIT=1 docker build --pull --cache-to type=inline --cache-from $DOCKER_REGISTRY/$BASE_IMAGE:latest -t $DOCKER_REGISTRY/$BASE_IMAGE:latest -t $BASE_IMAGE:latest -f Dockerfile.openpilot_base .
22
24
23
- RUN : docker run --shm-size 1G -v $PWD:/tmp/openpilot -w /tmp/openpilot -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 /tmp/ scons_cache:/tmp/scons_cache -v /tmp/ comma_download_cache:/tmp/comma_download_cache -v /tmp /openpilot_cache:/tmp/openpilot_cache $BASE_IMAGE /bin/sh -c
25
+ RUN : docker run --shm-size 1G -v $PWD:/tmp/openpilot -w /tmp/openpilot -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 ~/ scons_cache:/tmp/scons_cache -v ~/ comma_download_cache:/tmp/comma_download_cache -v ~ /openpilot_cache:/tmp/openpilot_cache $BASE_IMAGE /bin/sh -c
24
26
25
27
BUILD_CL : |
26
- DOCKER_BUILDKIT=1 docker build --build-arg BUILDKIT_INLINE_CACHE=1 --cache-from $DOCKER_REGISTRY/$CL_BASE_IMAGE:latest -t $DOCKER_REGISTRY/$CL_BASE_IMAGE:latest -t $CL_BASE_IMAGE:latest -f Dockerfile.openpilot_base_cl .
27
- RUN_CL : docker run --shm-size 1G -v $PWD:/tmp/openpilot -w /tmp/openpilot -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 /tmp/ scons_cache:/tmp/scons_cache -v /tmp/ comma_download_cache:/tmp/comma_download_cache -v /tmp /openpilot_cache:/tmp/openpilot_cache $CL_BASE_IMAGE /bin/sh -c
28
+ DOCKER_BUILDKIT=1 docker build --cache-to type=inline --cache-from $DOCKER_REGISTRY/$CL_BASE_IMAGE:latest -t $DOCKER_REGISTRY/$CL_BASE_IMAGE:latest -t $CL_BASE_IMAGE:latest -f Dockerfile.openpilot_base_cl .
29
+ RUN_CL : docker run --shm-size 1G -v $PWD:/tmp/openpilot -w /tmp/openpilot -e PYTHONWARNINGS=error -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 ~/ scons_cache:/tmp/scons_cache -v ~/ comma_download_cache:/tmp/comma_download_cache -v ~ /openpilot_cache:/tmp/openpilot_cache $CL_BASE_IMAGE /bin/sh -c
28
30
29
31
UNIT_TEST : coverage run --append -m unittest discover
30
32
@@ -39,30 +41,33 @@ jobs:
39
41
with :
40
42
submodules : true
41
43
- name : Build devel
44
+ timeout-minutes : 1
42
45
run : TARGET_DIR=$STRIPPED_DIR release/build_devel.sh
43
46
- uses : ./.github/workflows/setup
44
47
- name : Check submodules
45
48
if : github.ref == 'refs/heads/master' && github.repository == 'commaai/openpilot'
49
+ timeout-minutes : 1
46
50
run : release/check-submodules.sh
47
51
- name : Build openpilot and run checks
52
+ timeout-minutes : ${{ ((steps.restore-scons-cache.outputs.cache-hit == 'true') && 10 || 30) }} # allow more time when we missed the scons cache
48
53
run : |
49
54
cd $STRIPPED_DIR
50
55
${{ env.RUN }} "CI=1 python selfdrive/manager/build.py"
51
56
- name : Run tests
57
+ timeout-minutes : 2
52
58
run : |
53
59
cd $STRIPPED_DIR
54
60
${{ env.RUN }} "release/check-dirty.sh && \
55
61
python -m unittest discover selfdrive/car"
56
62
- name : pre-commit
63
+ timeout-minutes : 3
57
64
run : |
58
65
cd $GITHUB_WORKSPACE
59
66
cp .pre-commit-config.yaml $STRIPPED_DIR
60
- cp .pylintrc $STRIPPED_DIR
61
- cp mypy.ini $STRIPPED_DIR
62
67
cp pyproject.toml $STRIPPED_DIR
63
68
cp poetry.lock $STRIPPED_DIR
64
69
cd $STRIPPED_DIR
65
- ${{ env.RUN }} "pre-commit run --all"
70
+ ${{ env.RUN }} "unset PYTHONWARNINGS && pre-commit run --all"
66
71
67
72
build_all :
68
73
name : build all
@@ -72,14 +77,20 @@ jobs:
72
77
with :
73
78
submodules : true
74
79
- uses : ./.github/workflows/setup
75
- with :
76
- save-cache : true
77
80
- name : Build openpilot with all flags
81
+ timeout-minutes : ${{ ((steps.restore-scons-cache.outputs.cache-hit == 'true') && 12 || 30) }} # allow more time when we missed the scons cache
78
82
run : ${{ env.RUN }} "scons -j$(nproc) --extras && release/check-dirty.sh"
79
- - name : Cleanup scons cache
83
+ - name : Cleanup scons cache and rebuild
84
+ timeout-minutes : ${{ ((steps.restore-scons-cache.outputs.cache-hit == 'true') && 2 || 30) }} # allow more time when we missed the scons cache
80
85
run : |
81
86
${{ env.RUN }} "rm -rf /tmp/scons_cache/* && \
82
87
scons -j$(nproc) --cache-populate"
88
+ - name : Save scons cache
89
+ uses : actions/cache/save@v3
90
+ if : github.ref == 'refs/heads/master'
91
+ with :
92
+ path : ~/scons_cache
93
+ key : scons-${{ env.CACHE_COMMIT_DATE }}-${{ github.sha }}
83
94
84
95
build_mac :
85
96
name : build macos
@@ -103,9 +114,11 @@ jobs:
103
114
restore-keys : macos_scons-
104
115
- name : Cache dependencies
105
116
id : dependency-cache
106
- uses : actions/cache@v2
117
+ uses : actions/cache@v3
107
118
with :
108
119
path : |
120
+ .env
121
+ .venv
109
122
~/github_brew_cache_entries.txt
110
123
~/.pyenv
111
124
~/Library/Caches/pypoetry
@@ -116,7 +129,7 @@ jobs:
116
129
/opt/homebrew/opt
117
130
/opt/homebrew/Caskroom/gcc-arm-*
118
131
/Applications/ArmGNUToolchain/*/*/*
119
- key : macos_deps-${{ hashFiles('tools/mac_setup.sh', 'update_requirements .sh', 'poetry.lock') }}
132
+ key : macos_deps-${{ hashFiles('tools/mac_setup.sh', 'tools/install_python_dependencies .sh', 'poetry.lock') }}
120
133
restore-keys : macos_deps-
121
134
- name : Brew link restored dependencies
122
135
run : |
@@ -132,20 +145,22 @@ jobs:
132
145
- name : Install dependencies
133
146
if : steps.dependency-cache.outputs.cache-hit != 'true'
134
147
run : ./tools/mac_setup.sh
148
+ env :
149
+ # package install has DeprecationWarnings
150
+ PYTHONWARNINGS : default
135
151
- name : Build openpilot
136
152
run : |
137
- source tools/openpilot_env.sh
153
+ eval "$(pyenv init --path)"
138
154
poetry run scons -j$(nproc)
139
155
- name : Run tests
140
156
run : |
141
- source tools/openpilot_env.sh
142
- export PYTHONPATH=$PWD
157
+ eval "$(pyenv init --path)"
143
158
poetry run tools/plotjuggler/test_plotjuggler.py
144
159
- name : Pre Cache - Cleanup scons cache
145
160
if : github.ref == 'refs/heads/master'
146
161
run : |
147
- source tools/openpilot_env.sh
148
162
rm -rf /tmp/scons_cache/*
163
+ eval "$(pyenv init --path)"
149
164
poetry run scons -j$(nproc) --cache-populate
150
165
- name : Save scons cache
151
166
id : scons-save-cache
@@ -158,8 +173,9 @@ jobs:
158
173
if : steps.dependency-cache.outputs.cache-hit != 'true'
159
174
run : |
160
175
new_cellar=$(brew list --formula -1)
176
+ exceptions="zstd lz4 xz" # caching step needs zstd
161
177
comm -12 <(echo "$EXISTING_CELLAR") <(echo "$new_cellar") | while read pkg; do
162
- if [[ $pkg != "zstd" ]]; then # caching step needs zstd
178
+ if [[ " $exceptions " != *" $pkg "* ]]; then
163
179
rm -rf "$(brew --cellar)/$pkg"
164
180
fi
165
181
done
@@ -203,7 +219,8 @@ jobs:
203
219
- name : Build Docker image
204
220
run : eval "$BUILD"
205
221
- name : pre-commit
206
- run : ${{ env.RUN }} "pre-commit run --all"
222
+ timeout-minutes : 4
223
+ run : ${{ env.RUN }} "unset PYTHONWARNINGS && pre-commit run --all"
207
224
208
225
valgrind :
209
226
name : valgrind
@@ -216,6 +233,7 @@ jobs:
216
233
- name : Build openpilot
217
234
run : ${{ env.RUN }} "scons -j$(nproc)"
218
235
- name : Run valgrind
236
+ timeout-minutes : 1
219
237
run : |
220
238
${{ env.RUN }} "python selfdrive/test/test_valgrind_replay.py"
221
239
- name : Print logs
@@ -231,8 +249,10 @@ jobs:
231
249
submodules : true
232
250
- uses : ./.github/workflows/setup
233
251
- name : Build openpilot
252
+ timeout-minutes : ${{ ((steps.restore-scons-cache.outputs.cache-hit == 'true') && 10 || 30) }} # allow more time when we missed the scons cache
234
253
run : ${{ env.RUN }} "scons -j$(nproc)"
235
254
- name : Run unit tests
255
+ timeout-minutes : 40
236
256
run : |
237
257
${{ env.RUN }} "export SKIP_LONG_TESTS=1 && \
238
258
$UNIT_TEST common && \
@@ -243,6 +263,7 @@ jobs:
243
263
$UNIT_TEST system/loggerd && \
244
264
$UNIT_TEST selfdrive/car && \
245
265
$UNIT_TEST selfdrive/locationd && \
266
+ $UNIT_TEST selfdrive/test/longitudinal_maneuvers && \
246
267
$UNIT_TEST system/tests && \
247
268
$UNIT_TEST system/ubloxd && \
248
269
selfdrive/locationd/test/_test_locationd_lib.py && \
@@ -255,6 +276,7 @@ jobs:
255
276
QT_QPA_PLATFORM=offscreen ./selfdrive/ui/tests/test_translations && \
256
277
./selfdrive/ui/tests/test_translations.py && \
257
278
./common/tests/test_util && \
279
+ ./common/tests/test_ratekeeper && \
258
280
./common/tests/test_swaglog && \
259
281
./selfdrive/boardd/tests/test_boardd_usbprotocol && \
260
282
./system/loggerd/tests/test_logger &&\
@@ -279,12 +301,13 @@ jobs:
279
301
id : dependency-cache
280
302
uses : actions/cache@v3
281
303
with :
282
- path : /tmp /comma_download_cache
304
+ path : ~ /comma_download_cache
283
305
key : proc-replay-${{ hashFiles('.github/workflows/selfdrive_tests.yaml', 'selfdrive/test/process_replay/ref_commit') }}
284
306
- name : Build openpilot
285
307
run : |
286
308
${{ env.RUN }} "scons -j$(nproc)"
287
309
- name : Run replay
310
+ timeout-minutes : 30
288
311
run : |
289
312
${{ env.RUN }} "CI=1 coverage run selfdrive/test/process_replay/test_processes.py -j$(nproc) && \
290
313
coverage xml"
@@ -321,43 +344,22 @@ jobs:
321
344
- name : Build openpilot
322
345
run : |
323
346
${{ env.RUN }} "scons -j$(nproc)"
347
+ # PYTHONWARNINGS triggers a SyntaxError in onnxruntime
324
348
- name : Run model replay with ONNX
349
+ timeout-minutes : 2
325
350
run : |
326
- ${{ env.RUN_CL }} "ONNXCPU=1 CI=1 NO_NAV=1 coverage run selfdrive/test/process_replay/model_replay.py && \
351
+ ${{ env.RUN_CL }} "unset PYTHONWARNINGS && \
352
+ ONNXCPU=1 CI=1 NO_NAV=1 coverage run selfdrive/test/process_replay/model_replay.py && \
327
353
coverage xml"
328
354
- name : Run unit tests
355
+ timeout-minutes : 4
329
356
run : |
330
- ${{ env.RUN_CL }} "$UNIT_TEST selfdrive/modeld && \
357
+ ${{ env.RUN_CL }} "unset PYTHONWARNINGS && \
358
+ $UNIT_TEST selfdrive/modeld && \
331
359
coverage xml"
332
360
- name : " Upload coverage to Codecov"
333
361
uses : codecov/codecov-action@v3
334
362
335
- test_longitudinal :
336
- name : longitudinal
337
- runs-on : ubuntu-20.04
338
- steps :
339
- - uses : actions/checkout@v3
340
- with :
341
- submodules : true
342
- - uses : ./.github/workflows/setup
343
- - name : Build openpilot
344
- run : |
345
- ${{ env.RUN }} "scons -j$(nproc)"
346
- - name : Test longitudinal
347
- run : |
348
- ${{ env.RUN }} "mkdir -p selfdrive/test/out && \
349
- cd selfdrive/test/longitudinal_maneuvers && \
350
- coverage run ./test_longitudinal.py && \
351
- coverage xml"
352
- - name : " Upload coverage to Codecov"
353
- uses : codecov/codecov-action@v3
354
- - uses : actions/upload-artifact@v2
355
- if : always()
356
- continue-on-error : true
357
- with :
358
- name : longitudinal
359
- path : selfdrive/test/longitudinal_maneuvers/out/longitudinal/
360
-
361
363
test_cars :
362
364
name : cars
363
365
runs-on : ubuntu-20.04
@@ -372,16 +374,16 @@ jobs:
372
374
- uses : ./.github/workflows/setup
373
375
- name : Cache test routes
374
376
id : dependency-cache
375
- uses : actions/cache@03e00da99d75a2204924908e1cca7902cafce66b
377
+ uses : actions/cache@v3
376
378
with :
377
- path : /tmp /comma_download_cache
379
+ path : ~ /comma_download_cache
378
380
key : car_models-${{ hashFiles('selfdrive/car/tests/test_models.py', 'selfdrive/car/tests/routes.py') }}-${{ matrix.job }}
379
381
- name : Build openpilot
380
382
run : ${{ env.RUN }} "scons -j$(nproc)"
381
383
- name : Test car models
384
+ timeout-minutes : 25
382
385
run : |
383
- ${{ env.RUN }} "coverage run -m pytest selfdrive/car/tests/test_models.py && \
384
- coverage xml && \
386
+ ${{ env.RUN }} "pytest --cov --cov-report=xml -n auto --dist=loadscope selfdrive/car/tests/test_models.py && \
385
387
chmod -R 777 /tmp/comma_download_cache"
386
388
env :
387
389
NUM_JOBS : 5
@@ -410,7 +412,7 @@ jobs:
410
412
id : save_diff
411
413
run : |
412
414
${{ env.RUN }} "scons -j$(nproc)"
413
- output=$(${{ env.RUN }} "python selfdrive/debug/print_docs_diff.py --path /tmp/openpilot_cache/base_car_info") || true
415
+ output=$(${{ env.RUN }} "python selfdrive/debug/print_docs_diff.py --path /tmp/openpilot_cache/base_car_info")
414
416
output="${output//$'\n'/'%0A'}"
415
417
echo "::set-output name=diff::$output"
416
418
- name : Find comment
0 commit comments