Skip to content

Commit 89bc5db

Browse files
david-marchandchaudron
authored andcommitted
github: Skip clang-analyze when reference generation fails.
By assuming that OVS maintainers never push changes that breaks compilation in GHA (which seems to be the case so far), it seems natural to assume that generating the reference for clang analyzer should always work. If generating this reference fails, it is likely due to a change external to OVS code, and not due to the series being tested (though this series gets flagged with an error in patchwork). Such a situation is often hit in the dpdk-latest branch when some DPDK API change breaks OVS compilation and no OVS fix is merged yet. Split the clang analyzer check in two jobs: - a clang-analyze-cache job, responsible for computing a cache key of the reference code and compiling a reference build, - a clang-analyze job, which depends on the former job, responsible for compiling the current patch and comparing the result against the reference, The cache generation won't be reported as a failure at the OVS build step (using continue-on-error:). If such a failure happens, the cache-analyze job is skipped. Fixes: d662eee ("ci: Add clang-analyze to GitHub actions.") Signed-off-by: David Marchand <[email protected]> Signed-off-by: Eelco Chaudron <[email protected]>
1 parent 6278e92 commit 89bc5db

File tree

1 file changed

+60
-6
lines changed

1 file changed

+60
-6
lines changed

.github/workflows/build-and-test.yml

Lines changed: 60 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -332,7 +332,7 @@ jobs:
332332
name: logs-linux-${{ join(matrix.*, '-') }}
333333
path: logs.tgz
334334

335-
build-clang-analyze:
335+
build-clang-analyze-cache:
336336
needs: build-dpdk
337337
env:
338338
dependencies: |
@@ -341,7 +341,10 @@ jobs:
341341
CC: clang
342342
DPDK: dpdk
343343
CLANG_ANALYZE: true
344-
name: clang-analyze
344+
name: clang-analyze-cache
345+
outputs:
346+
key: ${{ steps.cache_key.outputs.key }}
347+
outcome: ${{ steps.build_base.outcome }}
345348
runs-on: ubuntu-24.04
346349
timeout-minutes: 30
347350

@@ -412,35 +415,86 @@ jobs:
412415
key: ${{ steps.cache_key.outputs.key }}
413416

414417
- name: set up python
418+
if: steps.clang_cache.outputs.cache-hit != 'true'
415419
uses: actions/setup-python@v5
416420
with:
417421
python-version: ${{ env.python_default }}
418422

419423
- name: get cached dpdk-dir
424+
if: steps.clang_cache.outputs.cache-hit != 'true'
420425
uses: actions/cache/restore@v4
421426
with:
422427
path: dpdk-dir
423428
key: ${{ needs.build-dpdk.outputs.dpdk_key }}
424429

425430
- name: update APT cache
431+
if: steps.clang_cache.outputs.cache-hit != 'true'
426432
run: sudo apt update || true
427433

428434
- name: install common dependencies
435+
if: steps.clang_cache.outputs.cache-hit != 'true'
429436
run: sudo apt install -y ${{ env.dependencies }}
430437

431438
- name: prepare
439+
if: steps.clang_cache.outputs.cache-hit != 'true'
432440
run: ./.ci/linux-prepare.sh
433441

434442
- name: build base reference
443+
id: build_base
435444
if: steps.clang_cache.outputs.cache-hit != 'true'
445+
continue-on-error: true
436446
run: ./.ci/linux-build.sh
437447

438-
- name: save cache
439-
uses: actions/cache/save@v4
440-
if: steps.clang_cache.outputs.cache-hit != 'true'
448+
build-clang-analyze:
449+
needs: [build-dpdk, build-clang-analyze-cache]
450+
if: >
451+
needs.build-clang-analyze-cache.outputs.outcome == 'success' ||
452+
needs.build-clang-analyze-cache.outputs.outcome == 'skipped'
453+
env:
454+
dependencies: |
455+
automake bc clang-tools libnuma-dev libunbound-dev libunwind-dev \
456+
libssl-dev libtool libxdp-dev llvm-dev
457+
CC: clang
458+
DPDK: dpdk
459+
CLANG_ANALYZE: true
460+
name: clang-analyze
461+
runs-on: ubuntu-24.04
462+
timeout-minutes: 30
463+
464+
steps:
465+
- name: checkout
466+
uses: actions/checkout@v4
467+
468+
- name: update PATH
469+
run: |
470+
echo "$HOME/bin" >> $GITHUB_PATH
471+
echo "$HOME/.local/bin" >> $GITHUB_PATH
472+
473+
- name: check for analyzer result cache
474+
uses: actions/cache/restore@v4
441475
with:
442476
path: base-clang-analyzer-results
443-
key: ${{ steps.cache_key.outputs.key }}
477+
key: ${{ needs.build-clang-analyze-cache.outputs.key }}
478+
479+
- name: set up python
480+
uses: actions/setup-python@v5
481+
with:
482+
python-version: ${{ env.python_default }}
483+
484+
- name: get cached dpdk-dir
485+
uses: actions/cache/restore@v4
486+
with:
487+
path: dpdk-dir
488+
key: ${{ needs.build-dpdk.outputs.dpdk_key }}
489+
490+
- name: update APT cache
491+
run: sudo apt update || true
492+
493+
- name: install common dependencies
494+
run: sudo apt install -y ${{ env.dependencies }}
495+
496+
- name: prepare
497+
run: ./.ci/linux-prepare.sh
444498

445499
- name: build
446500
run: ./.ci/linux-build.sh

0 commit comments

Comments
 (0)