stahl/.github/workflows/ci.yml
Markus Zoppelt 06b4b70be0 Merge the new look, Counsel, records, intake, matters and the hardening (#82-#92)
Lands the rest of the stacked PRs in one merge, as the switch to trunk-based development:
#82-#87 (stack PRs 4-9), #88-#90 (specs 001-003), #91 (the page centred on wide windows) and
#92 (AI features off until turned on), with the fixes made since: Nix vendoring and test files,
calendar- and environment-proof tests, the secret checks, Developer ID signing and notarization
of the macOS release, and TestFlight on every push to main.

Checked by gate.sh (secret scan, cargo, nix flake check, nix build, iOS simulator build, every
scene rendered) and the owner's manual pass on Linux.
2026-11-14 16:47:16 +01:00

160 lines
4.9 KiB
YAML

name: CI
on:
push:
branches: [main]
pull_request:
workflow_dispatch:
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:
secrets:
name: no secrets in the repo
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v7
with:
fetch-depth: 0
- uses: cachix/install-nix-action@v31
with:
github_access_token: ${{ secrets.GITHUB_TOKEN }}
- name: gitleaks (the whole history)
run: nix run nixpkgs#gitleaks -- git --no-banner --redact --exit-code 1 .
- name: no signing files tracked
run: |
if git ls-files | grep -iE '\.(p8|p12|pfx|pem|key|cer|mobileprovision|provisionprofile|keychain(-db)?)$|AuthKey_'; then
echo "signing material is tracked; remove it and rotate it"; exit 1
fi
nix:
name: nix flake check (${{ matrix.system }})
strategy:
fail-fast: false
matrix:
include:
- os: ubuntu-latest
system: x86_64-linux
- os: macos-latest
system: aarch64-darwin
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v7
- uses: cachix/install-nix-action@v31
with:
github_access_token: ${{ secrets.GITHUB_TOKEN }}
extra_nix_config: |
accept-flake-config = true
- name: nix fmt --check
run: nix fmt -- --check .
- name: nix flake check
run: nix flake check -L
- name: nix build (release)
run: nix build .#stahl -L
- name: smoke-test the built binary
run: file result/bin/stahl
# Without Nix, as a contributor or the release build sees each platform. Nix can't build for
# Windows, so this is its only coverage.
cargo:
name: cargo (${{ matrix.os }})
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, macos-latest, windows-latest]
runs-on: ${{ matrix.os }}
defaults:
run:
shell: bash
steps:
- uses: actions/checkout@v7
- name: install Linux system dependencies
if: runner.os == 'Linux'
run: |
sudo apt-get update
# To build, then a software Vulkan driver and a display to run on.
sudo apt-get install -y libxkbcommon-dev libwayland-dev \
libxkbcommon-x11-0 mesa-vulkan-drivers xvfb x11-apps x11-utils imagemagick
# rustup reads the version from rust-toolchain.toml.
- name: install the Rust toolchain
run: rustup show active-toolchain || rustup toolchain install
- uses: Swatinem/rust-cache@v2
with:
# Saving this cache takes Windows longer than building. PRs restore main's.
save-if: ${{ runner.os != 'Windows' || github.ref == 'refs/heads/main' }}
- name: clippy
run: cargo clippy --all-targets -- --deny warnings
- name: unit and end-to-end tests
run: cargo test --no-fail-fast
- name: build the demo and the app
run: cargo build --bins --example demo
- name: render with the real renderer
run: |
mkdir -p renders
scenes=$(target/debug/examples/demo --list-scenes)
# Windows runners have a software GPU, at over a minute a scene.
if [ "$RUNNER_OS" = Windows ]; then
scenes="overview holding-details palette welcome"
fi
for scene in $scenes; do
target/debug/examples/demo --snap "renders/$scene.png" --scene "$scene" \
--at 2 --size 1320x860 --scale 1
test -s "renders/$scene.png"
done
- uses: actions/upload-artifact@v7
if: always()
with:
name: renders-${{ matrix.os }}
path: renders
if-no-files-found: warn
- name: open a real window, and stay up
run: |
mkdir -p window
if [ "$RUNNER_OS" = Linux ]; then
Xvfb :99 -screen 0 1440x960x24 > xvfb.log 2>&1 &
export DISPLAY=:99
# Wait until Xvfb takes connections, or the window races it.
for _ in $(seq 1 30); do
xdpyinfo -display :99 > /dev/null 2>&1 && break
sleep 1
done
xdpyinfo -display :99 > /dev/null || { cat xvfb.log; exit 1; }
fi
target/debug/examples/demo > window.log 2>&1 &
app=$!
sleep 15
cat window.log
# A photograph is a bonus: not every runner lets us take one.
case "$RUNNER_OS" in
Linux) xwd -root -display :99 -silent | convert xwd:- window/linux.png || true ;;
macOS) screencapture -x window/macos.png || true ;;
Windows) powershell -File .github/workflows/screenshot.ps1 window/windows.png || true ;;
esac
kill -0 "$app"
kill "$app"
- uses: actions/upload-artifact@v7
if: always()
with:
name: window-${{ matrix.os }}
path: window
if-no-files-found: warn