diff options
| author | 魏曹先生 <1992414357@qq.com> | 2026-08-18 12:19:09 +0800 |
|---|---|---|
| committer | 魏曹先生 <1992414357@qq.com> | 2026-08-18 12:23:03 +0800 |
| commit | 5de5d5d72a9021125272977a6ca2ab865043bf67 (patch) | |
| tree | b106c15f3e722de94bd555589a94828b1aafd641 /.run/src/bin/ci.py | |
| parent | b1694827328dcbf061b9b502e51830176b4f42df (diff) | |
chore: show diff on git-unlock in CI
Pass `--show-diff` to `git-unlock` and restructure CI steps as
(command, args) pairs to support per-step arguments. The diff prints
tracked workspace changes before they are discarded.
Diffstat (limited to '.run/src/bin/ci.py')
| -rw-r--r-- | .run/src/bin/ci.py | 37 |
1 files changed, 19 insertions, 18 deletions
diff --git a/.run/src/bin/ci.py b/.run/src/bin/ci.py index ced6566..6234a19 100644 --- a/.run/src/bin/ci.py +++ b/.run/src/bin/ci.py @@ -14,20 +14,21 @@ import subprocess import sys from pathlib import Path -# The pipeline steps, in execution order. -STEPS = [ - "git-lock", - "report-clean", - "build-check", - "clippy-check", - "test-all", - "example-check", - "docs-check", - "example-refresh", - "docsify-refresh", - "features-refresh", - # Idempotency check: exits non-zero if CI contaminated the workspace. - "git-unlock", +# The pipeline steps, in execution order, as (command, args) pairs. +STEPS: list[tuple[str, list[str]]] = [ + ("git-lock", []), + ("report-clean", []), + ("build-check", []), + ("clippy-check", []), + ("test-all", []), + ("example-check", []), + ("docs-check", []), + ("example-refresh", []), + ("docsify-refresh", []), + ("features-refresh", []), + # Idempotency check: exits non-zero if CI contaminated the workspace, and + # prints the diff of the contamination before restoring. + ("git-unlock", ["--show-diff"]), ] @@ -57,12 +58,12 @@ def main() -> int: except OSError: pass - for step in STEPS: - print(f"==> cargo ci {step}") - result = subprocess.run(["cargo", "ci", step], check=False) + for command, args in STEPS: + print(f"==> cargo ci {' '.join([command, *args])}") + result = subprocess.run(["cargo", "ci", command, *args], check=False) if result.returncode != 0: print( - f"error: step `{step}` failed with exit code {result.returncode}", + f"error: step `{command}` failed with exit code {result.returncode}", file=sys.stderr, ) return result.returncode |
