Pulls check formatting and SwiftLint on the runner
MergedThis adds two workflows, format.yml and lint.yml. They run swiftformat Grain GrainTests --lint and swiftlint lint Grain GrainTests in pinned upstream images, on pushes to main and on pulls into main. The commands match the format and lint recipes in the justfile (lines 112 and 120), and the triggers and pins look fine.
I couldn't confirm the workflows run. Both checks for this commit were still queued when I looked, so there are no results or logs. Before merging, check that both go green. In particular, check that the two images start with a shell, since the run step needs sh, and that the swiftformat --version and swiftlint version calls work.
The PR body already says a SwiftFormat version mismatch can flag files formatted locally with an older version. Beyond that, I found nothing that needs changing.
The first round's checks failed because the images' entrypoints conflicted with the runner. This commit switches both workflows to debian:trixie-slim. They now download the pinned release, check its SHA-256, and cache it under /opt/.... That fixes the cause of the earlier failures, but I can't confirm it works yet. Both checks for 0e70193 are still queued, so there are no logs.
Please change these:
- The PR description is out of date. It says the workflows run "in SwiftFormat's own image" and "SwiftLint's own image". They now use
debian:trixie-slimwith downloaded release zips. Update the "What changes" section. The "Shortcomings" section should say that the downloads come from GitHub and that the checksums are pinned. lint.ymlstill has what looks like a debugls -la /opt/swiftlint(line 31).lint.ymlalso assumes the zip puts a binary namedswiftlintat its top level.format.ymllocates its binary withfind, butlint.ymldoesn't. If the zip shipsswiftlint-static, or a dynamically linkedswiftlintthat needs the Swift runtime libraries, thelintstep will fail ontrixie-slim. Resolve the binary the wayformat.ymldoes, and make sure the one you pick runs without a Swift toolchain.
Once both checks pass, this should be ready to merge.
.knotless/workflows/lint.ymllines 30 to 32Outdated
unzip -q /tmp/swiftlint.zip -d /opt/swiftlint | |
ls -la /opt/swiftlint | |
echo "$SWIFTLINT_VERSION" > /opt/swiftlint/.version |
Remove the debug ls -la. Also confirm the zip really holds a runnable /opt/swiftlint/swiftlint. The lint step at line 37 relies on that name and path. format.yml finds its binary instead of assuming a name.
This commit pins SwiftFormat to 0.62.1, the version the code is formatted with. That is a sensible fix, since 0.64.5 would flag main. My round-2 requests are still open, and both checks for 09a269e are still queued, so there are no logs.
lint.ymlstill has the debugls -la /opt/swiftlint. Remove it. Thelintstep also still assumes the zip holds a runnable/opt/swiftlint/swiftlint.format.ymlfinds its binary instead of assuming a name. Do the same here, or confirm from a passinglintrun that the name and path are right.- The PR description is still out of date. It says the workflows run in each tool's own image, and it pins SwiftFormat at 0.64.5. Both are wrong now. The workflows use
debian:trixie-slimwith release zips downloaded from GitHub and checked against pinned SHA-256s. SwiftFormat is 0.62.1, and the reason is that 0.64.5 adds rules that main fails. Update "What changes" and "Shortcomings" to say so.
Once both checks pass and these are fixed, this is ready to merge.
.knotless/workflows/lint.ymlline 31Outdated
curl -fsSL -o /tmp/swiftlint.zip "https://github.com/realm/SwiftLint/releases/download/$SWIFTLINT_VERSION/swiftlint_linux_amd64.zip" | |
echo "$SWIFTLINT_SHA256 /tmp/swiftlint.zip" | sha256sum -c - | |
unzip -q /tmp/swiftlint.zip -d /opt/swiftlint | |
ls -la /opt/swiftlint |
Still here: remove the debug ls -la, and locate the binary with find as format.yml does rather than assuming /opt/swiftlint/swiftlint.
The debug ls -la is gone, and lint.yml now runs the swiftlint-static binary, which suits a bare Debian image. That fixes the workflow items I raised. The PR description is still unchanged, and I've now asked for that update twice.
- PR description is out of date. It says both tools run in their own images and that SwiftFormat is pinned at 0.64.5. Neither is true now:
- Both workflows use
debian:trixie-slimand download release zips from GitHub, checked against pinned SHA-256s. - SwiftFormat is 0.62.1, because 0.64.5 adds rules that main fails.
- SwiftLint uses
swiftlint-static. - The "Shortcomings" line about versions being newer than local installs no longer matches.
- Please update "What changes" and "Shortcomings" with
edit_item.
- Both workflows use
- Checks have not run. Both checks for
e298601are stillqueued, so I can't confirm the workflows work.lint.ymlassumes the zip hasswiftlint-staticat its top level. Before merging, check that both go green, or fall back tofindfor that name iflintcan't find the binary.
Once the description is accurate and both checks pass, this is ready to merge.
.knotless/workflows/lint.ymllines 38 to 39
/opt/swiftlint/swiftlint-static version | |
/opt/swiftlint/swiftlint-static lint Grain GrainTests |
This relies on swiftlint-static sitting at the top level of the zip. The checks haven't run, so that is unconfirmed. If lint fails with "not found", locate the binary with find as format.yml does.
The description is updated: debian:trixie-slim with each tool's release zip from GitHub, checked against a pinned SHA-256; SwiftFormat 0.62.1 and why; swiftlint-static and why. Both checks pass at e298601: format in 26s (0/253 files need formatting), lint in 14s (1 warning, 0 serious), so swiftlint-static is at the zip's top level as the step expects, and it runs without a Swift toolchain. The zip holds swiftlint and swiftlint-static by those names, so a find would add nothing.

What changes
format.yml runs
swiftformat Grain GrainTests --lintwith the repository's.swiftformat, asjust formatdoes, with SwiftFormat 0.62.1.lint.yml runs
swiftlint lint Grain GrainTestswith.swiftlint.yml, asjust lintdoes, with SwiftLint 0.65.1. Errors fail it; warnings are reported and pass, as locally.Both run on pushes to main and on pulls into it, on runner.knotless.dev, in
debian:trixie-slimwith each tool's Linux release, pinned by version and SHA-256 and kept in the run cache.Why
Pulls here had no checks but the GitHub mirror. The runner is Linux in Docker, so formatting and lint are what it can check.
The build and the tests need a macOS runner with Xcode, and are not run anywhere on knotless. xcodebuild runs on macOS alone.
The tools' own images (
ghcr.io/nicklockwood/swiftformat,ghcr.io/realm/swiftlint) do not work on the runner: each sets the tool as its entrypoint, and the runner starts every image withtail -f /dev/nullto run its steps in, so the container never starts. SwiftLint's release has two binaries;swiftlint-staticis the one that runs on a bare Debian (swiftlintwants libxml2 and the Swift runtime).SwiftFormat is pinned at 0.62.1, the version the code is formatted with. 0.64.5, the newest, fails main with rules it added since (
repeatedGuard,nestedIf,extensionAttributes, and somesortImportsandindent). A bump here should come withjust format-fixrun on that version.How it was checked
Only on the runner. At this head:
formatpasses in 26s, 0 of 253 files needing formatting;lintpasses in 14s with 1 warning (legacy_swiftui_aspect_ratioatNotificationsView.swift:464) and no errors.Shortcomings
No build and no tests, as above. SwiftLint without Xcode cannot run analyzer rules, though
.swiftlint.ymlenables none. Anyone formatting locally with a Homebrew SwiftFormat newer than 0.62.1 will make changes this check does not ask for, and the reverse.🤖 Generated with Claude Code