Skip to content

test: split unit job to speed up macOS CI#7388

Merged
jdx merged 4 commits intomainfrom
ci/split-unit-job
Dec 18, 2025
Merged

test: split unit job to speed up macOS CI#7388
jdx merged 4 commits intomainfrom
ci/split-unit-job

Conversation

@jdx
Copy link
Owner

@jdx jdx commented Dec 18, 2025

Summary

The unit (macos-latest) job was taking 6-18 minutes because it ran much more than just unit tests. This PR splits the job to improve CI performance:

  • unit (macos-latest): Now only runs cargo test --all-features

    • Timeout reduced from 30 to 15 minutes
    • Only depends on build-macos
  • lint (ubuntu-latest): New job for all lint/check tasks

    • cargo deny check, cargo msrv verify, cargo machete
    • mise run lint (actionlint, cargo-fmt, hk, markdownlint, ripgrep, schema)
    • cargo clippy (both variants)
    • ./scripts/test-standalone.sh
    • Runs on faster Ubuntu runner with mold linker

Cache Strategy

All jobs share shared-key: build to minimize storage:

  • Only lint job saves cache (on main branch via save-if: ${{ github.ref == 'refs/heads/main' }})
  • build-ubuntu, build-macos, and unit use save-if: false (read-only)

Expected Results

Job Before After
unit (macos-latest) 6-18 min ~2-6 min
lint (ubuntu-latest) N/A ~5-8 min

Both jobs run in parallel after their respective build jobs, reducing overall wall clock time.

Test plan

  • CI passes on this PR
  • Verify unit job only runs cargo test
  • Verify lint job runs all lint tasks
  • Check cache is shared correctly

🤖 Generated with Claude Code


Note

Split heavy lint/checks into a new lint job on Ubuntu, simplified unit (macOS) to just run tests, removed build-macos, adjusted caching/artifacts, and added a ci aggregation job to enforce all-job success.

  • CI workflow (.github/workflows/test.yml):
    • Job restructuring:
      • Remove build-macos.
      • Simplify unit (macOS) to only build and run cargo test --all-features (drops lint/tools setup and artifact download).
      • Add lint (Ubuntu) running checks: cargo-deny, cargo-msrv, cargo-machete, ./scripts/test-standalone.sh, mise run lint, cargo clippy (both), with setup-mold and bun i.
      • Add ci aggregator job to fail if any required jobs (build-ubuntu, build-windows, unit, nightly, lint, coverage, windows-unit, windows-e2e) do not succeed.
    • Caching/artifacts:
      • Use shared rust-cache key build; set save-if: false for build-ubuntu; conditional save-if on main for unit/lint.
      • lint downloads mise-ubuntu-latest artifact; unit now builds locally instead of downloading artifacts.
    • Misc:
      • Standardize mise install usage and add wait-for-gh-rate-limit where used.

Written by Cursor Bugbot for commit ca0b517. This will update automatically on new commits. Configure here.

The unit (macos-latest) job was taking 6-18 minutes because it ran much
more than just unit tests. This splits the job:

- **unit (macos-latest)**: Now only runs `cargo test --all-features`
  - Timeout reduced from 30 to 15 minutes
  - Only depends on build-macos

- **lint (ubuntu-latest)**: New job for all lint/check tasks
  - cargo deny, msrv, machete
  - mise run lint
  - cargo clippy (both variants)
  - test-standalone.sh
  - Runs on faster Ubuntu runner with mold linker

Cache strategy optimized:
- All jobs share `shared-key: build`
- Only lint job saves cache (on main branch)
- Other jobs use save-if: false (read-only)

Expected results:
- unit: ~2-6 min (down from 6-18)
- lint: ~5-8 min (runs in parallel)

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Copilot AI review requested due to automatic review settings December 18, 2025 15:46
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR refactors the CI workflow to improve performance by splitting the slow macOS unit test job into two parallel jobs. The unit (macos-latest) job now only runs unit tests, while a new lint (ubuntu-latest) job handles all linting, formatting, and verification tasks on a faster Ubuntu runner.

Key Changes:

  • Split the monolithic unit (macos-latest) job into focused unit (tests only) and lint (all checks) jobs
  • Optimized cache strategy with shared build key and conditional saving only on main branch for the lint job
  • Reduced unit job timeout from 30 to 15 minutes and removed unnecessary dependencies

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines +120 to +121
timeout-minutes: 15
needs: [build-macos]
Copy link

Copilot AI Dec 18, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The unit job now only depends on build-macos, but it previously depended on both build-ubuntu and build-macos. Since the new lint job performs tasks that may validate cross-platform compatibility, consider whether removing the build-ubuntu dependency could miss issues that would be caught by having both builds complete first.

Copilot uses AI. Check for mistakes.
- run: mise x wait-for-gh-rate-limit -- wait-for-gh-rate-limit
- run: mise install
- run: mise x -- bun i
- run: mise x -- cargo test --all-features
Copy link

Copilot AI Dec 18, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The unit job no longer installs bun (removed mise x -- bun i step), but still runs tests with --all-features. If any tests depend on bun-installed dependencies or JavaScript tooling, those tests may fail or be skipped silently. Verify that no tests require the bun installation step.

Copilot uses AI. Check for mistakes.
Add a `ci` job that runs after all other jobs and checks that they all
succeeded. This simplifies branch protection rules - only need to
require the `ci` job instead of listing all individual jobs.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
@jdx jdx changed the title ci: split unit job to speed up macOS CI test: split unit job to speed up macOS CI Dec 18, 2025
The macOS cache was never being saved because:
- build-macos had save-if: false
- unit (macos) had save-if: false
- lint saves but runs on Ubuntu (separate cache key)

Fix by having build-macos save the cache on main branch.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
The build-macos job was redundant - unit was just downloading the
artifact to run tests. Now unit builds and tests directly, which:

- Removes an unnecessary job
- Lets unit start immediately (no waiting for build-macos)
- Simplifies the workflow

unit job now:
- Builds mise with cargo build --all-features
- Saves cache on main branch
- Runs mise install and cargo test

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
@jdx jdx enabled auto-merge (squash) December 18, 2025 16:17
@jdx jdx merged commit 3a3c23c into main Dec 18, 2025
29 of 30 checks passed
@jdx jdx deleted the ci/split-unit-job branch December 18, 2025 16:17
@github-actions
Copy link

Hyperfine Performance

mise x -- echo

Command Mean [ms] Min [ms] Max [ms] Relative
mise-2025.12.11 x -- echo 20.8 ± 0.5 19.8 24.4 1.00
mise x -- echo 21.4 ± 0.8 20.1 24.2 1.03 ± 0.05

mise env

Command Mean [ms] Min [ms] Max [ms] Relative
mise-2025.12.11 env 20.4 ± 0.8 19.3 27.1 1.00
mise env 21.0 ± 0.8 19.5 26.9 1.03 ± 0.06

mise hook-env

Command Mean [ms] Min [ms] Max [ms] Relative
mise-2025.12.11 hook-env 20.6 ± 0.8 19.3 24.9 1.00
mise hook-env 21.1 ± 0.9 19.7 25.0 1.03 ± 0.06

mise ls

Command Mean [ms] Min [ms] Max [ms] Relative
mise-2025.12.11 ls 18.4 ± 0.8 17.0 24.2 1.00
mise ls 18.7 ± 0.8 17.4 21.9 1.02 ± 0.06

xtasks/test/perf

Command mise-2025.12.11 mise Variance
install (cached) 113ms 116ms -2%
ls (cached) 70ms 68ms +2%
bin-paths (cached) 75ms 76ms -1%
task-ls (cached) 4250ms ✅ 294ms +1345%

✅ Performance improvement: task-ls cached is 1345%

jekis913 added a commit to jekis913/mise that referenced this pull request Dec 19, 2025
* upstream/renovate/lockfile-maintenance:
  chore(deps): lock file maintenance
  fix(ci): improve GHA cache efficiency and fix registry-ci bug (jdx#7404)
  feat(tera): add haiku() function for random name generation (jdx#7399)
  feat: implement independent versioning for subcrates (jdx#7402)
  docs: add comprehensive glossary (jdx#7401)
  docs: improve installation documentation (jdx#7403)
  test: add token pool integration for rate limit distribution (jdx#7397)
  docs: add link to COPR package page for Fedora/RHEL
  test: rename duplicate 'ci' job names for clarity (jdx#7398)
  registry: add github backend for swiftformat (jdx#7396)
  chore: rename mise-tools to mise-versions
  chore: release 2025.12.12 (jdx#7386)
  fix(github): use version_prefix when fetching release for SLSA verification (jdx#7391)
  refactor(vfox): remove submodules, embed plugins directly (jdx#7389)
  test(registry): add final ci job as merge gate (jdx#7390)
  test: split unit job to speed up macOS CI (jdx#7388)
  feat(backend): add security features to github backend (jdx#7387)
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.

3 participants