Files
photocraft/.github/workflows/freebsd.yml
FredApps 01b79958a7 ci(freebsd): build every target with the test profile so ui-egui's tests fit the VM (#15360)
* ci(freebsd): build with two cargo jobs so the aarch64 cross build fits the VM

The nightly aarch64 leg (a cold cross build of every target in the shared workflow's 12 GB
FreeBSD guest, CARGO_BUILD_JOBS=4) was killed with exit 137 twenty minutes into ui-egui's
targets, while photocraft-web compiled alongside them (run 43936108201). The same cold build
passed on 15 Nov, so it is at the edge of the guest's memory.

Pass `--jobs 2` through the existing cargo-build-extra-args input. It applies to the build step
of both legs; the x86_64 test commands keep the shared four jobs.

* ci(freebsd): build with the test profile, not two jobs

Two jobs didn't fix it: the x86_64 leg of the dispatched run was SIGKILLed the same way at
--jobs 2 (run 43963415772). The killed rustc was ui-egui's lib test target at -C opt-level=1:
`cargo build --all-targets` builds test targets with the dev profile, so Cargo.toml's
`[profile.test.package.photocraft-ui-egui] opt-level = 0` never applied to the build step. That
one optimised rustc over about 390k lines and 7700 tests ran the 12 GB guest out of memory, and
`cargo test` then rebuilt the same target at opt-level 0 (1m47s on x86_64) anyway.

Pass `--profile test` instead, so the build compiles every target as the tests do: ui-egui at
opt-level 0, debuginfo still off through CARGO_PROFILE_DEV_DEBUG=0 (test inherits dev), and the
test commands reuse the build's artifacts.

* ci(freebsd): test ui-egui with the build's package selection

`cargo test -p photocraft-ui-egui` resolves dependency features without the
other workspace members, so egui, epaint and everything above them got new
hashes. The test step then rebuilt ui-egui's lib tests instead of reusing
the build step's, and that rustc was SIGKILLed in the 12 GB guest.

Run ui-egui's lib, doc and integration tests through
`--workspace --features heif --exclude photocraft-gpu`, which resolves the
same units as the build (checked with cargo's unit graph: 0 units missing
from the build, against 146 for `-p photocraft-ui-egui --lib`). The
integration tests share one command, so all of them run one at a time.
2026-11-17 05:28:19 +01:00

53 lines
3.0 KiB
YAML

# Builds and tests the workspace on FreeBSD, inside a FreeBSD VM on a Linux runner
# (GitHub has no FreeBSD runners). GPU tests skip themselves when the VM has no adapter.
# It then runs packaging/freebsd/package.sh, the script the release job runs, and checks the
# tarball, so a broken FreeBSD package fails here before it can fail a release. Nothing is
# uploaded and no secrets are used.
name: FreeBSD
# The VM build takes one to several hours, so it runs nightly on main rather than on every push
# or dependency change: a drifted dependency still shows up within a day. PRs that change the
# FreeBSD packaging itself still run it.
on:
push:
branches: [release]
schedule:
- cron: "17 2 * * *"
pull_request:
paths:
- .github/workflows/freebsd.yml
- packaging/freebsd/**
- packaging/env.sh
workflow_dispatch:
concurrency:
group: freebsd-${{ github.ref }}
cancel-in-progress: true
permissions:
contents: read
jobs:
freebsd:
# Intentionally tracked at @main (not SHA-pinned) so org-wide CI improvements, security fixes, and build optimizations propagate without PR churn across all craftapp repos.
uses: storytold/craft-common-actions/.github/workflows/freebsd.yml@main
with:
craft-fonts-ref: b076417b5880bd4154bd22f00695b1d28c6bea83
# Build every target with the profile the tests use. Plain `cargo build --all-targets` builds
# test targets with the dev profile, so ui-egui's lib tests (about 390k lines, 7700 tests)
# were compiled at opt-level 1 rather than Cargo.toml's test-profile opt-level 0, and that
# rustc ran the 12 GB guest out of memory (SIGKILL, nightly and dispatched runs on both
# legs).
cargo-build-extra-args: "--features heif --profile test"
# The test commands reuse that build only if they resolve the same features. `-p
# photocraft-ui-egui` (or `--exclude photocraft-ui-egui`) leaves out the other members'
# feature requests, so egui, epaint and the crates above them got new hashes and the test
# step rebuilt ui-egui's lib tests, where that rustc was SIGKILLed again. So ui-egui is
# tested with the build's selection, `--workspace --features heif`. Excluding
# photocraft-gpu leaves the resolution unchanged; its own command rebuilds only its graph.
# The VM's software Vulkan driver crashes (SIGSEGV) when several tests set up a device at
# once, so photocraft-gpu's tests and the integration tests (ui-egui's among them; one
# command runs them all) run one at a time.
custom-test-command: "CARGO_PROFILE_DEV_DEBUG=0 cargo test --workspace --locked --features heif --exclude photocraft-gpu --lib --bins && CARGO_PROFILE_DEV_DEBUG=0 cargo test --workspace --locked --features heif --exclude photocraft-gpu --doc && CARGO_PROFILE_DEV_DEBUG=0 cargo test --workspace --locked --features heif --exclude photocraft-gpu --test '*' -- --test-threads=1 && CARGO_PROFILE_DEV_DEBUG=0 cargo test -p photocraft-gpu --locked -- --test-threads=1"
run-package-check: true