Skip to content

ci(#962): run swift-format from Python, not three shell steps (#2792) - #2793

Merged
zackees merged 2 commits into
masterfrom
infra/2792-gen005-run-swift-format
Oct 28, 2026
Merged

zackees merged 2 commits into
masterfrom
infra/2792-gen005-run-swift-format

Conversation

@zackees

@zackees zackees commented Oct 28, 2026 •

Copy link
Copy Markdown
Member

Fixes #2792. The run-swift-format composite action's three multi-line run:
steps become one Python module with one subcommand per step (#962 GEN-005
sweep, same shape as the merged compatibility-validator port #2692).

RED

4f9186cdc adds ci/test_run_swift_format.py:
uv run python -m unittest ci/test_run_swift_format.py -> Ran 11 tests ... FAILED (failures=3, errors=7) (the module is absent, and the action path still
carries its GEN-005 [[exceptions]] block).

GREEN

4f5b00c10:

  • ci/run_swift_format.py (#!/usr/bin/env -S uv run --no-project --script)
    with guard --notice, install-deps and format --fail-condition:
    • guard prints the ::notice:: and exits 2, still selected by the action's
      own if: runner.os == 'Windows';
    • install-deps runs the Linux step's brew update / brew install --quiet zsh through .github/scripts/retry and appends the linuxbrew bin/sbin
      directories to $GITHUB_PATH;
    • format installs swift-format, splits CHANGED_FILES the way the zsh
      line did (${(s:,:)CHANGED_FILES//[\[\]\'\"]/} — drop []'", split on
      ,), and returns build-aux/run-swift-format --fail-<c> --check <files>'s
      status, with the same ::group:: brackets.
  • the action's three steps are single uv run --no-project --script calls, and
    a pinned Set Up uv (save-cache: + the CACHE-013 cache-suffix) sits above
    the guard, since the caller (check-format.yaml's swift-format job on
    macos-26) installs no toolchain of its own;
  • the ci.toml GEN-005 block for .github/actions/run-swift-format/action.yaml
    is deleted. build-aux/run-swift-format is a separate path and keeps its own
    exception;
  • ci/test_build_aux_formatters.py's live-script pin follows the call site into
    the module (it pinned ./build-aux/run-swift-format appearing in the action
    text, which is no longer where the call lives).

Evidence

ci-lint precheck (pin a1917ce7…, same checkout):

tree header findings on this path
origin/master (c2c56cc00) 5 violation(s), 416 approved exception(s), 10 needs_review 3
this branch 5 violation(s), 413 approved exception(s), 10 needs_review 0

No other rule moved and no violation appeared.

  • uv run python -m unittest ci/test_run_swift_format.py -> OK (11 tests).
  • uv run ci/local_gate.py --only self-test -> == self-test: ok.
  • uvx ruff check ci/run_swift_format.py ci/test_run_swift_format.py -> clean.

No docs/features.md line: CI tooling, no user-visible behaviour.

No local gate stamp: this touches only ci/, a composite action and ci.toml,
so Fast Gate ⚡ + Format 🔍 / checks gate it. The swift-format job itself
runs only when a .swift file changed, so it reports skipping on this PR;
the offline pin drives the module on stub retry/formatter binaries instead.

RED: the module does not exist yet and the action's three steps are still
shell blocks, so the module cases error on import and the ci.toml case sees
the GEN-005 [[exceptions]] block for this path.

uv run python -m unittest ci/test_run_swift_format.py
-> Ran 11 tests: FAILED (failures=3, errors=7)
GREEN: ci/run_swift_format.py (guard/install-deps/format), the action's
three steps as single 'uv run' calls with a pinned Set Up uv above the guard,
and the GEN-005 exception block for this path deleted. The live-script pin in
ci/test_build_aux_formatters.py now follows the call site into the module.

uv run python -m unittest ci/test_run_swift_format.py -> OK (11 tests)
uv run ci/local_gate.py --only self-test -> == self-test: ok
@zackees

zackees commented Oct 28, 2026

Copy link
Copy Markdown
Member Author

Handed off to the coordinator.

  • Head 4f5b00c10 is on origin/master c2c56cc00; no rebase needed.
  • PR CI green: Format 🔍 / checks, Validate Data 🕵️, Build 🧱 / CI Mode 🛂, Build 🧱 / Event Data 🔎 all success, CI Gate ✅ success, every app lane skipping (ci/-only change).
  • No local gate stamp: this touches only ci/, a composite action and ci.toml, so the stamp would attest nothing extra. uv run ci/local_gate.py --only self-test was run and ended == self-test: ok.
  • Auto-merge is queued (infra/2792-gen005-run-swift-format, ci(#962): run swift-format from Python, not three shell steps (#2792) #2793).

Merged via the queue into master with commit 69bef50 Oct 28, 2026
33 checks passed
@zackees
zackees deleted the infra/2792-gen005-run-swift-format branch October 28, 2026 13:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

infra: port .github/actions/run-swift-format's three shell steps to Python (GEN-005 sweep, #962)

1 participant