66 branches :
77 - bpf_base
88 - bpf-next_base
9+ - bpf-next
910
11+ env :
12+ veristat_arch : x86_64
13+ veristat_toolchain : gcc
14+
1015concurrency :
1116 group : ci-test-${{ github.ref_name }}
1217 cancel-in-progress : true
1722 outputs :
1823 build-matrix : ${{ steps.set-matrix-impl.outputs.build_matrix }}
1924 test-matrix : ${{ steps.set-matrix-impl.outputs.test_matrix }}
25+ veristat-runs-on : ${{ steps.set-matrix-impl.outputs.veristat_runs_on }}
2026 steps :
2127 - id : set-matrix-impl
2228 shell : python3 -I {0}
@@ -109,6 +115,12 @@ jobs:
109115 for test in get_tests(config)
110116 ]}
111117 set_output("test_matrix", dumps(test_matrix))
118+
119+ veristat_runs_on = next(x['runs_on']
120+ for x in matrix
121+ if x['arch'] == "${{env.veristat_arch}}" and
122+ x['toolchain'] == "${{env.veristat_toolchain}}")
123+ set_output("veristat_runs_on", veristat_runs_on)
112124 build :
113125 name : build for ${{ matrix.arch }} with ${{ matrix.toolchain_full }}
114126 needs : set-matrix
@@ -243,9 +255,8 @@ jobs:
243255 kbuild-output : ${{ env.KBUILD_OUTPUT }}
244256 max-make-jobs : 32
245257 llvm-version : ${{ matrix.llvm-version }}
246- - if : ${{ github.event_name != 'push' }}
247- name : Build selftests
248- uses : libbpf/ci/build-selftests@main
258+ - name : Build selftests
259+ uses : eddyz87/libbpf-ci/build-selftests@main
249260 with :
250261 toolchain : ${{ matrix.toolchain }}
251262 kbuild-output : ${{ env.KBUILD_OUTPUT }}
@@ -259,8 +270,7 @@ jobs:
259270 kbuild-output : ${{ env.KBUILD_OUTPUT }}
260271 max-make-jobs : 32
261272 llvm-version : ${{ matrix.llvm-version }}
262- - if : ${{ github.event_name != 'push' }}
263- name : Tar artifacts
273+ - name : Tar artifacts
264274 run : |
265275 # Remove intermediate object files that we have no use for. Ideally
266276 # we'd just exclude them from tar below, but it does not provide
@@ -304,8 +314,7 @@ jobs:
304314 # Only on pushed changes are build artifacts actually cached, because
305315 # of github.com/actions/cache's cache isolation logic.
306316 rm -rf "${KBUILD_OUTPUT}"
307- - if : ${{ github.event_name != 'push' }}
308- uses : actions/upload-artifact@v3
317+ - uses : actions/upload-artifact@v3
309318 with :
310319 name : vmlinux-${{ matrix.arch }}-${{ matrix.toolchain_full }}
311320 if-no-files-found : error
@@ -354,3 +363,89 @@ jobs:
354363 kernel-root : ' .'
355364 max-cpu : 8
356365 kernel-test : ${{ matrix.test }}
366+ veristat :
367+ name : veristat
368+ needs : [set-matrix, build]
369+ runs-on : ${{ fromJSON(needs.set-matrix.outputs.veristat-runs-on) }}
370+ timeout-minutes : 100
371+ env :
372+ KERNEL : LATEST
373+ REPO_ROOT : ${{ github.workspace }}
374+ REPO_PATH : " "
375+ KBUILD_OUTPUT : kbuild-output/
376+ steps :
377+ - name : Setup environment variables
378+ run : |
379+ echo arch_and_tool=${{ env.veristat_arch }}-${{ env.veristat_toolchain }} > \
380+ ${GITHUB_ENV}
381+ - uses : actions/checkout@v3
382+ - uses : actions/download-artifact@v3
383+ with :
384+ name : vmlinux-${{ env.arch_and_tool }}
385+ path : .
386+ - name : Untar artifacts
387+ # zstd is installed by default in the runner images.
388+ run : zstd -d -T0 vmlinux-${{ env.arch_and_tool }}.tar.zst --stdout | tar -xf -
389+
390+ - name : Prepare rootfs
391+ uses : eddyz87/libbpf-ci/prepare-rootfs@main
392+ with :
393+ project-name : ' libbpf'
394+ arch : x86_64
395+ kernel : LATEST
396+ kernel-root : ' .'
397+ kbuild-output : ${{ env.KBUILD_OUTPUT }}
398+ image-output : ' /tmp/root.img'
399+ test : run_veristat
400+
401+ - name : Run veristat
402+ uses : eddyz87/libbpf-ci/run-qemu@main
403+ timeout-minutes : 10
404+ with :
405+ arch : x86_64
406+ img : ' /tmp/root.img'
407+ vmlinuz : ' ${{ github.workspace }}/vmlinuz'
408+ kernel-root : ' .'
409+ max-cpu : 8
410+ kernel-test : run_veristat
411+ output-dir : ' ${{ github.workspace }}'
412+
413+ # veristat.csv is produced by run-qemu run_veristat action
414+ - uses : actions/upload-artifact@v3
415+ with :
416+ name : ${{ env.arch_and_tool }}-veristat-log
417+ if-no-files-found : error
418+ path : ' ${{ github.workspace }}/veristat.csv'
419+
420+ # For pull request:
421+ # - get baseline log from cache
422+ # - compare it to current run
423+ - if : ${{ github.event_name == 'pull_request' }}
424+ uses : actions/cache/restore@v3
425+ with :
426+ key : ${{ env.arch_and_tool }}-veristat-baseline
427+ restore-keys : |
428+ ${{ env.arch_and_tool }}-veristat-baseline-
429+ path : ' ${{ github.workspace }}/veristat-baseline.csv'
430+
431+ - if : ${{ github.event_name == 'pull_request' }}
432+ name : Show veristat comparison
433+ run : |
434+ cd ${{ github.workspace }}
435+ selftests/bpf/veristat \
436+ --output-format csv \
437+ --emit file,prog,verdict,states \
438+ --compare veristat-baseline.csv veristat.csv > compare.csv
439+ python3 ./.github/scripts/veristat-compare.py compare.csv
440+
441+ # For push: just put baseline log to cache
442+ - if : ${{ github.event_name == 'push' }}
443+ run : |
444+ mv '${{ github.workspace }}/veristat.csv' \
445+ '${{ github.workspace }}/veristat-baseline.csv'
446+
447+ - if : ${{ github.event_name == 'push' }}
448+ uses : actions/cache/save@v3
449+ with :
450+ key : ${{ env.arch_and_tool }}-veristat-baseline-${{ github.run_id }}
451+ path : ' ${{ github.workspace }}/veristat-baseline.csv'
0 commit comments