Files
gsmartcontrol/.github/workflows/ci.yml
T
Alexander ShaduriandClaude Opus 5.5 327d916024 CI: Reorganize the warnings report for readability
- Lead with a one-line verdict for the files changed by the PR, and
  flag builds whose log is missing.
- List warnings in changed files grouped by file, with links to the
  source lines at the PR head commit and the builds that reported them
  ("all compilers" when every compiler build did).
- Separate compiler warnings from clang-tidy findings; clang-tidy's
  re-reported compiler diagnostics are left to the compiler builds.
- Move whole-project breakdowns (by type, by file) into collapsed
  sections, and link the workflow run in the footer.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-25 19:20:46 +01:00

92 lines
3.0 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
env:
HEAD_SHA: ${{ github.event.pull_request.head.sha || github.sha }}
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[@]}" \
--repo "$GITHUB_REPOSITORY" --sha "$HEAD_SHA" \
--run-url "$GITHUB_SERVER_URL/$GITHUB_REPOSITORY/actions/runs/$GITHUB_RUN_ID" \
> 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