Files
photocraft/.github/workflows/ci.yml
aiongg 519a0c22a3 Engine split step 3: top crate with the wrapper Session
crates/engine keeps the package photocraft-engine: src/facade.rs re-exports
photocraft-engine-core, and its Session wraps core's and installs every engine
command. Core's Session::new() installs nothing; core gets install() and session().
The command registry keeps main's behaviour (empty before an install).

The top crate's dev-dependencies cover tests/ and examples/, including
craft-develop-model (camera raw baseline test) and photocraft-testkit (the
corpus-gated Photoshop oracle test). Dependents that need the core type or
borrowed two fields through the wrapper are fixed at the call site, and tests
that reach the registry before any session install first.

Tooling follows the package: workspace dependency, cl selection, xtask layers,
i18n report, scorecard and corpus paths, nextest overrides, ci-test-times rows,
display-names roots, prefs_usage paths, the engine split scripts, docs, and the
two release-perf steps in ci.yml.

Corpus .atn paths, the layer_menu registry read and the craft-develop-model
dev-dependency are FredApps' fixes from #16431.

Part of #15710
2026-11-22 19:29:06 +00:00

813 lines
41 KiB
YAML

name: CI
# Quality gates for every push to main and every pull request. The Linux and Windows tests run
# through the suite's shared gate workflow in craft-common-actions (`cargo xtask ci`, split over the
# gate's jobs); the test variant, web and fuzz jobs are PhotoCraft's own. Every night
# the Linux gate alone runs a cold build: the safety net for the workspace crates it keeps between
# runs (`cache-workspace-crates`), and a fresh start for that cache entry.
on:
push:
branches: [main]
schedule:
- cron: "11 3 * * *"
pull_request:
# `labeled` so that adding `full-ci` to an open PR starts a run with Windows in it.
types: [opened, synchronize, reopened, labeled]
workflow_dispatch:
inputs:
full_sweep:
description: "Run every testkit sweep case and every corpus file, as the nightly run does (runtime comparison and integration validation)"
type: boolean
default: false
color_range:
description: "Compare cropped Color Range on 24 MP (Linux, exact outputs)"
type: boolean
default: false
selection_combining:
description: "Compare direct GRAY8 selection combining on 36 MP (Linux, exact outputs)"
type: boolean
default: false
brush_tip:
description: "Compare cached round-tip rasterization on 24 MP"
type: boolean
default: false
brush_tip_base:
description: "Baseline commit for the round-tip comparison"
type: string
default: "main"
selection_morphology:
description: "Compare selection morphology on 36 MP (Linux, exact outputs)"
type: boolean
default: false
fuzz:
description: "Run the fuzz job"
type: boolean
default: false
fuzz_seconds:
description: "Seconds per fuzz target"
default: "600"
dry_mixer:
description: "Compare the live Mixer Brush against the origin/main merge base on 24 MP (Linux)"
type: boolean
default: false
# The token is only used to check out the code: no job writes to the repository.
permissions:
contents: read
env:
CARGO_TERM_COLOR: always
RUST_BACKTRACE: 1
# Every case of the long test sweeps and every corpus file (photocraft-testkit `full_sweep`): the
# nightly run and manual runs with `full_sweep`. Other runs take a sweep part and the corpus samples.
PHOTOCRAFT_FULL_SWEEP: ${{ (inputs.full_sweep || github.event_name == 'schedule') && '1' || '0' }}
# No test or fuzz run may print a page: the engine refuses to spool, and if something ever
# bypasses that, lp fails loudly on a printer that does not exist.
PHOTOCRAFT_NO_PRINT: "1"
LPDEST: photocraft-no-such-printer
# A newer push to a PR branch cancels its older run. Every push to main gets a run of its own that
# is never cancelled, so each state of main is checked to the end. Adding any label but `full-ci`
# gets a group of its own, so it neither runs anything nor cancels a run.
concurrency:
group: ci-${{ github.event_name == 'pull_request' && (github.event.action != 'labeled' || github.event.label.name == 'full-ci') && github.ref || github.run_id }}
cancel-in-progress: ${{ github.event_name == 'pull_request' }}
jobs:
# Git dependencies come from github.com/storytold, and Cargo.lock is complete and up to date.
git-sources:
if: github.event_name != 'schedule' && (github.event.action != 'labeled' || github.event.label.name == 'full-ci')
# Tracks @main so suite-wide CI fixes reach every app without a PR in each repository.
uses: storytold/craft-common-actions/.github/workflows/git-sources.yml@main
# Whether the Windows legs and the web build run. main, manual runs and PRs labelled `full-ci`
# get both. Other PRs get Windows when they touch code whose behaviour differs by platform: the
# app shell, UI, text and fonts, GPU, pen input, native saves, build scripts or the lockfile.
# Format changes must exercise the Windows-only publication barriers (#8034). macOS is tested
# only by release.yml. `windows_gpu`: whether those Windows legs run photocraft-gpu's tests, which
# render on WARP, the CPU Direct3D 12 rasterizer, and took half of the integration leg's test time.
# Pull requests run them only when they change the GPU crate, a workspace crate it builds on, any
# package manifest, or a file outside the workspace packages other than documentation
# (scripts/ci-windows-gpu-tests.py, #15247); the Linux gate runs them on every pull request, and main runs them on Windows too.
# `linux_skip`: the packages the Linux gate leaves out of its test build because nothing a pull request changes
# reaches them (same rule, every package but photocraft-gpu); empty on main, the nightly run and `full-ci`.
# `windows_skip`: the platform-neutral packages whose Windows tests a pull request skips because nothing it
# changes reaches them (same script); empty on main and `full-ci`.
platforms:
if: github.event_name != 'schedule' && (github.event.action != 'labeled' || github.event.label.name == 'full-ci')
timeout-minutes: 10
name: select platforms
runs-on: ${{ github.ref == 'refs/heads/main' && github.event_name != 'pull_request' && 'artcraft-k8s-main' || 'ubuntu-latest' }}
outputs:
windows: ${{ steps.pick.outputs.windows }}
windows_gpu: ${{ steps.pick.outputs.windows_gpu }}
windows_skip: ${{ steps.pick.outputs.windows_skip }}
linux_skip: ${{ steps.pick.outputs.linux_skip }}
web: ${{ steps.pick.outputs.web }}
steps:
- name: Harden runner
uses: step-security/harden-runner@1d88384fd173af6ecb012dfd0264a306b711241a # v2.22.4
with:
egress-policy: audit
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
fetch-depth: 0
persist-credentials: false
- id: pick
env:
EVENT: ${{ github.event_name }}
BASE: ${{ github.event.pull_request.base.sha }}
FULL: ${{ contains(github.event.pull_request.labels.*.name, 'full-ci') }}
run: |
if [ "$EVENT" != pull_request ] || [ "$FULL" = true ]; then
{
echo "windows=true"
echo "windows_gpu=true"
echo "windows_skip="
echo "linux_skip="
echo "web=true"
} >> "$GITHUB_OUTPUT"
exit 0
fi
# The browser build (a fat-LTO wasm build) runs only when something it compiles or
# packages changed: the web app and its packaging, crate sources and manifests (the web
# build compiles nearly every crate), the workspace manifests, the craft-i18n pin and this
# workflow.
if git diff --name-only "$BASE" HEAD | grep -Eq '^(apps/photocraft-web(-boot)?/|packaging/web/|packaging/env\.sh$|crates/[^/]+/(src/|Cargo\.toml$|build\.rs$)|Cargo\.(toml|lock)$|craft-i18n\.rev$|rust-toolchain(\.toml)?$|\.github/workflows/ci\.yml$)'; then
echo "web=true" >> "$GITHUB_OUTPUT"
else
echo "web=false" >> "$GITHUB_OUTPUT"
fi
if git diff --name-only "$BASE" HEAD | grep -Eq '^(apps/|crates/(ui-egui|text|gpu|tablet|heif|format)/|Cargo\.lock$|craft-i18n\.rev$|(.*/)?build\.rs$|\.cargo/config\.toml$|\.config/nextest\.toml$|\.config/ci-test-times\.tsv$|xtask/|scripts/ci-test-shard\.sh$|\.github/workflows/ci\.yml$)'; then
echo "windows=true" >> "$GITHUB_OUTPUT"
else
echo "windows=false" >> "$GITHUB_OUTPUT"
fi
gpu=$(python3 scripts/ci-windows-gpu-tests.py "$BASE")
echo "windows_gpu=$gpu" >> "$GITHUB_OUTPUT"
if [ "$gpu" = false ]; then
echo "::notice::photocraft-gpu's tests are skipped on Windows: this pull request changes nothing they are built from (the Linux gate still runs them)."
fi
linux_skip=$(python3 scripts/ci-windows-gpu-tests.py --skip-linux "$BASE")
echo "linux_skip=$linux_skip" >> "$GITHUB_OUTPUT"
if [ -n "$linux_skip" ]; then
echo "::notice::Tests of packages the pull request does not reach are skipped on Linux (main runs them all): $linux_skip"
fi
skip=$(python3 scripts/ci-windows-gpu-tests.py --skip-neutral "$BASE")
echo "windows_skip=$skip" >> "$GITHUB_OUTPUT"
if [ -n "$skip" ]; then
echo "::notice::Tests of platform-neutral packages the pull request does not reach are skipped on Windows (the Linux gate still runs them): $skip"
fi
# The Linux gate (craft-common-actions gate.yml). Its `lint` leg runs the checks that need no test
# build. The `build` job builds the tests once and writes one nextest archive per shard
# (`cargo xtask ci archive`, `shard-archives`), each with only the test binaries that shard runs,
# balanced by .config/ci-test-times.tsv (xtask/src/shards.rs); it uploads them and then runs the
# doctests. Each of the four test shards downloads its own archive and runs it
# (scripts/ci-test-shard.sh). Shard 1 runs nextest's `gpu` group alone, on lavapipe, and
# fails on a skipped GPU comparison (scripts/ci-gpu-lavapipe.py); shards 2-4 split the other
# tests. The `gpu` group is ~840 test-seconds on 4 slots (~3.5 min); the other ~6900
# test-seconds over 3 shards are ~8.5-10.5 min each.
# The build keeps the compiled workspace crates between runs (`cache-workspace-crates`), so a
# pull request rebuilds only the crates its changes reach. Each main run's build job saves a
# rolling entry of its own, which `test (without heif)` restores too; `cache-prune` keeps
# the newest one. The lint legs keep no cache (`lint-cache: false`): a cold lint leg costs
# minutes, and their entries (~1 GB per OS) would not fit the 10 GB cache budget.
gate:
# `platforms` is skipped on the nightly run, which tests everything. When it fails, its outputs
# are empty (`linux_skip` included), so the gate still runs and tests everything.
needs: platforms
if: ${{ !cancelled() && (github.event.action != 'labeled' || github.event.label.name == 'full-ci') }}
# Tracks @main so suite-wide CI fixes reach every app without a PR in each repository.
uses: storytold/craft-common-actions/.github/workflows/gate.yml@main
with:
os: ${{ github.ref == 'refs/heads/main' && github.event_name != 'pull_request' && '["artcraft-k8s-main"]' || '["ubuntu-24.04"]' }}
# On the cluster runners sccache uses the shared cluster cache, which main runs fill for
# every app; PR runs on hosted runners can't reach it, so they leave it off.
sccache: ${{ github.ref == 'refs/heads/main' && github.event_name != 'pull_request' }}
# egui/winit/rfd.
packages: >-
libxkbcommon-dev libwayland-dev libx11-dev libxrandr-dev libxi-dev libgl1-mesa-dev
libgtk-3-dev mesa-vulkan-drivers libvulkan1
# The tests build with the optional craft-fonts input (crates/text/build.rs), so the
# Japanese font tests that skip without it run. Same commit as release.yml.
craft-fonts-ref: cc9269cd8d8258785dac603fba3122e5d2556795
# CI test binaries carry no debuginfo and no symbols (CARGO_PROFILE_TEST_STRIP below): a
# test build drops from ~19 to ~6.5 GB. A panic still names its file and line; only
# backtrace frames lose names and lines. Local builds keep Cargo.toml's line tables.
dev-debug: "0"
cache-version: v2
env: |
PHOTOCRAFT_FULL_SWEEP=${{ (inputs.full_sweep || github.event_name == 'schedule') && '1' || '0' }}
PHOTOCRAFT_NO_PRINT=1
LPDEST=photocraft-no-such-printer
CARGO_PROFILE_TEST_STRIP=symbols
PHOTOCRAFT_CI_EXCLUDE=${{ needs.platforms.outputs.linux_skip }}
PHOTOCRAFT_CORPUS_TESTS=1
timeout-minutes: 100
cache-workspace-crates: true
lint-cache: false
cold-build: ${{ github.event_name == 'schedule' }}
# fmt, egui-fork, clippy, layers, panel-commands, scorecard, the wasm32 check and the
# missing-translations report (`cargo xtask ci lint`, xtask/src/main.rs), and the CI scripts'
# own tests.
lint-command: python3 scripts/test-ci-gpu-lavapipe.py && python3 scripts/test-ci-windows-gpu-tests.py && python3 scripts/test-ci-test-times.py && python3 scripts/test-ci-toolchain-bump.py && python3 scripts/test-ci-clear-rolling-cache.py && cargo xtask ci lint
archive-command: cargo xtask-gate archive --gpu-shard
after-archive-command: cargo xtask-gate doctest
test-shards: 4
shard-archives: true
# The tests and panic_hunt with `--locked --features heif` (TEST_TARGETS in xtask/src/main.rs).
shard-command: bash scripts/ci-test-shard.sh --gpu-shard
# The Windows tests and Clippy on the same gate, when `platforms` says the run needs them: a
# `lint` leg runs Clippy, the `build` job builds the tests once into one nextest archive per shard
# (as on Linux, without a GPU shard) and then runs the doctests, and six shards each run their own
# archive. Windows runs
# the tests ~1.75x slower than Linux: ~55 min on one runner, ~9 min per shard. A seventh shard
# would not shorten the slowest one while its slowest test alone takes ~9.6 min (the
# shortcut-dispatch UI test). The browser apps are wasm targets, so their native tests are left
# out; pull requests also leave out photocraft-gpu and the platform-neutral packages nothing they
# change reaches (`windows_gpu`, `windows_skip`). Windows keeps a dependency-only cache entry:
# its workspace crates would not fit the repository's cache budget beside Linux's.
windows:
needs: platforms
if: needs.platforms.outputs.windows == 'true'
# Tracks @main so suite-wide CI fixes reach every app without a PR in each repository.
uses: storytold/craft-common-actions/.github/workflows/gate.yml@main
with:
os: '["windows-latest"]'
lint-cache: false
# The all-language UI tests shape real Japanese, Chinese, Korean and Devanagari labels with
# kittest's strict `MissingGlyphPolicy::Panic`, and a hosted Windows image has no guaranteed
# Japanese or Simplified Chinese system font. Same pinned central fonts as Linux and release.
craft-fonts-ref: cc9269cd8d8258785dac603fba3122e5d2556795
# No wasm32 check on Windows: the Linux lint leg runs it.
targets: ""
# No debuginfo on Windows: writing PDBs for ~200 test binaries cost 2.2 of ~21 build minutes.
# A panic still names its file and line; only backtrace frames lose theirs (Linux keeps
# line-tables-only, so a backtrace with lines is one OS away).
dev-debug: "0"
cache-version: v2
# CARGO_TARGET_DIR: the Windows compiler command line carries one -L path per built
# dependency; a short target path keeps it within CreateProcess's limit. rust-lld (shipped
# with the toolchain) links the test binaries instead of link.exe, and the test links skip
# identical-code folding and PDBs; the link arguments in build.rs (/DELAYLOAD, delayimp.lib)
# are lld-link options too.
env: |
PHOTOCRAFT_FULL_SWEEP=${{ (inputs.full_sweep || github.event_name == 'schedule') && '1' || '0' }}
PHOTOCRAFT_NO_PRINT=1
LPDEST=photocraft-no-such-printer
CARGO_TARGET_DIR=D:\t
CARGO_TARGET_X86_64_PC_WINDOWS_MSVC_LINKER=rust-lld
CARGO_TARGET_X86_64_PC_WINDOWS_MSVC_RUSTFLAGS=-Clink-arg=/OPT:NOICF -Clink-arg=/DEBUG:NONE
PHOTOCRAFT_CI_EXCLUDE=photocraft-web photocraft-web-boot ${{ needs.platforms.outputs.windows_gpu == 'false' && 'photocraft-gpu' || '' }} ${{ needs.platforms.outputs.windows_skip }}
timeout-minutes: 100
lint-command: cargo xtask ci clippy
archive-command: cargo xtask-gate archive
after-archive-command: cargo xtask-gate doctest
test-shards: 6
shard-archives: true
shard-command: bash scripts/ci-test-shard.sh
# Keeps one Actions cache entry per family on main, so the repository stays within its 10 GB
# budget and GitHub never evicts an entry a run still needs (an evicted Windows entry makes the
# Windows build cold, about 60 instead of 21 minutes). It runs beside the run's jobs and prunes
# each time a job that saves an entry finishes: the gate's build jobs (the Linux rolling entry,
# about 4 GB, and the Windows dependency entry) and web. A skipped job is listed under its
# own name (a skipped reusable-workflow call under the caller job's), so a run that skips one
# still ends. No `needs`: the gate is one reusable call, and waiting for it would leave the
# replaced entry in place until every shard has run. A failed prune warns instead of failing the
# run, and cache-prune.yml prunes again after every attempt, re-runs of failed jobs included.
cache-prune:
name: cache prune
if: github.event_name != 'pull_request' && github.ref == 'refs/heads/main'
# A cold Windows build takes about an hour, and the watch ends when it does; `watch-minutes`
# ends it before this limit.
timeout-minutes: 120
runs-on: ${{ github.ref == 'refs/heads/main' && github.event_name != 'pull_request' && 'artcraft-k8s-main' || 'ubuntu-24.04' }}
permissions:
actions: write
steps:
- name: Harden runner
uses: step-security/harden-runner@1d88384fd173af6ecb012dfd0264a306b711241a # v2.22.4
with:
egress-policy: audit
- name: Prune replaced cache entries
uses: storytold/craft-common-actions/actions/cache-prune@main
continue-on-error: true
with:
watch: true
watch-minutes: 110
saving-jobs: |
^gate( / build \(.*\))?$
^windows( / build \(.*\))?$
^web build and wasm size gate$
# The nightly cold run never restores the rolling crates entry, so the old entry is only overlap
# while the cold run saves its own: two entries of about 4 GB, which with the others go over the
# 10 GB cache limit and get the Windows, web and corpus entries evicted. This deletes the old
# entries when the build job starts saving (scripts/ci-clear-rolling-cache.py).
cold-cache-clear:
name: cold cache clear
if: github.event_name == 'schedule'
runs-on: ubuntu-24.04
timeout-minutes: 110
continue-on-error: true
permissions:
actions: write
steps:
- name: Harden runner
uses: step-security/harden-runner@1d88384fd173af6ecb012dfd0264a306b711241a # v2.22.4
with:
egress-policy: audit
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
persist-credentials: false
- name: Delete the old rolling entries before the save
env:
GH_TOKEN: ${{ github.token }}
run: python3 scripts/ci-clear-rolling-cache.py
# The same codecs without the optional decoder: HEIC must stay a clear "not in this build" error
# for distributors who leave it out. Runs beside the gate and restores the gate's newest rolling
# cache entry without saving one: the dependencies are the same, and the 10 GB cache budget is
# tight (#2688). Its sources keep their checkout mtimes, so the workspace crates it builds are
# rebuilt.
test-without-heif:
if: github.event_name != 'schedule' && (github.event.action != 'labeled' || github.event.label.name == 'full-ci')
timeout-minutes: 60
name: test (without heif)
# The gate's runner: its cache entry is keyed on the OS.
runs-on: ${{ github.ref == 'refs/heads/main' && github.event_name != 'pull_request' && 'artcraft-k8s-main' || 'ubuntu-24.04' }}
env:
# The gate sets these; rust-cache hashes CARGO_* and RUST* variables into its key.
CARGO_INCREMENTAL: 0
CARGO_NET_RETRY: 10
CARGO_PROFILE_DEV_DEBUG: "0"
CARGO_PROFILE_TEST_STRIP: symbols
steps:
- name: Harden runner
uses: step-security/harden-runner@1d88384fd173af6ecb012dfd0264a306b711241a # v2.22.4
with:
egress-policy: audit
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
persist-credentials: false
# The translations at the commit in craft-i18n.rev, as the gate and release.yml embed them
# (sets CRAFT_I18N_DIR and CRAFT_I18N_REQUIRED=1).
- name: Check out craft-i18n
uses: storytold/craft-common-actions/actions/checkout-craft-i18n@main
- name: Install Linux build dependencies
uses: storytold/craft-common-actions/actions/install-apt-packages@main
with:
packages: >-
libxkbcommon-dev libwayland-dev libx11-dev libxrandr-dev libxi-dev libgl1-mesa-dev
libgtk-3-dev
- id: rust
uses: storytold/craft-common-actions/actions/rust-channel@f5141455aac7b2eb4708aa259d8ffcdf10fde939
- uses: step-security/dtolnay-rust-toolchain@8dd607977d06adf4ed49b190381e74c17a9dd25f # v1.0.0
with:
toolchain: ${{ steps.rust.outputs.toolchain }}
targets: ${{ steps.rust.outputs.targets }}
components: ${{ steps.rust.outputs.components }}
# The gate's own key (the shared action computes it), restore only. The toolchain action
# exports CARGO_HOME, which the gate's legs do not have; align-environment leaves it out of
# the cache paths.
- uses: storytold/craft-common-actions/actions/rust-cache@main
with:
cache-version: v2
job: gate
cache-workspace-crates: "true"
align-environment: "true"
- uses: step-security/taiki-e-install-action@76747d22a7567cc4438546a84f11bdf18e670ab8 # v2.87.32
with:
tool: [email protected]
- name: Test without heif
run: cargo nextest run -p photocraft-io --locked --profile ci
web:
timeout-minutes: 60
name: web build and wasm size gate
# PRs run it only when web-relevant files change (see `platforms`); main always does.
needs: platforms
if: needs.platforms.outputs.web == 'true'
runs-on: ${{ github.ref == 'refs/heads/main' && github.event_name != 'pull_request' && 'artcraft-k8s-main' || 'ubuntu-latest' }}
env:
# Match release.yml so PR results reflect what would actually ship.
TRUNK_VERSION: 0.21.14
steps:
- name: Harden runner
uses: step-security/harden-runner@1d88384fd173af6ecb012dfd0264a306b711241a # v2.22.4
with:
egress-policy: audit
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
persist-credentials: false
# The translations at the commit in craft-i18n.rev, as the gate and release.yml embed them
# (sets CRAFT_I18N_DIR and CRAFT_I18N_REQUIRED=1).
- name: Check out craft-i18n
uses: storytold/craft-common-actions/actions/checkout-craft-i18n@main
- id: rust
uses: storytold/craft-common-actions/actions/rust-channel@f5141455aac7b2eb4708aa259d8ffcdf10fde939
- uses: step-security/dtolnay-rust-toolchain@8dd607977d06adf4ed49b190381e74c17a9dd25f # v1.0.0
with:
toolchain: ${{ steps.rust.outputs.toolchain }}
targets: ${{ steps.rust.outputs.targets }}
components: ${{ steps.rust.outputs.components }}
- uses: Swatinem/rust-cache@d1527c8f67ef9af357290475d4af4b0fab8f12e0 # v2.9.3
with:
prefix-key: v1-rust
key: ci-web
save-if: ${{ github.ref == 'refs/heads/main' }}
cache-on-failure: true
# Checksum-verified, as in release.yml's web build.
- name: Install trunk
uses: storytold/craft-common-actions/actions/install-trunk@main
with:
trunk-version: ${{ env.TRUNK_VERSION }}
# package.sh runs Trunk's release builds, validates relative URLs, cuts the wasm into
# parts, checks the 24 MiB per-file limit and exercises the packaging step release.yml uses.
- name: Build and verify browser release
env:
# Pull requests skip wasm-opt --converge (minutes slower); main keeps it, so the size
# gate on a PR measures a slightly larger wasm than main produces.
PHOTOCRAFT_WEB_WASM_OPT_CONVERGE: ${{ github.event_name == 'pull_request' && '0' || '1' }}
run: packaging/web/package.sh
- name: Report wasm size
if: success()
run: |
{
echo "### Browser WebAssembly size"
echo
echo "| File | Bytes | MiB | Limit |"
echo "| --- | ---: | ---: | ---: |"
row() { echo "| $1 | $2 | $(awk -v n="$2" 'BEGIN { printf "%.2f", n / 1048576 }') | $3 |"; }
# The app's wasm as built; it ships gzipped in parts, so only the download grows with it.
for wasm in dist/web/*.wasm; do
[ -f "$wasm" ] || continue
row "$(basename "$wasm")" "$(wc -c < "$wasm" | tr -d ' ')" "none"
done
# What a host sees: the largest file of the packaged site.
largest=$(find target/web-package -type f -printf '%s %f\n' | sort -n | tail -1)
row "largest file in the site: ${largest#* }" "${largest%% *}" "24 MiB"
} >> "$GITHUB_STEP_SUMMARY"
fuzz:
timeout-minutes: 60
name: fuzz (${{ matrix.target.crate }}/${{ matrix.target.name }})
# Placeholder: manual trigger only until a nightly schedule is enabled.
if: github.event_name == 'workflow_dispatch' && inputs.fuzz
runs-on: ${{ github.ref == 'refs/heads/main' && github.event_name != 'pull_request' && 'artcraft-k8s-main' || 'ubuntu-latest' }}
env:
# cargo-fuzz needs nightly; the checkout's rust-toolchain.toml would pick the pinned release.
RUSTUP_TOOLCHAIN: nightly
strategy:
fail-fast: false
matrix:
target:
- { crate: psd, name: parse }
- { crate: psd, name: descriptor }
- { crate: psd, name: image_source_data }
- { crate: psd, name: grd }
- { crate: psd, name: ase }
- { crate: psd, name: aco }
- { crate: psd, name: patterns }
- { crate: psd, name: filter_effects }
- { crate: psd, name: metadata }
- { crate: psd, name: tagged }
- { crate: psd, name: resources }
- { crate: psd, name: asl }
- { crate: codecs, name: decode_any }
- { crate: codecs, name: decode_png }
- { crate: codecs, name: decode_jpeg }
- { crate: codecs, name: decode_tiff }
- { crate: codecs, name: decode_exr }
- { crate: codecs, name: decode_heif }
- { crate: affinity, name: preview }
- { crate: affinity, name: import_preview, args: "--features io" }
- { crate: format, name: load }
steps:
- name: Harden runner
uses: step-security/harden-runner@1d88384fd173af6ecb012dfd0264a306b711241a # v2.22.4
with:
egress-policy: audit
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
persist-credentials: false
- uses: step-security/dtolnay-rust-toolchain@8dd607977d06adf4ed49b190381e74c17a9dd25f # v1.0.0
with:
toolchain: nightly
- run: rustc -Vv
- name: Install cargo-fuzz
run: cargo install cargo-fuzz --locked
- name: Fuzz
working-directory: crates/${{ matrix.target.crate }}
env:
FUZZ_SECONDS: ${{ inputs.fuzz_seconds }}
run: cargo fuzz run ${{ matrix.target.name }} ${{ matrix.target.args }} -- -max_total_time="$FUZZ_SECONDS"
- name: Upload crash artifacts
if: failure()
uses: actions/upload-artifact@cf430e030ddbb5b0abf93d22962f4752f3646cd9 # v7.0.2
with:
name: fuzz-${{ matrix.target.crate }}-${{ matrix.target.name }}
path: crates/${{ matrix.target.crate }}/fuzz/artifacts
color-range-performance:
if: inputs.color_range == true
runs-on: ${{ github.ref == 'refs/heads/main' && github.event_name != 'pull_request' && 'artcraft-k8s-main' || 'ubuntu-latest' }}
timeout-minutes: 45
env:
RAYON_NUM_THREADS: "4"
steps:
- name: Harden runner
uses: step-security/harden-runner@1d88384fd173af6ecb012dfd0264a306b711241a # v2.22.4
with:
egress-policy: audit
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
persist-credentials: false
- name: Install Linux build dependencies
uses: storytold/craft-common-actions/actions/install-apt-packages@main
with:
packages: >-
libxkbcommon-dev libwayland-dev libx11-dev libxrandr-dev libxi-dev libgl1-mesa-dev
libgtk-3-dev
- id: rust
uses: storytold/craft-common-actions/actions/rust-channel@f5141455aac7b2eb4708aa259d8ffcdf10fde939
- uses: step-security/dtolnay-rust-toolchain@8dd607977d06adf4ed49b190381e74c17a9dd25f # v1.0.0
with:
toolchain: ${{ steps.rust.outputs.toolchain }}
targets: ${{ steps.rust.outputs.targets }}
components: ${{ steps.rust.outputs.components }}
- name: Compare exact outputs and release timings on 24 MP
run: |
set -o pipefail
cargo test --release -p photocraft-engine-core --lib color_range_release_comparison -- --ignored --nocapture | tee color-range-perf.txt
- uses: actions/upload-artifact@cf430e030ddbb5b0abf93d22962f4752f3646cd9 # v7.0.2
if: always()
with:
name: color-range-performance
path: color-range-perf.txt
selection-morphology:
if: inputs.selection_morphology == true
runs-on: ${{ github.ref == 'refs/heads/main' && github.event_name != 'pull_request' && 'artcraft-k8s-main' || 'ubuntu-latest' }}
timeout-minutes: 45
env:
RAYON_NUM_THREADS: "4"
steps:
- name: Harden runner
uses: step-security/harden-runner@1d88384fd173af6ecb012dfd0264a306b711241a # v2.22.4
with:
egress-policy: audit
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
persist-credentials: false
- name: Install Linux build dependencies
uses: storytold/craft-common-actions/actions/install-apt-packages@main
with:
packages: >-
libxkbcommon-dev libwayland-dev libx11-dev libxrandr-dev libxi-dev libgl1-mesa-dev
libgtk-3-dev
- id: rust
uses: storytold/craft-common-actions/actions/rust-channel@f5141455aac7b2eb4708aa259d8ffcdf10fde939
- uses: step-security/dtolnay-rust-toolchain@8dd607977d06adf4ed49b190381e74c17a9dd25f # v1.0.0
with:
toolchain: ${{ steps.rust.outputs.toolchain }}
targets: ${{ steps.rust.outputs.targets }}
components: ${{ steps.rust.outputs.components }}
- name: Compare exact outputs and release timings on 36 MP
run: |
set -o pipefail
cargo run --release -p photocraft-algo --example bench_selection_morphology | tee selection-morphology-perf.txt
- name: Compare cropped command reads and writeback on 36 MP
run: |
set -o pipefail
cargo test --release -p photocraft-engine-core --lib sparse_modify_release_comparison -- --ignored --nocapture | tee -a selection-morphology-perf.txt
- uses: actions/upload-artifact@cf430e030ddbb5b0abf93d22962f4752f3646cd9 # v7.0.2
if: always()
with:
name: selection-morphology-performance
path: selection-morphology-perf.txt
selection-morphology-quick-perf:
if: inputs.selection_morphology == true || inputs.color_range == true || inputs.selection_combining == true || inputs.brush_tip == true || inputs.dry_mixer == true
name: quick performance suite
# Match perf-nightly.yml: Linux llvmpipe lacks the float render targets needed by
# bevel_bench, so its required GPU rows cannot be measured there.
runs-on: macos-15
timeout-minutes: 60
steps:
- name: Harden runner
uses: step-security/harden-runner@1d88384fd173af6ecb012dfd0264a306b711241a # v2.22.4
with:
egress-policy: audit
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
persist-credentials: false
- id: rust
uses: storytold/craft-common-actions/actions/rust-channel@f5141455aac7b2eb4708aa259d8ffcdf10fde939
- uses: step-security/dtolnay-rust-toolchain@8dd607977d06adf4ed49b190381e74c17a9dd25f # v1.0.0
with:
toolchain: ${{ steps.rust.outputs.toolchain }}
targets: ${{ steps.rust.outputs.targets }}
components: ${{ steps.rust.outputs.components }}
# perf-nightly.yml's entry (same key and runner); only that job saves it.
- uses: Swatinem/rust-cache@d1527c8f67ef9af357290475d4af4b0fab8f12e0 # v2.9.3
with:
prefix-key: v1-rust
shared-key: perf-release
save-if: false
- name: Quick performance suite
run: cargo xtask perf --quick
- uses: actions/upload-artifact@cf430e030ddbb5b0abf93d22962f4752f3646cd9 # v7.0.2
if: always()
with:
name: selection-morphology-quick-perf
path: |
target/perf/*.json
target/perf/summary.md
selection-combining:
if: inputs.selection_combining == true
runs-on: ${{ github.ref == 'refs/heads/main' && github.event_name != 'pull_request' && 'artcraft-k8s-main' || 'ubuntu-latest' }}
timeout-minutes: 30
env:
RAYON_NUM_THREADS: "4"
steps:
- name: Harden runner
uses: step-security/harden-runner@1d88384fd173af6ecb012dfd0264a306b711241a # v2.22.4
with:
egress-policy: audit
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
persist-credentials: false
- id: rust
uses: storytold/craft-common-actions/actions/rust-channel@f5141455aac7b2eb4708aa259d8ffcdf10fde939
- uses: step-security/dtolnay-rust-toolchain@8dd607977d06adf4ed49b190381e74c17a9dd25f # v1.0.0
with:
toolchain: ${{ steps.rust.outputs.toolchain }}
targets: ${{ steps.rust.outputs.targets }}
components: ${{ steps.rust.outputs.components }}
- name: Compare exact outputs and release timings on 36 MP
run: |
set -o pipefail
cargo test --release -p photocraft-algo --lib gray8_combining_release_comparison -- --ignored --nocapture | tee selection-combining-perf.txt
- uses: actions/upload-artifact@cf430e030ddbb5b0abf93d22962f4752f3646cd9 # v7.0.2
if: always()
with:
name: selection-combining-performance
path: selection-combining-perf.txt
brush-tip:
if: inputs.brush_tip == true
runs-on: ${{ github.ref == 'refs/heads/main' && github.event_name != 'pull_request' && 'artcraft-k8s-main' || 'ubuntu-24.04' }}
timeout-minutes: 30
env:
RAYON_NUM_THREADS: "4"
steps:
- name: Harden runner
uses: step-security/harden-runner@1d88384fd173af6ecb012dfd0264a306b711241a # v2.22.4
with:
egress-policy: audit
- uses: actions/checkout@v7
with:
persist-credentials: false
path: after
- uses: actions/checkout@v7
with:
persist-credentials: false
ref: ${{ inputs.brush_tip_base }}
path: before
- id: rust
uses: storytold/craft-common-actions/actions/rust-channel@f5141455aac7b2eb4708aa259d8ffcdf10fde939
- uses: step-security/dtolnay-rust-toolchain@8dd607977d06adf4ed49b190381e74c17a9dd25f # v1.0.0
with:
toolchain: ${{ steps.rust.outputs.toolchain }}
targets: ${{ steps.rust.outputs.targets }}
components: ${{ steps.rust.outputs.components }}
- name: Build the same benchmark against both versions
run: |
cp after/crates/paint/examples/big_dab_bench.rs before/crates/paint/examples/big_dab_bench.rs
cargo build --release --locked --manifest-path before/Cargo.toml -p photocraft-paint --example big_dab_bench
cargo build --release --locked --manifest-path after/Cargo.toml -p photocraft-paint --example big_dab_bench
- name: Compare round and transformed tips on 24 MP
run: |
set -o pipefail
for size in 200 2000; do
for angle in 0 0.7; do
for version in before after; do
echo "$version: size=$size angle=$angle" | tee -a brush-tip.txt
"$version/target/release/examples/big_dab_bench" "$size" 0.37 "$angle" | tee -a brush-tip.txt
done
done
done
- uses: actions/upload-artifact@v7
if: always()
with:
name: brush-tip-performance
path: brush-tip.txt
dry-mixer:
if: inputs.dry_mixer == true
runs-on: ${{ github.ref == 'refs/heads/main' && github.event_name != 'pull_request' && 'artcraft-k8s-main' || 'ubuntu-latest' }}
timeout-minutes: 90
env:
RAYON_NUM_THREADS: "4"
CARGO_PROFILE_RELEASE_LTO: "false"
CARGO_PROFILE_RELEASE_CODEGEN_UNITS: "16"
steps:
- name: Harden runner
uses: step-security/harden-runner@1d88384fd173af6ecb012dfd0264a306b711241a # v2.22.4
with:
egress-policy: audit
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
fetch-depth: 0
persist-credentials: false
- name: Pin baseline to the merge base with origin/main
id: baseline
run: |
git remote add upstream https://github.com/storytold/photocraft.git
git fetch --no-tags upstream main
base=$(git merge-base HEAD upstream/main)
echo "sha=$base" >> "$GITHUB_OUTPUT"
git worktree add --detach "$RUNNER_TEMP/photocraft-baseline" "$base"
mkdir -p "$RUNNER_TEMP/photocraft-baseline/crates/engine/examples"
cp crates/engine/examples/bench_dry_mixer.rs "$RUNNER_TEMP/photocraft-baseline/crates/engine/examples/bench_dry_mixer.rs"
- id: rust
uses: storytold/craft-common-actions/actions/rust-channel@f5141455aac7b2eb4708aa259d8ffcdf10fde939
- uses: step-security/dtolnay-rust-toolchain@8dd607977d06adf4ed49b190381e74c17a9dd25f # v1.0.0
with:
toolchain: ${{ steps.rust.outputs.toolchain }}
targets: ${{ steps.rust.outputs.targets }}
components: ${{ steps.rust.outputs.components }}
- name: Install Linux build dependencies
uses: storytold/craft-common-actions/actions/install-apt-packages@main
with:
packages: >-
libxkbcommon-dev libwayland-dev libx11-dev libxrandr-dev libxi-dev libgl1-mesa-dev
libgtk-3-dev
- name: Benchmark baseline and candidate on this runner
run: |
set -o pipefail
echo "baseline=${{ steps.baseline.outputs.sha }}" | tee dry-mixer-perf.txt
echo "candidate=${GITHUB_SHA}" | tee -a dry-mixer-perf.txt
CARGO_TARGET_DIR="$RUNNER_TEMP/target-baseline" cargo run --release --manifest-path "$RUNNER_TEMP/photocraft-baseline/Cargo.toml" -p photocraft-engine --example bench_dry_mixer | tee baseline-mixer.txt
CARGO_TARGET_DIR="$RUNNER_TEMP/target-candidate" cargo run --release -p photocraft-engine --example bench_dry_mixer | tee candidate-mixer.txt
cat baseline-mixer.txt candidate-mixer.txt >> dry-mixer-perf.txt
python3 - <<'PY'
import re
def fingerprints(path):
rows = open(path).readlines()
result = {}
for row in rows:
match = re.search(r'wet=\s*(\d+)% sample_all=\s*(\w+)\s+size=\s*(\d+).*blake3=(\w+)', row)
if match:
result[match.group(1, 2, 3)] = match.group(4)
return result
before, after = fingerprints('baseline-mixer.txt'), fingerprints('candidate-mixer.txt')
assert len(before) == 12 and before == after, 'baseline/candidate mixer output or state differs'
PY
- uses: actions/upload-artifact@cf430e030ddbb5b0abf93d22962f4752f3646cd9 # v7.0.2
if: always()
with:
name: dry-mixer-performance
path: dry-mixer-perf.txt
# After the nightly cold run passes, a warning (annotation and job summary) says when a newer stable
# Rust release than rust-toolchain.toml's exists. It needs no permission and changes nothing: a bump
# is a pull request that changes the file's `channel` by hand.
toolchain-check:
name: toolchain check
needs: gate
if: github.event_name == 'schedule' && needs.gate.result == 'success'
runs-on: ubuntu-24.04
timeout-minutes: 10
continue-on-error: true
steps:
- name: Harden runner
uses: step-security/harden-runner@1d88384fd173af6ecb012dfd0264a306b711241a # v2.22.4
with:
egress-policy: audit
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
persist-credentials: false
- name: Compare the pinned release with stable
run: |
set -euo pipefail
version=$(python3 scripts/ci-toolchain-bump.py)
if [ -z "$version" ]; then
echo "rust-toolchain.toml is current"
exit 0
fi
msg="Rust $version is the newest stable release; rust-toolchain.toml pins an older one. Change its channel in a pull request to move."
echo "::warning title=Newer Rust release::$msg"
echo "$msg" >> "$GITHUB_STEP_SUMMARY"