Skip to content

Report build warnings as annotations in the Xcode 27 job - #272

Merged
swhitty merged 1 commit into
mainfrom
ci-annotate-warnings
Nov 15, 2026
Merged

swhitty merged 1 commit into
mainfrom
ci-annotate-warnings

Conversation

@swhitty

@swhitty swhitty commented Nov 15, 2026

Copy link
Copy Markdown
Owner

The Xcode 27 job now reports compiler warnings and errors as GitHub annotations, on the run and on the PR diff.

  • Build pipes swift build through tee build.log, with set -o pipefail so a failed build still fails the step. NO_COLOR=1 stops swift build writing colour and hyperlink escapes into the piped output.
  • Find warnings runs .github/actions/annotate-warnings, a short awk script that turns each path:line:col: warning: or error: into ::warning file=…,line=…. It runs even when the build fails (!cancelled()).
  • Macro diagnostics: warnings inside #expect are reported against macro expansion #expect:1:22, which GitHub can't place. The script takes the location from the following "expanded code originates here" note instead, so they land on the test line. xcbeautify's GitHub renderer reports them as file=macro expansion #expect,line=1.
  • Job summary: GitHub shows at most 10 annotations of each type per step, so every diagnostic is also listed in the job summary.

This PR leaves the four try warnings in WSHandlerTests and AsyncStream+WSFrameTests in place so its run shows the annotations. They're fixed in a follow-up PR.

Testing

Locally against NO_COLOR=1 build logs:

  • main: 4 macro warnings, each on its test file and line.
  • 9cc7e07, which had many warnings: 21 warnings on the right files and lines, and the summary table.
  • A deliberate type error: one ::error annotation, and the pipeline exits 1.

🤖 Generated with Claude Code

Tee the build log and add a "Find warnings" step that turns each compiler
warning or error into a GitHub annotation, and lists them all in the job
summary, since GitHub shows at most 10 annotations per step.

Warnings inside a macro expansion such as #expect are reported against
the expansion, so they are placed at the "expanded code originates here"
note's location instead. NO_COLOR=1 stops swift build writing colour and
hyperlink escapes into the piped log.
@codecov

codecov Bot commented Nov 15, 2026 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 93.75%. Comparing base (7ab6440) to head (928262f).
✅ All tests successful. No failed tests found.

Additional details and impacted files
@@            Coverage Diff             @@
##             main     #272      +/-   ##
==========================================
- Coverage   93.88%   93.75%   -0.13%     
==========================================
  Files          73       73              
  Lines        4022     4022              
==========================================
- Hits         3776     3771       -5     
- Misses        246      251       +5     

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

@swhitty
swhitty merged commit f6f9065 into main Nov 15, 2026
14 of 15 checks passed
@swhitty
swhitty deleted the ci-annotate-warnings branch November 16, 2026 01:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant