Skip to content

ci: cancel superseded runs and add a test-uv timeout - #25

Merged
iamtatsuki05 merged 4 commits into
developfrom
work/ci-speedup
Nov 3, 2026
Merged

iamtatsuki05 merged 4 commits into
developfrom
work/ci-speedup

Conversation

@iamtatsuki05

@iamtatsuki05 iamtatsuki05 commented Nov 3, 2026 •

Copy link
Copy Markdown
Owner

WHY

CI should run faster and use fewer runner minutes without changing what it checks. This repo is public, so its runner minutes are free. The gain is less wasted runner time here and in the repos made from this template.

When you push a new commit to a PR, the run for the older commit keeps going, and nobody uses its result. MIREI was made from this template and has the same two workflows. There, 26 of 123 test-docker runs were still running when the next push to the same PR started, and they used about 164 runner minutes after they were out of date. This repo had 1 such run in 17. Also, test-uv has no timeout, so a hung job can run for 6 hours.

WHAT

  • Both workflows get a concurrency group per workflow and PR, with cancel-in-progress: true. A new push to the PR cancels the run for the older commit.
  • The test-uv job gets timeout-minutes: 12. Repos made from this template add their own dependencies. In nlp-template, which adds torch, the slowest test-uv run took 3.9 min, and 12 is about 3 times that. This repo's slowest run took 1.6 min.

The branch has 3 commits. The first added a uv cache and a Docker layer cache. The second removed both caches after the runs below showed no gain. The third raised the timeout. The net diff is the two items above.

VERIFICATION

  • test-docker: superseded runs used 1.2 runner minutes in this repo's 17 runs and 164 in MIREI's 123 runs (measured from run history). cancel-in-progress stops such a run when the next push starts (inferred, because no push superseded a run on this PR).
  • test-uv: the timeout only caps a hung job. No run so far took longer than 3.9 min in this repo family.
  • CI on head 69c2146 passed. test-uv took 50 s (run 41690525628) and test-docker 199 s (run 41690525447), against baseline medians of 48 s and 150 s over 17 runs. The image build, which this PR does not touch, took 174 s of that.
  • uv cache, measured and removed: uv sync takes about 4 s (Prepared 224 packages in 4.00s), and the cold run spent 31 s saving a 318 MB cache (run 41681555715).
  • Docker layer cache, measured and removed: test-docker took 357 s cold and 160 s on 1 warm rerun with 13 CACHED steps, against the 150 s baseline median. Pulling about 900 MB of cached layers took about 82 s, and loading the image into Docker took 34.5 s (run 41681555683, attempts 1 and 2).
  • actionlint 1.7.12 finds nothing new. Its 3 findings (the old runtimes of actions/checkout@v2, actions/checkout@v3, and actions/setup-python@v4) are on develop too.

RISKS AND REMAINING WORK

  • The concurrency group now includes the file name, so called workflows and their callers never share a group.
  • No push trigger on develop. Without a cache, there is nothing to warm.
  • Not included: inside the container, uv run tox installs every package again, because the bind mount hides the image's .venv. Fixing that means changing compose.yml.

test-uv installs uv with astral-sh/setup-uv and stores the uv cache in
the GitHub Actions cache, keyed on uv.lock. It also gets a 5-minute
timeout.

test-docker builds the image with docker/build-push-action and stores
the layers in the GitHub Actions cache. Compose then starts the loaded
image with --no-build, so a tag mismatch fails the job.

Both workflows cancel a PR run when a newer push to the same PR starts.
@iamtatsuki05 iamtatsuki05 self-assigned this Nov 3, 2026
@iamtatsuki05
iamtatsuki05 marked this pull request as draft November 3, 2026 17:17
@iamtatsuki05 iamtatsuki05 changed the title ci: cache uv and Docker layers, cancel superseded runs [WIP] ci: cache uv and Docker layers, cancel superseded runs Nov 3, 2026
The PR runs showed that neither cache saves time here. uv sync takes
about 4 s, and the cold run spent 31 s saving a 318 MB uv cache. The
warm test-docker run took 160 s against a 150 s baseline median,
because pulling the cached layers and loading the image took as long
as building it.

Keep the concurrency groups and the test-uv timeout.
@iamtatsuki05 iamtatsuki05 changed the title [WIP] ci: cache uv and Docker layers, cancel superseded runs [WIP] ci: cancel superseded runs and add a test-uv timeout Nov 3, 2026
@iamtatsuki05 iamtatsuki05 added the enhancement New feature or request label Nov 3, 2026
Repos made from this template add their own dependencies. In
nlp-template, which has torch, the slowest test-uv run took 3.9 min,
and a run on a slow apt mirror took 4.2 min. A 5-minute limit would
fail those runs, while 12 minutes still stops a hung job.
@iamtatsuki05 iamtatsuki05 changed the title [WIP] ci: cancel superseded runs and add a test-uv timeout ci: cancel superseded runs and add a test-uv timeout Nov 3, 2026
@iamtatsuki05
iamtatsuki05 marked this pull request as ready for review November 3, 2026 18:11
@iamtatsuki05
iamtatsuki05 merged commit 6bc0f2b into develop Nov 3, 2026
2 checks passed
@iamtatsuki05 iamtatsuki05 mentioned this pull request Nov 3, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant