From 806dff20d98d6e28fde2af4e380bd01c40a6ce67 Mon Sep 17 00:00:00 2001 From: Andrew Tridgell Date: Mon, 8 Jun 2026 09:47:57 +1000 Subject: [PATCH] tests: add clang scan-build static-analysis CI (informational) Run the clang static analyzer over a check-progs build, publish the HTML report as an artifact, and print the bug count to the run summary. INFORMATIONAL only: it does not pass --status-bugs, so it surfaces new analyzer findings without going red on the existing (overwhelmingly false-positive) reports. Runs on push/PR to master and via workflow_dispatch. No cron: it is informational and its output only changes with the code (push/PR) or the clang version, so a daily run on an unchanged tree would add noise without value. --- .github/workflows/scan-build.yml | 51 ++++++++++++++++++++++++++++++++ 1 file changed, 51 insertions(+) create mode 100644 .github/workflows/scan-build.yml diff --git a/.github/workflows/scan-build.yml b/.github/workflows/scan-build.yml new file mode 100644 index 00000000..23c1b73c --- /dev/null +++ b/.github/workflows/scan-build.yml @@ -0,0 +1,51 @@ +name: rsync scan-build (clang analyzer) + +on: + push: + branches: [ master ] + paths-ignore: + - '.github/workflows/*.yml' + - '!.github/workflows/scan-build.yml' + pull_request: + branches: [ master ] + paths-ignore: + - '.github/workflows/*.yml' + - '!.github/workflows/scan-build.yml' + workflow_dispatch: + +jobs: + scan-build: + runs-on: ubuntu-latest + name: rsync scan-build (clang analyzer) + steps: + - uses: actions/checkout@v4 + with: + fetch-depth: 0 + - name: prep + run: | + sudo apt-get update + sudo apt-get install -y clang clang-tools acl libacl1-dev attr libattr1-dev liblz4-dev libzstd-dev libxxhash-dev openssl + - name: configure (under scan-build) + # Run configure under scan-build so its analyzer compiler-wrapper is baked + # into the Makefile's $(CC); --disable-md2man avoids the doc toolchain. + run: scan-build ./configure --with-rrsync --disable-md2man + - name: scan-build (informational) + # Static analysis only -- INFORMATIONAL, not a gate. rsync currently has + # a fair number of reports that are overwhelmingly known false positives + # (e.g. unix.Chroot "no chdir after chroot", core.NonNullParamChecker + # against functions that can't actually receive NULL). We publish the + # HTML report as an artifact and print the bug count to the run summary, + # but do NOT pass --status-bugs, so this surfaces new analyzer findings + # without going red on arrival. check-progs builds rsync + the test + # helpers without needing the man-page toolchain. + run: | + scan-build -o "$PWD/scan-report" make check-progs -j"$(nproc)" 2>&1 | tee scan-build.out + echo '## scan-build summary' >>"$GITHUB_STEP_SUMMARY" + grep -E 'scan-build: .* bugs? found|scan-build: No bugs found' scan-build.out >>"$GITHUB_STEP_SUMMARY" || true + - name: upload report + if: always() + uses: actions/upload-artifact@v4 + with: + name: scan-build-report + path: scan-report + if-no-files-found: ignore