Files
gsmartcontrol/.github/workflows/ci.yml
T
Alexander ShaduriandClaude Opus 5.5 46618d42ea 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>
2026-10-25 19:18:46 +01:00

87 lines
2.7 KiB
YAML

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