mirror of
https://github.com/storytold/vectorcraft.git
synced 2026-10-14 19:26:56 -04:00
105 lines
4.6 KiB
YAML
105 lines
4.6 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.
|
|
# The `package` job checks packaging/freebsd/package.sh (the release job runs it for real).
|
|
name: FreeBSD
|
|
|
|
on:
|
|
push:
|
|
branches: [main]
|
|
pull_request:
|
|
paths:
|
|
- Cargo.toml
|
|
- Cargo.lock
|
|
- "**/Cargo.toml"
|
|
- .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:
|
|
name: FreeBSD 14 (build + test)
|
|
runs-on: ubuntu-latest
|
|
timeout-minutes: 300
|
|
steps:
|
|
- uses: actions/checkout@v7
|
|
# The optional craft-fonts build input (Japanese fonts), so the tests that need it run here
|
|
# rather than skip. Pinned; bump deliberately (craftrules standards/fonts.md).
|
|
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
|
|
with:
|
|
repository: storytold/craft-fonts
|
|
ref: abb83316d96aa59c1cf64784289e378fe9fa5695
|
|
path: craft-fonts
|
|
- name: Build and test in a FreeBSD VM
|
|
uses: vmactions/freebsd-vm@c46abacb49f09938ca4e1702d15d836285d694cc # v1
|
|
with:
|
|
release: "14.3"
|
|
usesh: true
|
|
cpu: 4
|
|
mem: 12288
|
|
# Nothing to bring back; copying the target dir out of the VM fails on large builds.
|
|
copyback: false
|
|
prepare: |
|
|
pkg install -y git curl pkgconf cmake python3 libxkbcommon wayland libX11 libXcursor libXrandr libXi libxcb mesa-libs vulkan-loader gtk3 fontconfig freetype2 alsa-lib
|
|
curl -fsSL https://sh.rustup.rs | sh -s -- -y --profile minimal
|
|
run: |
|
|
. "$HOME/.cargo/env"
|
|
# The checkout is synced in under another owner; let tests that call git read it.
|
|
git config --global --add safe.directory "*"
|
|
rustc --version
|
|
# The checkout above is synced into the VM with the workspace.
|
|
export CRAFT_FONTS_DIR="$PWD/craft-fonts" CRAFT_FONTS_REQUIRED=1
|
|
CARGO_PROFILE_DEV_DEBUG=0 cargo build --workspace --all-targets --locked
|
|
CARGO_PROFILE_DEV_DEBUG=0 cargo test --workspace --locked
|
|
|
|
package:
|
|
name: FreeBSD 14 (package)
|
|
# The release build takes a while: only for PRs that touch FreeBSD packaging (or dependencies)
|
|
# and on demand, not on every push to main.
|
|
if: github.event_name != 'push'
|
|
runs-on: ubuntu-latest
|
|
timeout-minutes: 150
|
|
steps:
|
|
- uses: actions/checkout@v7
|
|
# Japanese UI/document fonts, embedded by crates/text/build.rs (CRAFT_FONTS_DIR in the VM).
|
|
# Bump the commit deliberately; see craftrules standards/fonts.md.
|
|
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
|
|
with:
|
|
repository: storytold/craft-fonts
|
|
ref: abb83316d96aa59c1cf64784289e378fe9fa5695
|
|
path: craft-fonts
|
|
- name: Package in a FreeBSD VM
|
|
uses: vmactions/freebsd-vm@c46abacb49f09938ca4e1702d15d836285d694cc
|
|
with:
|
|
release: "14.3"
|
|
usesh: true
|
|
mem: 12288
|
|
prepare: |
|
|
pkg install -y bash curl git pkgconf cmake python3 libxkbcommon wayland libX11 libXcursor libXrandr libXi libxcb mesa-libs vulkan-loader gtk3 fontconfig freetype2 alsa-lib
|
|
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y --profile minimal --default-toolchain stable
|
|
run: |
|
|
. "$HOME/.cargo/env"
|
|
git config --global --add safe.directory "$PWD"
|
|
# Build outside the checkout so only dist/ is copied back out of the VM.
|
|
# The craft-fonts checkout is synced into the VM with the workspace.
|
|
export CRAFT_FONTS_DIR="$PWD/craft-fonts" CRAFT_FONTS_REQUIRED=1
|
|
export CARGO_TARGET_DIR=/var/tmp/vectorcraft-target CARGO_BUILD_JOBS=4
|
|
bash packaging/freebsd/package.sh
|
|
# Every part the package must have, the craft-fonts licences included.
|
|
tar -tzf dist/release/vectorcraft-*-freebsd-x86_64.tar.gz >/var/tmp/contents.txt
|
|
for want in '/bin/vectorcraft$' '/bin/vectorcraft-cli$' '/share/applications/.*\.desktop$' '/share/icons/hicolor/' '/share/doc/vectorcraft/NOTICE$' '/share/doc/vectorcraft/OFL-.*\.txt$'; do
|
|
grep -Eq "$want" /var/tmp/contents.txt || { echo "missing from the package: $want"; exit 1; }
|
|
done
|
|
- uses: actions/upload-artifact@v7
|
|
with:
|
|
name: freebsd-package
|
|
path: dist/release/*
|
|
if-no-files-found: error
|