CI: Gather warnings from every CI build into one PR report

Add ci.yml, which calls tier 1 (Linux GCC, Windows UCRT64), tier 2
(macOS Apple Clang / LLVM, Linux Clang), sanitizers and clang-tidy as
reusable workflows, then posts a single warnings report to the PR.

Every build saves its log via the new save-build-log composite action
(with the platform title and its workspace path, so Windows and macOS
paths can be mapped to repository paths). The report lists per-platform
counts of warnings in changed files and in total, and the unique
warnings across all platforms, with the platforms that reported each.

The called workflows keep workflow_dispatch for manual runs; their own
push / pull_request triggers and concurrency settings move to ci.yml.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Alexander ShaduriandClaude Opus 5.5 committed 2026-10-25 19:18:46 +01:00
1 parent 4ec5de9b75
commit 46618d42ea
9 files changed
+344 -249

No files matched your search

+86
View File
@@ -0,0 +1,86 @@
name: CI
# Runs all builds, then posts a deduplicated warnings report from all of them
# (compilers on every platform, and clang-tidy) as a PR comment, updated on each push.
on:
push:
branches: [ main ]
pull_request:
branches: [ main ]
# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:
permissions:
contents: read
# Cancel superseded runs of the same PR (pushes to main always run to completion).
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: ${{ github.event_name == 'pull_request' }}
jobs:
tier1:
uses: ./.github/workflows/cmake-tier1.yml
tier2:
uses: ./.github/workflows/cmake-tier2.yml
sanitizers:
uses: ./.github/workflows/sanitizers.yml
clang-tidy:
uses: ./.github/workflows/clang-tidy.yml
warnings-report:
needs: [ tier1, tier2, sanitizers, clang-tidy ]
if: ${{ !cancelled() }}
runs-on: ubuntu-latest
timeout-minutes: 10
permissions:
contents: read
pull-requests: write
steps:
- uses: actions/checkout@v7
- name: Download build logs
uses: actions/download-artifact@v8
with:
pattern: build-log-*
path: logs
- name: Get changed files
if: ${{ github.event_name == 'pull_request' }}
env:
GH_TOKEN: ${{ github.token }}
PR_NUMBER: ${{ github.event.pull_request.number }}
run: >
gh api --paginate "repos/$GITHUB_REPOSITORY/pulls/$PR_NUMBER/files" -q '.[].filename'
> changed-files.txt
- name: Generate report
run: |
mkdir -p logs
changed=()
if [ -f changed-files.txt ]; then changed=(--changed-files changed-files.txt); fi
python3 .github/scripts/warnings_report.py --logs-dir logs "${changed[@]}" > report.md
cat report.md >> "$GITHUB_STEP_SUMMARY"
# The token is read-only for PRs from forks, so there the report is only in the job summary.
- name: Post or update PR comment
if: ${{ github.event_name == 'pull_request' && github.event.pull_request.head.repo.full_name == github.repository }}
env:
GH_TOKEN: ${{ github.token }}
PR_NUMBER: ${{ github.event.pull_request.number }}
run: |
marker='<!-- gsmartcontrol-warnings-report -->'
comment_id=$(gh api --paginate "repos/$GITHUB_REPOSITORY/issues/$PR_NUMBER/comments" \
-q ".[] | select(.user.login == \"github-actions[bot]\" and (.body | startswith(\"$marker\"))) | .id" | head -n 1)
if [ -n "$comment_id" ]; then
gh api -X PATCH "repos/$GITHUB_REPOSITORY/issues/comments/$comment_id" -F body=@report.md > /dev/null
else
gh api -X POST "repos/$GITHUB_REPOSITORY/issues/$PR_NUMBER/comments" -F body=@report.md > /dev/null
fi
+55
View File
@@ -0,0 +1,55 @@
name: clang-tidy
# Builds with clang-tidy enabled (using the checks in .clang-tidy).
# clang-tidy warnings do not fail the build; they are included in the warnings report (see ci.yml).
# Called from ci.yml (on push / pull request), or run manually from the Actions tab.
on:
workflow_call:
workflow_dispatch:
permissions:
contents: read
env:
# Keep in sync with the job name below.
LLVM_VERSION: 22
jobs:
clang-tidy:
name: clang-tidy (clang-22)
runs-on: ubuntu-26.04
timeout-minutes: 90
steps:
- uses: actions/checkout@v7
- name: Install Dependencies
run: |
sudo apt-get update
sudo apt-get install libgtkmm-3.0-dev gettext
# toolchains/linux-dev-with-tidy.cmake hardcodes an unversioned "clang-tidy",
# so we use linux-dev.cmake and pass the versioned binary.
- name: Configure CMake
env:
CC: clang-${{ env.LLVM_VERSION }}
CXX: clang++-${{ env.LLVM_VERSION }}
run: >
cmake -B build -S "$GITHUB_WORKSPACE"
-DCMAKE_BUILD_TYPE=Debug
-DCMAKE_TOOLCHAIN_FILE="$GITHUB_WORKSPACE/toolchains/linux-dev.cmake"
-DCMAKE_CXX_CLANG_TIDY="clang-tidy-${LLVM_VERSION}"
- name: Build with clang-tidy
run: |
set -o pipefail
cmake --build build --parallel "$(nproc)" 2>&1 | tee build.log
- name: Save build log
if: ${{ always() }}
uses: ./.github/actions/save-build-log
with:
id: clang-tidy-${{ env.LLVM_VERSION }}
title: clang-tidy ${{ env.LLVM_VERSION }}
+16 -26
View File
@@ -1,23 +1,14 @@
name: Build (Tier 1 platforms)
# Called from ci.yml (on push / pull request), or run manually from the Actions tab.
on:
# Triggers the workflow on push or pull request events but only for the main branch
push:
branches: [ main ]
pull_request:
branches: [ main ]
# Allows you to run this workflow manually from the Actions tab
workflow_call:
workflow_dispatch:
permissions:
contents: read
# Cancel superseded runs of the same PR (pushes to main always run to completion).
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: ${{ github.event_name == 'pull_request' }}
env:
# Customize the CMake build type here (Release, Debug, RelWithDebInfo, etc.)
@@ -42,38 +33,37 @@ jobs:
steps:
- uses: actions/checkout@v7
- name: Update Package Database
run: sudo apt-get update
- name: Install Dependencies
run: sudo apt-get install libgtkmm-3.0-dev gettext
- name: Create Build Directory
run: cmake -E make_directory build
run: |
sudo apt-get update
sudo apt-get install libgtkmm-3.0-dev gettext
- name: Configure CMake
shell: bash
working-directory: ${{github.workspace}}/build
env:
CC: gcc-${{ matrix.gcc }}
CXX: g++-${{ matrix.gcc }}
run: >
cmake $GITHUB_WORKSPACE
cmake -B build -S "$GITHUB_WORKSPACE"
-DCMAKE_BUILD_TYPE=$BUILD_TYPE
-DCMAKE_TOOLCHAIN_FILE="$GITHUB_WORKSPACE/toolchains/linux-dev.cmake"
- name: Build
shell: bash
working-directory: ${{github.workspace}}/build
run: cmake --build . --config $BUILD_TYPE
run: |
set -o pipefail
cmake --build build --config $BUILD_TYPE 2>&1 | tee build.log
- name: Save build log
if: ${{ always() }}
uses: ./.github/actions/save-build-log
with:
id: linux-ubuntu-${{ matrix.os }}-gcc-${{ matrix.gcc }}
title: Ubuntu ${{ matrix.os }} (GCC ${{ matrix.gcc }})
- name: Test
working-directory: ${{github.workspace}}/build
shell: bash
run: ctest -C $BUILD_TYPE --rerun-failed --output-on-failure
- name: Pack (cmake install and make binary package)
shell: bash
working-directory: ${{github.workspace}}/build
run: cpack -G TBZ2
+26 -16
View File
@@ -1,23 +1,14 @@
name: Build (Tier 2 platforms)
# Called from ci.yml (on push / pull request), or run manually from the Actions tab.
on:
# Triggers the workflow on push or pull request events but only for the main branch
push:
branches: [ main ]
pull_request:
branches: [ main ]
# Allows you to run this workflow manually from the Actions tab
workflow_call:
workflow_dispatch:
permissions:
contents: read
# Cancel superseded runs of the same PR (pushes to main always run to completion).
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: ${{ github.event_name == 'pull_request' }}
env:
# Customize the CMake build type here (Release, Debug, RelWithDebInfo, etc.)
@@ -33,7 +24,10 @@ jobs:
strategy:
fail-fast: false
matrix:
compiler: [ apple-clang, llvm ]
include: [
{ compiler: apple-clang, title: "macOS (Apple Clang)" },
{ compiler: llvm, title: "macOS (Homebrew LLVM 20)" },
]
env:
LLVM_VERSION: 20
@@ -59,8 +53,16 @@ jobs:
-DAPP_COMPILER_ENABLE_WARNINGS=ON
- name: Build
working-directory: ${{github.workspace}}/build
run: cmake --build . --config $BUILD_TYPE
run: |
set -o pipefail
cmake --build build --config $BUILD_TYPE 2>&1 | tee build.log
- name: Save build log
if: ${{ always() }}
uses: ./.github/actions/save-build-log
with:
id: macos-${{ matrix.compiler }}
title: ${{ matrix.title }}
- name: Test
working-directory: ${{github.workspace}}/build
@@ -97,8 +99,16 @@ jobs:
-DCMAKE_TOOLCHAIN_FILE="$GITHUB_WORKSPACE/toolchains/linux-dev.cmake"
- name: Build
working-directory: ${{github.workspace}}/build
run: cmake --build . --config $BUILD_TYPE
run: |
set -o pipefail
cmake --build build --config $BUILD_TYPE 2>&1 | tee build.log
- name: Save build log
if: ${{ always() }}
uses: ./.github/actions/save-build-log
with:
id: linux-ubuntu-${{ matrix.os }}-clang-${{ matrix.clang }}
title: Ubuntu ${{ matrix.os }} (Clang ${{ matrix.clang }})
- name: Test
working-directory: ${{github.workspace}}/build
+12 -9
View File
@@ -1,21 +1,15 @@
name: Sanitizers
# Debug build with AddressSanitizer and UndefinedBehaviorSanitizer, running the tests.
# Called from ci.yml (on push / pull request), or run manually from the Actions tab.
on:
push:
branches: [ main ]
pull_request:
branches: [ main ]
workflow_call:
workflow_dispatch:
permissions:
contents: read
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: ${{ github.event_name == 'pull_request' }}
env:
# Keep in sync with the job name below.
LLVM_VERSION: 22
@@ -50,7 +44,16 @@ jobs:
-DCMAKE_SHARED_LINKER_FLAGS="$SANITIZER_FLAGS"
- name: Build
run: cmake --build build --parallel "$(nproc)"
run: |
set -o pipefail
cmake --build build --parallel "$(nproc)" 2>&1 | tee build.log
- name: Save build log
if: ${{ always() }}
uses: ./.github/actions/save-build-log
with:
id: asan-ubsan-clang-${{ env.LLVM_VERSION }}
title: Ubuntu 26.04 (Clang ${{ env.LLVM_VERSION }}, ASan + UBSan)
- name: Test
working-directory: ${{github.workspace}}/build
-122
View File
@@ -1,122 +0,0 @@
name: Warnings Report
# Builds with clang-tidy (checks from .clang-tidy) and with GCC (project warning flags),
# then posts a deduplicated warnings report as a PR comment (updated on each push).
# Warnings do not fail the build.
on:
push:
branches: [ main ]
pull_request:
branches: [ main ]
workflow_dispatch:
permissions:
contents: read
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: ${{ github.event_name == 'pull_request' }}
jobs:
build:
name: ${{ matrix.name }}
runs-on: ubuntu-26.04
timeout-minutes: 90
strategy:
fail-fast: false
matrix:
include: [
{ name: "clang-tidy (clang-22)", id: clang-tidy, cc: clang-22, cxx: clang++-22, tidy: clang-tidy-22 },
{ name: "gcc-15 warnings", id: gcc, cc: gcc-15, cxx: g++-15, tidy: "" },
]
steps:
- uses: actions/checkout@v7
- name: Install Dependencies
run: |
sudo apt-get update
sudo apt-get install libgtkmm-3.0-dev gettext
# toolchains/linux-dev-with-tidy.cmake hardcodes an unversioned "clang-tidy",
# so we use linux-dev.cmake and pass the versioned binary.
- name: Configure CMake
env:
CC: ${{ matrix.cc }}
CXX: ${{ matrix.cxx }}
run: >
cmake -B build -S "$GITHUB_WORKSPACE"
-DCMAKE_BUILD_TYPE=Debug
-DCMAKE_TOOLCHAIN_FILE="$GITHUB_WORKSPACE/toolchains/linux-dev.cmake"
-DCMAKE_CXX_CLANG_TIDY="${{ matrix.tidy }}"
- name: Build
run: |
set -o pipefail
cmake --build build --parallel "$(nproc)" 2>&1 | tee build.log
- name: Upload build log
if: ${{ always() }}
uses: actions/upload-artifact@v7
with:
name: build-log-${{ matrix.id }}
path: build.log
if-no-files-found: ignore
retention-days: 7
report:
needs: build
if: ${{ always() }}
runs-on: ubuntu-latest
timeout-minutes: 10
permissions:
contents: read
pull-requests: write
steps:
- uses: actions/checkout@v7
- name: Download build logs
uses: actions/download-artifact@v8
with:
pattern: build-log-*
path: logs
- name: Get changed files
if: ${{ github.event_name == 'pull_request' }}
env:
GH_TOKEN: ${{ github.token }}
PR_NUMBER: ${{ github.event.pull_request.number }}
run: >
gh api --paginate "repos/$GITHUB_REPOSITORY/pulls/$PR_NUMBER/files" -q '.[].filename'
> changed-files.txt
- name: Generate report
run: |
changed=()
if [ -f changed-files.txt ]; then changed=(--changed-files changed-files.txt); fi
python3 .github/scripts/warnings_report.py \
--workspace "$GITHUB_WORKSPACE" --build-dir build "${changed[@]}" \
--log "clang-tidy (clang-22)=logs/build-log-clang-tidy/build.log" \
--log "GCC 15=logs/build-log-gcc/build.log" \
> report.md
cat report.md >> "$GITHUB_STEP_SUMMARY"
# The token is read-only for PRs from forks, so the report is only in the job summary there.
- name: Post or update PR comment
if: ${{ github.event_name == 'pull_request' && github.event.pull_request.head.repo.full_name == github.repository }}
env:
GH_TOKEN: ${{ github.token }}
PR_NUMBER: ${{ github.event.pull_request.number }}
run: |
marker='<!-- gsmartcontrol-warnings-report -->'
comment_id=$(gh api --paginate "repos/$GITHUB_REPOSITORY/issues/$PR_NUMBER/comments" \
-q ".[] | select(.user.login == \"github-actions[bot]\" and (.body | startswith(\"$marker\"))) | .id" | head -n 1)
if [ -n "$comment_id" ]; then
gh api -X PATCH "repos/$GITHUB_REPOSITORY/issues/comments/$comment_id" -F body=@report.md > /dev/null
else
gh api -X POST "repos/$GITHUB_REPOSITORY/issues/$PR_NUMBER/comments" -F body=@report.md > /dev/null
fi
+10 -2
View File
@@ -83,8 +83,16 @@ jobs:
-DCMAKE_TOOLCHAIN_FILE="$GITHUB_WORKSPACE/toolchains/win64-mingw-msys2.cmake"
- name: Build
working-directory: ${{github.workspace}}/build
run: cmake --build . --config $BUILD_TYPE
run: |
set -o pipefail
cmake --build build --config $BUILD_TYPE 2>&1 | tee build.log
- name: Save build log
if: ${{ always() }}
uses: ./.github/actions/save-build-log
with:
id: windows-ucrt64-${{ inputs.build-type }}
title: Windows UCRT64 (GCC)
- name: Test
working-directory: ${{github.workspace}}/build