@@ -157,6 +157,9 @@ jobs:
157
157
run : echo "$CONCURRENCY_CONTEXT"
158
158
- name : Checkout
159
159
uses : actions/checkout@v4
160
+ with :
161
+ fetch-depth : 2
162
+ persist-credentials : true
160
163
- name : Try to ensure the directories for core dumping exist and we
161
164
can write them.
162
165
run : |
@@ -186,6 +189,10 @@ jobs:
186
189
- name : Clean output
187
190
run : rm -rf ./out
188
191
- name : Run Tests with sanitizers
192
+ # Sanitizer tests are not likely to find extra issues so running the same tests
193
+ # as above repeatedly on every pull request seems extra time. Instead keep this run
194
+ # for master only
195
+ if : github.event.pull_request.number == null
189
196
env :
190
197
LSAN_OPTIONS : detect_leaks=1
191
198
run : |
@@ -201,17 +208,34 @@ jobs:
201
208
BUILD_TYPE=sanitizers scripts/build/gn_gen.sh --args="$GN_ARGS chip_data_model_check_die_on_failure=true" --export-compile-commands
202
209
BUILD_TYPE=sanitizers scripts/tests/gn_tests.sh
203
210
done
211
+ - name : Generate tests with sanitizers (for tidy)
212
+ if : github.event.pull_request.number != null
213
+ run : |
214
+ rm -rf ./out/sanitizers
215
+ BUILD_TYPE=sanitizers scripts/build/gn_gen.sh --args="is_clang=true is_asan=true chip_data_model_check_die_on_failure=true" --export-compile-commands
204
216
- name : Ensure codegen is done for sanitize
205
217
run : |
206
218
./scripts/run_in_build_env.sh "./scripts/run_codegen_targets.sh out/sanitizers"
219
+ - name : Find changed files
220
+ id : changed-files
221
+ uses : tj-actions/changed-files@v45
207
222
- name : Clang-tidy validation
208
223
# NOTE: clang-tidy crashes on CodegenDataModel_Write due to Nullable/std::optional check.
209
224
# See https://github.com/llvm/llvm-project/issues/97426
225
+ env :
226
+ ALL_CHANGED_FILES : ${{ steps.changed-files.outputs.all_changed_files }}
210
227
run : |
228
+ touch out/changed_files.txt
229
+ for file in ${ALL_CHANGED_FILES}; do
230
+ echo "$file changed and will be considered for tidy"
231
+ echo "$file" >>out/changed_files.txt
232
+ done
233
+
211
234
./scripts/run_in_build_env.sh \
212
235
"./scripts/run-clang-tidy-on-compile-commands.py \
213
236
--compile-database out/sanitizers/compile_commands.json \
214
237
--file-exclude-regex '/(repo|zzz_generated|lwip/standalone)/|-ReadImpl|-InvokeSubscribeImpl|CodegenDataModel_Write|QuieterReporting' \
238
+ --file-list-file out/changed_files.txt \
215
239
check \
216
240
"
217
241
- name : Clean output
@@ -375,13 +399,16 @@ jobs:
375
399
scripts/build_python_device.sh --chip_detail_logging true
376
400
377
401
build_darwin :
378
- name : Build on Darwin (clang, python_lib, simulated)
402
+ name : Build on Darwin (clang, simulated)
379
403
runs-on : macos-13
380
404
if : github.actor != 'restyled-io[bot]'
381
405
382
406
steps :
383
407
- name : Checkout
384
408
uses : actions/checkout@v4
409
+ with :
410
+ fetch-depth : 2
411
+ persist-credentials : true
385
412
- name : Checkout submodules & Bootstrap
386
413
uses : ./.github/actions/checkout-submodules-and-bootstrap
387
414
with :
@@ -402,37 +429,42 @@ jobs:
402
429
CHIP_ROOT_PATH=examples/placeholder/linux
403
430
CHIP_ROOT_PATH="$CHIP_ROOT_PATH" BUILD_TYPE="$BUILD_TYPE" scripts/build/gn_gen.sh --args="$GN_ARGS"
404
431
scripts/run_in_build_env.sh "ninja -C ./out/$BUILD_TYPE"
405
- - name : Setup Build, Run Build and Run Tests
432
+ - name : Setup Build, Run Build and Run Tests (asan + target_os=all)
406
433
# We can't enable leak checking here in LSAN_OPTIONS, because on
407
434
# Darwin that's only supported with a new enough clang, and we're
408
435
# not building with the pigweed clang here.
436
+ env :
437
+ BUILD_TYPE : default
409
438
run : |
410
- for BUILD_TYPE in default python_lib; do
411
- case $BUILD_TYPE in
412
- # We want to build various standalone example apps
413
- # (similar to what examples-linux-standalone.yaml
414
- # does), so use target_os="all" to get those picked
415
- # up as part of the "unified" build. But then to
416
- # save CI resources we want to exclude the
417
- # "host clang" build, which uses the pigweed
418
- # clang.
419
- "default") GN_ARGS='target_os="all" is_asan=true enable_host_clang_build=false';;
420
- esac
421
- BUILD_TYPE=$BUILD_TYPE scripts/build/gn_gen.sh --args="$GN_ARGS chip_data_model_check_die_on_failure=true" --export-compile-commands
422
- scripts/run_in_build_env.sh "ninja -C ./out/$BUILD_TYPE"
423
- BUILD_TYPE=$BUILD_TYPE scripts/tests/gn_tests.sh
424
- done
425
- - name : Ensure codegen is done for sanitize
439
+ # We want to build various standalone example apps (similar to what examples-linux-standalone.yaml
440
+ # does), so use target_os="all" to get those picked up as part of the "unified" build. But then
441
+ # to save CI resources we want to exclude the "host clang" build, which uses the pigweed clang.
442
+ scripts/build/gn_gen.sh --args='target_os="all" is_asan=true enable_host_clang_build=false chip_data_model_check_die_on_failure=true' --export-compile-commands
443
+ scripts/run_in_build_env.sh "ninja -C ./out/$BUILD_TYPE"
444
+ scripts/tests/gn_tests.sh
445
+ - name : Ensure codegen is done for default
426
446
run : |
427
447
./scripts/run_in_build_env.sh "./scripts/run_codegen_targets.sh out/default"
448
+ - name : Find changed files
449
+ id : changed-files
450
+ uses : tj-actions/changed-files@v45
428
451
- name : Clang-tidy validation
429
452
# NOTE: clang-tidy crashes on CodegenDataModel_Write due to Nullable/std::optional check.
430
453
# See https://github.com/llvm/llvm-project/issues/97426
454
+ env :
455
+ ALL_CHANGED_FILES : ${{ steps.changed-files.outputs.all_changed_files }}
431
456
run : |
457
+ touch out/changed_files.txt
458
+ for file in ${ALL_CHANGED_FILES}; do
459
+ echo "$file changed and will be considered for tidy"
460
+ echo "$file" >>out/changed_files.txt
461
+ done
462
+
432
463
./scripts/run_in_build_env.sh \
433
464
"./scripts/run-clang-tidy-on-compile-commands.py \
434
465
--compile-database out/default/compile_commands.json \
435
466
--file-exclude-regex '/(repo|zzz_generated|lwip/standalone)/|CodegenDataModel_Write|QuieterReporting' \
467
+ --file-list-file out/changed_files.txt \
436
468
check \
437
469
"
438
470
- name : Uploading diagnostic logs
0 commit comments