2023-10-29 23:52:33 +01:00
|
|
|
name: Flake checks
|
2023-11-10 19:10:22 +01:00
|
|
|
on: [pull_request]
|
2023-10-29 23:52:33 +01:00
|
|
|
|
|
|
|
jobs:
|
|
|
|
Check:
|
2024-05-29 17:45:23 +02:00
|
|
|
runs-on: self-hosted
|
2023-10-29 23:52:33 +01:00
|
|
|
steps:
|
2024-05-29 17:45:23 +02:00
|
|
|
- name: Check out repository code
|
|
|
|
uses: https://code.forgejo.org/actions/checkout@v4
|
2024-04-23 02:18:10 +02:00
|
|
|
|
2024-05-08 14:05:41 +02:00
|
|
|
- name: Check formatting
|
|
|
|
run: |
|
2024-10-24 14:49:15 +02:00
|
|
|
nix --accept-flake-config --access-tokens '' develop --command treefmt --ci
|
2024-05-08 14:05:41 +02:00
|
|
|
|
2023-10-29 23:52:33 +01:00
|
|
|
- name: Run flake checks
|
|
|
|
run: |
|
2024-05-14 23:22:09 +02:00
|
|
|
set -exuo pipefail
|
2024-04-23 16:00:16 +02:00
|
|
|
# Prevent cache garbage collection by creating GC roots
|
2024-05-30 16:29:32 +02:00
|
|
|
mkdir -p /var/lib/gitea-runner/tankstelle/.local/state/nix/results
|
|
|
|
|
2024-08-27 12:37:37 +02:00
|
|
|
for target in $(nix flake show --json --all-systems | jq --raw-output '
|
2024-04-23 12:03:16 +02:00
|
|
|
.["nixosConfigurations"] |
|
|
|
|
to_entries[] |
|
2024-08-27 12:37:37 +02:00
|
|
|
.key'
|
2024-04-23 12:03:16 +02:00
|
|
|
); do
|
2024-04-23 16:00:16 +02:00
|
|
|
nix --print-build-logs --verbose --accept-flake-config --access-tokens '' \
|
2024-05-30 16:29:32 +02:00
|
|
|
build --out-link /var/lib/gitea-runner/tankstelle/.local/state/nix/results/"$target" ".#nixosConfigurations.${target}.config.system.build.toplevel"
|
2024-04-23 12:03:16 +02:00
|
|
|
done
|
2024-04-23 16:32:11 +02:00
|
|
|
|
2024-08-27 12:37:37 +02:00
|
|
|
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
|