infra/.forgejo/workflows/check.yml
teutat3s 4309cc9cdd
All checks were successful
Flake checks / Check (pull_request) Successful in 2m7s
ci: use treefmt2 with flag --ci
Update treefmt to version 2.

This adds the following flags for CI usage:
"--no-cache, --fail-on-change and adjusting some other settings best suited to a CI".
See: https://treefmt.com/usage
2024-10-24 15:43:00 +02:00

38 lines
1.4 KiB
YAML

name: Flake checks
on: [pull_request]
jobs:
Check:
runs-on: self-hosted
steps:
- name: Check out repository code
uses: https://code.forgejo.org/actions/checkout@v4
- name: Check formatting
run: |
nix --accept-flake-config --access-tokens '' develop --command treefmt --ci
- name: Run flake checks
run: |
set -exuo pipefail
# Prevent cache garbage collection by creating GC roots
mkdir -p /var/lib/gitea-runner/tankstelle/.local/state/nix/results
for target in $(nix flake show --json --all-systems | jq --raw-output '
.["nixosConfigurations"] |
to_entries[] |
.key'
); do
nix --print-build-logs --verbose --accept-flake-config --access-tokens '' \
build --out-link /var/lib/gitea-runner/tankstelle/.local/state/nix/results/"$target" ".#nixosConfigurations.${target}.config.system.build.toplevel"
done
for check in $(nix flake show --json --all-systems | jq --raw-output '
.checks."x86_64-linux" |
to_entries[] |
.key'
); do
nix --print-build-logs --verbose --accept-flake-config --access-tokens '' \
build --out-link /var/lib/gitea-runner/tankstelle/.local/state/nix/results/"$check" ".#checks.x86_64-linux.${check}"
done