The flake pinned jian/casement as fixed github revs while the repo advances the same code as submodules, so every submodule bump that forgot the flake broke the whole workflow — most recently op-pen-loader failing to compile against a jian without the widget-style fields. The workflow now derives --override-input values from the checked-out submodule HEADs (with --no-write-lock-file), so it follows the gitlinks by construction, and the flake.nix default revs are refreshed to the current pins for local use.
122 lines
4.2 KiB
YAML
122 lines
4.2 KiB
YAML
name: Nix flake checks
|
|
|
|
on:
|
|
pull_request:
|
|
paths:
|
|
- "Cargo.toml"
|
|
- "Cargo.lock"
|
|
- "flake.nix"
|
|
- "flake.lock"
|
|
- "nix/release-manifest.json"
|
|
- "nix/integration/**"
|
|
- "crates/op-host-desktop/assets/icon.png"
|
|
- ".github/workflows/nix-check.yml"
|
|
push:
|
|
branches: ["**"]
|
|
paths:
|
|
- "Cargo.toml"
|
|
- "Cargo.lock"
|
|
- "flake.nix"
|
|
- "flake.lock"
|
|
- "nix/release-manifest.json"
|
|
- "nix/integration/**"
|
|
- "crates/op-host-desktop/assets/icon.png"
|
|
- ".github/workflows/nix-check.yml"
|
|
workflow_dispatch:
|
|
|
|
permissions:
|
|
contents: read
|
|
|
|
jobs:
|
|
flake:
|
|
name: Build and smoke-test prebuilt outputs
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- name: Check out repository
|
|
uses: actions/checkout@v4
|
|
with:
|
|
submodules: recursive
|
|
|
|
- name: Install Nix
|
|
uses: DeterminateSystems/nix-installer-action@ef8a148080ab6020fd15196c2084a2eea5ff2d25 # v22
|
|
|
|
- name: Enable Nix cache
|
|
uses: DeterminateSystems/magic-nix-cache-action@908b263ff629f4cc17666315b7fd3ec127c6244d # v14
|
|
|
|
# The flake pins its vendor inputs as github revs while the repository
|
|
# pins the same code as submodules; the two drift the moment a submodule
|
|
# bump forgets the flake (this broke the whole workflow when jian gained
|
|
# the widget-style fields). Deriving the overrides from the checked-out
|
|
# submodule HEADs makes the workflow follow the gitlinks by construction.
|
|
- name: Derive flake input overrides from the submodule pins
|
|
run: |
|
|
{
|
|
printf 'NIX_VENDOR_OVERRIDES=--no-write-lock-file'
|
|
printf ' --override-input jian github:ZSeven-W/jian/%s' \
|
|
"$(git -C vendor/jian rev-parse HEAD)"
|
|
printf ' --override-input casement github:ZSeven-W/casement/%s' \
|
|
"$(git -C vendor/casement rev-parse HEAD)"
|
|
printf ' --override-input agent github:ZSeven-W/agent-rs/%s' \
|
|
"$(git -C vendor/agent rev-parse HEAD)"
|
|
printf '\n'
|
|
} >> "$GITHUB_ENV"
|
|
|
|
- name: Evaluate flake checks
|
|
run: nix flake check --no-build --show-trace $NIX_VENDOR_OVERRIDES
|
|
|
|
- name: Build prebuilt packages
|
|
run: nix build .#prebuilt .#prebuilt-cli --no-link $NIX_VENDOR_OVERRIDES
|
|
|
|
- name: Build representative source outputs
|
|
run: |
|
|
nix build \
|
|
.#op-cli \
|
|
.#web-server \
|
|
.#web-bundle \
|
|
.#web-sdk-wasm \
|
|
.#web-sdk-packages \
|
|
.#appimage \
|
|
--no-link $NIX_VENDOR_OVERRIDES
|
|
|
|
- name: Verify generated integration sidecar
|
|
run: nix build .#checks.x86_64-linux.integration-sidecar --no-link $NIX_VENDOR_OVERRIDES
|
|
|
|
- name: Install headless display server
|
|
run: |
|
|
sudo apt-get update
|
|
sudo apt-get install --yes \
|
|
libegl1 libgles2 libgl1-mesa-dri libgbm1 mesa-utils xvfb
|
|
|
|
- name: Smoke-test prebuilt CLI
|
|
run: |
|
|
output="$(nix run .#prebuilt-cli $NIX_VENDOR_OVERRIDES -- --version)"
|
|
printf '%s\n' "$output"
|
|
printf '%s\n' "$output" | grep -Eq '^\{"version":"[0-9]+\.[0-9]+\.[0-9]+"\}$'
|
|
|
|
- name: Smoke-test prebuilt desktop
|
|
shell: bash
|
|
run: |
|
|
set +e
|
|
LIBGL_ALWAYS_SOFTWARE=1 \
|
|
MESA_LOADER_DRIVER_OVERRIDE=llvmpipe \
|
|
GALLIUM_DRIVER=llvmpipe \
|
|
timeout 20s xvfb-run -a -s "-screen 0 1280x720x24" nix run .#prebuilt $NIX_VENDOR_OVERRIDES \
|
|
>/tmp/openpencil-desktop.log 2>&1
|
|
status=$?
|
|
set -e
|
|
|
|
# A GUI process is expected to remain alive until timeout. Any other
|
|
# non-zero status means startup failed before the process was usable.
|
|
if [[ "$status" -ne 0 && "$status" -ne 124 ]]; then
|
|
cat /tmp/openpencil-desktop.log
|
|
exit "$status"
|
|
fi
|
|
if grep -Eq 'error while loading|cannot open shared object' \
|
|
/tmp/openpencil-desktop.log; then
|
|
cat /tmp/openpencil-desktop.log
|
|
exit 1
|
|
fi
|
|
|
|
- name: Run the clean NixOS runtime test
|
|
run: nix build .#checks.x86_64-linux.prebuilt-runtime --no-link $NIX_VENDOR_OVERRIDES
|