Skip to content

PhotoCraft: An open-source, photo editor written by scratch in pure Rust

CI: run the Linux without-heif and craft-fonts builds in parallel

Ivanfa17b6f4b191
diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml
index 8a0ec7391..dcb001777 100644
--- a/.github/workflows/ci.yml
+++ b/.github/workflows/ci.yml
@@ -136,20 +136,64 @@ jobs:
- name: Doctests
run: cargo test --workspace --locked --features heif --doc
+ - name: Clippy
+ run: cargo clippy --workspace --all-targets --locked --features heif -- -D warnings
+
+ - name: Dependency layering
+ run: cargo xtask layers
+
+ # docs/scorecard.md must match its sources (checklists, budgets, baseline, corpus floors,
+ # prefs audit). Static: it reads committed files only, no benchmarks run here.
+ - name: Scorecard up to date
+ 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 >/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:
+
# 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'
+ if: matrix.variant == 'without heif'
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).
+ # 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: runner.os == 'Linux'
+ if: matrix.variant == 'with craft-fonts'
uses: actions/checkout@11d5960a326750d5838078e36cf38b85af677262 # v4
with:
repository: storytold/craft-fonts
@@ -157,24 +201,12 @@ jobs:
path: craft-fonts
- name: Test with craft-fonts
- if: runner.os == 'Linux'
+ 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
- - name: Clippy
- run: cargo clippy --workspace --all-targets --locked --features heif -- -D warnings
-
- - name: Dependency layering
- run: cargo xtask layers
-
- # docs/scorecard.md must match its sources (checklists, budgets, baseline, corpus floors,
- # prefs audit). Static: it reads committed files only, no benchmarks run here.
- - name: Scorecard up to date
- if: runner.os == 'Linux'
- run: cargo xtask scorecard --check
-
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