3
0
Fork 0
mirror of https://github.com/Z3Prover/z3 synced 2026-08-01 19:54:04 +00:00

Add daily clang-tidy warning report workflow (#10348)

Adds a scheduled workflow to build Z3 with the clang-tidy warning
configuration being tracked in detlefs' PRs, including the latest
`-Wgnu-anonymous-struct` flag from #10345. The workflow persists all
emitted warnings as an artifact so warning regressions can be reviewed
from each run.

- **Workflow**
  - Adds `.github/workflows/clang-tidy-warning-report.yml`
  - Runs daily and on manual dispatch
  - Uses Ubuntu + CMake/Ninja with `clang` and `clang-tidy`

- **Warning coverage**
  - Reuses the repository's existing Clang warning setup
  - Layers in the current pending detlefs warning flag:
    - `-Wgnu-anonymous-struct`

- **Artifacts**
  - Captures:
    - `configure.log`
    - `build.log`
    - `combined.log`
    - `warnings.txt`
    - `status.txt`
  - Uploads them as a per-run artifact for inspection

- **Failure behavior**
  - Still uploads logs on failure
- Marks the workflow failed if configure or build fails, so broken
clang-tidy runs are visible in Actions

```yaml
CC=clang CXX=clang++ cmake -GNinja -S . -B build \
  -DCMAKE_BUILD_TYPE=Debug \
  -DCMAKE_EXPORT_COMPILE_COMMANDS=ON \
  -DCMAKE_CXX_CLANG_TIDY=clang-tidy \
  -DCMAKE_CXX_FLAGS="-Wgnu-anonymous-struct"
```

Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
This commit is contained in:
Copilot 2026-08-01 11:12:44 -07:00 committed by GitHub
parent 2d327a0080
commit 90c401c5f2
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -0,0 +1,83 @@
name: Clang-Tidy Warning Report
on:
schedule:
- cron: '0 3 * * *'
workflow_dispatch:
permissions:
contents: read
jobs:
build:
name: Build Z3 with clang-tidy warnings
runs-on: ubuntu-latest
timeout-minutes: 90
env:
DETLEFS_WARNING_FLAGS: -Wgnu-anonymous-struct
steps:
- name: Checkout code
uses: actions/checkout@v7.0.1
- name: Setup Python
uses: actions/setup-python@v7
with:
python-version: '3.x'
- name: Install dependencies
run: sudo apt-get update && sudo apt-get install -y clang clang-tidy ninja-build
- name: Configure and build with clang-tidy
id: build
shell: bash
run: |
set -o pipefail
rm -rf build /tmp/clang-tidy-warning-report
mkdir -p /tmp/clang-tidy-warning-report
configure_status=0
build_status=0
CC=clang CXX=clang++ cmake -GNinja -S . -B build \
-DCMAKE_BUILD_TYPE=Debug \
-DCMAKE_EXPORT_COMPILE_COMMANDS=ON \
-DCMAKE_CXX_CLANG_TIDY=clang-tidy \
-DCMAKE_CXX_FLAGS="${DETLEFS_WARNING_FLAGS}" \
2>&1 | tee /tmp/clang-tidy-warning-report/configure.log || configure_status=$?
if [ "$configure_status" -eq 0 ]; then
cmake --build build --target shell test-z3 -k 0 \
2>&1 | tee /tmp/clang-tidy-warning-report/build.log || build_status=$?
else
printf 'configure failed; build skipped\n' | tee /tmp/clang-tidy-warning-report/build.log
build_status=125
fi
cat /tmp/clang-tidy-warning-report/configure.log /tmp/clang-tidy-warning-report/build.log \
> /tmp/clang-tidy-warning-report/combined.log
grep -nE 'warning:|error:|clang-tidy' /tmp/clang-tidy-warning-report/combined.log \
> /tmp/clang-tidy-warning-report/warnings.txt || true
{
echo "detlefs_warning_flags=${DETLEFS_WARNING_FLAGS}"
echo "configure_status=${configure_status}"
echo "build_status=${build_status}"
} > /tmp/clang-tidy-warning-report/status.txt
echo "configure_status=${configure_status}" >> "$GITHUB_OUTPUT"
echo "build_status=${build_status}" >> "$GITHUB_OUTPUT"
- name: Upload warning artifact
if: always()
uses: actions/upload-artifact@v7
with:
name: clang-tidy-warning-report-${{ github.run_id }}
path: /tmp/clang-tidy-warning-report
if-no-files-found: error
retention-days: 7
- name: Fail on configure or build errors
if: always()
shell: bash
run: |
test "${{ steps.build.outputs.configure_status }}" = "0"
test "${{ steps.build.outputs.build_status }}" = "0"