mirror of
https://github.com/storytold/photocraft.git
synced 2026-11-21 17:37:14 +00:00
- xtask starts every cargo without the variables `cargo run` sets for xtask (CARGO_MANIFEST_DIR, CARGO_PKG_*, ...), so a build script that declares `rerun-if-env-changed` for them (ring) no longer reruns, with the whole craft facade above it, between builds inside and outside xtask. - `cargo xtask ci` splits into the gate's parts without a second step list: `lint` (fmt, egui-fork, clippy, layers, panel-commands, scorecard, wasm, i18n report), `archive` (test build into the nextest archive, doctests), `tests --from <dir>` (test and panic_hunt from the extracted archive, on $NEXTEST_PARTITION; --gpu / --no-gpu select by the gpu test group) and `build` (cache warm-up). Plain `cargo xtask ci` still runs every step. PHOTOCRAFT_CI_EXCLUDE leaves packages out of the test build and doctests. - The `ci` nextest profile's archive carries the xtask binary, so a shard builds nothing (scripts/ci-test-shard.sh). - Linux gate: lint leg, one build, four shards. Shard 1 runs the gpu group alone on lavapipe and checks its output (scripts/ci-gpu-lavapipe.py now wraps that run); the second GPU run and its rebuild are gone. - Windows unit, integration, clippy and warm legs move onto the shared gate (Windows runner, lint leg for Clippy, four shards), keeping the PR selection from the platforms job, rust-lld, /OPT:NOICF, /DEBUG:NONE and the D:\t target dir. - The slowest-tests-first priorities apply on Linux too. - Swatinem/rust-cache v2.9.3 by commit for this repository's own cache steps, with fresh keys; cache-version v2 for the gate and docs entries. `test (without heif)` restores the gate's entry through the shared action. Dispatch-only jobs no longer save caches no pull request reads; the quick perf suite restores perf-nightly's entry. - windows_delay_loads reads the app from NEXTEST_BIN_EXE_photocraft, as the other app tests do, since archives relocate binaries.
688 lines
32 KiB
YAML
688 lines
32 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 and the corpus, web and fuzz jobs are PhotoCraft's own.
|
|
on:
|
|
push:
|
|
branches: [main]
|
|
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 (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
|
|
PHOTOCRAFT_FULL_SWEEP: ${{ inputs.full_sweep && '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.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.
|
|
# `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.action != 'labeled' || github.event.label.name == 'full-ci'
|
|
timeout-minutes: 10
|
|
name: select platforms
|
|
runs-on: ubuntu-latest
|
|
outputs:
|
|
windows: ${{ steps.pick.outputs.windows }}
|
|
windows_gpu: ${{ steps.pick.outputs.windows_gpu }}
|
|
windows_skip: ${{ steps.pick.outputs.windows_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 "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$|\.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
|
|
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; its build job builds the tests once into a nextest archive and runs the doctests; four
|
|
# test shards run the tests from that archive. 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. With the five slowest UI tests (three of them in the `gpu` group) the GPU shard
|
|
# takes ~12 min of tests and the others ~8. Its rust-cache entry is the one `test (without heif)`
|
|
# restores.
|
|
gate:
|
|
if: 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:
|
|
# 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
|
|
# Cargo.toml's dev profile already keeps line tables only.
|
|
dev-debug: ""
|
|
cache-version: v2
|
|
env: |
|
|
PHOTOCRAFT_FULL_SWEEP=${{ inputs.full_sweep && '1' || '0' }}
|
|
PHOTOCRAFT_NO_PRINT=1
|
|
LPDEST=photocraft-no-such-printer
|
|
timeout-minutes: 100
|
|
# On main, a `cache warm` leg builds xtask and the tests and saves the dependency cache as
|
|
# soon as the build succeeds; the build job then only restores, so a failing test cannot keep
|
|
# the entry from being saved (craft-common-actions#270). The lint leg keeps its own entry.
|
|
warm-command: cargo xtask ci build
|
|
# 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 && cargo xtask ci lint
|
|
test-shards: 4
|
|
# The test build with `--locked --features heif` (TEST_TARGETS in xtask/src/main.rs) into
|
|
# $NEXTEST_ARCHIVE_FILE, then the doctests.
|
|
archive-command: cargo xtask ci archive
|
|
# The tests and panic_hunt, from the archive.
|
|
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 into a nextest archive and runs the
|
|
# doctests, and four shards split the tests (Windows runs them ~1.75x slower than Linux, ~50 min
|
|
# of tests on one runner). 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`). The `cache warm` leg (main only) builds what main's
|
|
# build job builds.
|
|
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"]'
|
|
# 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 && '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
|
|
warm-command: cargo xtask ci build
|
|
lint-command: cargo xtask ci clippy
|
|
test-shards: 4
|
|
archive-command: cargo xtask ci archive
|
|
shard-command: bash scripts/ci-test-shard.sh
|
|
|
|
# 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 dependency
|
|
# cache without saving one: the dependencies are the same, and the 10 GB cache budget is tight
|
|
# (#2688).
|
|
test-without-heif:
|
|
if: 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: 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
|
|
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
|
|
|
|
- uses: step-security/dtolnay-rust-toolchain@8dd607977d06adf4ed49b190381e74c17a9dd25f # v1.0.0
|
|
with:
|
|
toolchain: stable
|
|
|
|
# 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 key.
|
|
- uses: storytold/craft-common-actions/actions/rust-cache@main
|
|
with:
|
|
cache-version: v2
|
|
job: gate
|
|
align-environment: "true"
|
|
|
|
- uses: step-security/taiki-e-install-action@76747d22a7567cc4438546a84f11bdf18e670ab8 # v2.87.32
|
|
with:
|
|
tool: cargo-nextest@0.9.150
|
|
|
|
- name: Test without heif
|
|
run: cargo nextest run -p photocraft-io --locked --profile ci
|
|
|
|
corpus:
|
|
if: github.event.action != 'labeled' || github.event.label.name == 'full-ci'
|
|
timeout-minutes: 30
|
|
# 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
|
|
# restore and a download; a missing corpus fails the tests. The cache key changes only when a
|
|
# pin or manifest does, so normally this restores in seconds (fork PRs read the base cache).
|
|
name: corpus tests
|
|
runs-on: ubuntu-latest
|
|
env:
|
|
# test-corpus builds with --release, but here without the release profile's thin LTO and
|
|
# single codegen unit: they ran LTO over the dependency graph for each of the ~95 corpus test
|
|
# binaries, so building took 23.5 of the job's 37 minutes while the tests ran for 1.5.
|
|
# Turning them off builds 2.7x faster; the code under test is the same.
|
|
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:
|
|
persist-credentials: false
|
|
- uses: step-security/dtolnay-rust-toolchain@8dd607977d06adf4ed49b190381e74c17a9dd25f # v1.0.0
|
|
with:
|
|
toolchain: stable
|
|
- uses: Swatinem/rust-cache@d1527c8f67ef9af357290475d4af4b0fab8f12e0 # v2.9.3
|
|
with:
|
|
prefix-key: v1-rust
|
|
key: corpus
|
|
save-if: ${{ github.ref == 'refs/heads/main' }}
|
|
cache-on-failure: true
|
|
- name: Restore test corpora
|
|
uses: actions/cache@55cc8345863c7cc4c66a329aec7e433d2d1c52a9 # v6.1.0
|
|
with:
|
|
path: corpus/
|
|
key: corpus-${{ hashFiles('xtask/src/corpus_pins.rs', 'xtask/*.sha256') }}
|
|
- name: Fetch and verify corpora
|
|
run: cargo xtask corpus --all
|
|
- name: Corpus tests
|
|
run: cargo xtask test-corpus
|
|
|
|
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: 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
|
|
|
|
- uses: step-security/dtolnay-rust-toolchain@8dd607977d06adf4ed49b190381e74c17a9dd25f # v1.0.0
|
|
with:
|
|
toolchain: stable
|
|
targets: wasm32-unknown-unknown
|
|
- 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
|
|
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: ubuntu-latest
|
|
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: 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
|
|
- uses: step-security/dtolnay-rust-toolchain@8dd607977d06adf4ed49b190381e74c17a9dd25f # v1.0.0
|
|
with:
|
|
toolchain: stable
|
|
- name: Compare exact outputs and release timings on 24 MP
|
|
run: |
|
|
set -o pipefail
|
|
cargo test --release -p photocraft-engine --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: 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
|
|
- uses: step-security/dtolnay-rust-toolchain@8dd607977d06adf4ed49b190381e74c17a9dd25f # v1.0.0
|
|
with:
|
|
toolchain: stable
|
|
- 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 --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
|
|
- uses: step-security/dtolnay-rust-toolchain@8dd607977d06adf4ed49b190381e74c17a9dd25f # v1.0.0
|
|
with:
|
|
toolchain: stable
|
|
# 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
|
|
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: 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
|
|
- uses: step-security/dtolnay-rust-toolchain@8dd607977d06adf4ed49b190381e74c17a9dd25f # v1.0.0
|
|
with:
|
|
toolchain: stable
|
|
- 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: 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
|
|
- uses: step-security/dtolnay-rust-toolchain@8dd607977d06adf4ed49b190381e74c17a9dd25f # v1.0.0
|
|
with:
|
|
toolchain: stable
|
|
- 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: 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"
|
|
- uses: step-security/dtolnay-rust-toolchain@8dd607977d06adf4ed49b190381e74c17a9dd25f # v1.0.0
|
|
with:
|
|
toolchain: stable
|
|
- 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
|