From fa17b6f4b191fdcaafb3cfceb530e4283d09a90b Mon Sep 17 00:00:00 2001 From: Ivan Date: Sun, 11 Oct 2026 05:08:46 +0300 Subject: [PATCH] CI: run the Linux without-heif and craft-fonts builds in parallel They ran after the main tests in the Linux test job and added ~10 min to its critical path (and were why that job ran out of disk). Now a two-leg job restores the test job's cache read-only (shared-key: test) and saves nothing, so the cache budget (#2688) doesn't grow. Co-Authored-By: Claude Opus 5.5 --- .github/workflows/ci.yml | 86 +++++++++++++++++++++++++++------------- 1 file changed, 59 insertions(+), 27 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 8a0ec7391c..dcb0017775 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -136,33 +136,6 @@ jobs: - name: Doctests run: cargo test --workspace --locked --features heif --doc - # The same codecs without the optional decoder: HEIC must stay a clear "not in this build" - # error for distributors who leave it out. - - name: Test without heif - if: runner.os == 'Linux' - run: cargo test -p photocraft-heif -p photocraft-codecs -p photocraft-io --locked - - # The same tests built with the optional craft-fonts input (crates/text/build.rs), so the - # Japanese font tests that skip without it run here. Linux only. Keep the exact `--workspace - # --features heif --lib --bins --tests` of the Test step: any other package, target or - # feature selection resolves a different feature set, recompiles the whole dependency graph - # into the same target dir and runs the runner out of disk (as `-p photocraft-text -p - # photocraft-ui-egui` did after #800). - - name: Check out craft-fonts - if: runner.os == 'Linux' - uses: actions/checkout@11d5960a326750d5838078e36cf38b85af677262 # v4 - with: - repository: storytold/craft-fonts - ref: abb83316d96aa59c1cf64784289e378fe9fa5695 - path: craft-fonts - - - name: Test with craft-fonts - if: runner.os == 'Linux' - env: - CRAFT_FONTS_DIR: ${{ github.workspace }}/craft-fonts - CRAFT_FONTS_REQUIRED: "1" - run: cargo nextest run --workspace --locked --features heif --lib --bins --tests --no-fail-fast - - name: Clippy run: cargo clippy --workspace --all-targets --locked --features heif -- -D warnings @@ -175,6 +148,65 @@ jobs: if: runner.os == 'Linux' run: cargo xtask scorecard --check + # The two other builds of the Linux tests, in parallel with the test job instead of after it (they + # added ~10 min to its critical path). Each restores the test job's cache (`shared-key: test` is + # that job's key) and saves none: the dependencies are the same, and the 10 GB cache budget is + # tight (#2688). + test-variants: + name: test (${{ matrix.variant }}) + runs-on: ubuntu-latest + strategy: + fail-fast: false + matrix: + variant: [without heif, with craft-fonts] + steps: + - uses: actions/checkout@v4 + + - name: Install Linux system dependencies (egui/winit/rfd) + run: | + nohup sudo rm -rf /usr/local/lib/android /usr/share/dotnet /opt/ghc /usr/local/.ghcup \ + /opt/hostedtoolcache/CodeQL /dev/null 2>&1 & + sudo apt-get update + sudo apt-get install -y --no-install-recommends \ + libxkbcommon-dev libwayland-dev libx11-dev libxrandr-dev libxi-dev \ + libgl1-mesa-dev libgtk-3-dev + + - uses: dtolnay/rust-toolchain@stable + + - uses: Swatinem/rust-cache@v2 + with: + shared-key: test + save-if: false + + - uses: taiki-e/install-action@9983c65e42da123ff25d1f78505eb6de315aa172 # v2.87.20 + if: matrix.variant == 'with craft-fonts' + with: + tool: cargo-nextest@0.9.146 + + # The same codecs without the optional decoder: HEIC must stay a clear "not in this build" + # error for distributors who leave it out. + - name: Test without heif + if: matrix.variant == 'without heif' + run: cargo test -p photocraft-heif -p photocraft-codecs -p photocraft-io --locked + + # The tests built with the optional craft-fonts input (crates/text/build.rs), so the Japanese + # font tests that skip without it run. Keep the test job's exact `--workspace --features heif + # --lib --bins --tests`, so the restored dependencies match and only the workspace rebuilds. + - name: Check out craft-fonts + if: matrix.variant == 'with craft-fonts' + uses: actions/checkout@11d5960a326750d5838078e36cf38b85af677262 # v4 + with: + repository: storytold/craft-fonts + ref: abb83316d96aa59c1cf64784289e378fe9fa5695 + path: craft-fonts + + - name: Test with craft-fonts + if: matrix.variant == 'with craft-fonts' + env: + CRAFT_FONTS_DIR: ${{ github.workspace }}/craft-fonts + CRAFT_FONTS_REQUIRED: "1" + run: cargo nextest run --workspace --locked --features heif --lib --bins --tests --no-fail-fast + corpus: # Real-file corpus tests (cargo feature `corpus`), on every PR and on main. The corpora are # pinned in xtask/src/corpus_pins.rs and sha256-verified (xtask/*.sha256) after both a cache