Skip to content

Commit 942a86c

Browse files
authored
ci: aggregate check workflow (#290)
## What changed - Added generated `checks.x86_64-linux.all`, built from the flake's check attrset, so CI has one source-of-truth target for the full check surface. - Kept per-case site checks covered through a `site-case-tests` aggregate without exposing each case as a top-level flake check. - Replaced the workflow's direct `nix flake check -L` build path with `nix build -L .#checks.x86_64-linux.all` followed by `nix flake check -L --no-build` in the same runner. - Kept the final `flake-check` job so existing branch protection can continue to require one stable check name. ## Why The previous single `nix flake check -L` job hid which check family was slow and forced dynamic check discovery through site test cases and Rust package tests before CI could start building useful work. The new shape materializes the generated aggregate check first, then runs flake schema/type validation without rebuilding everything through the flake frontend. ## Validation - `nix run .#lint` - `nix eval --accept-flake-config --json .#checks.x86_64-linux --apply builtins.attrNames` - `nix eval --accept-flake-config --raw .#checks.x86_64-linux.all.name` - `git diff --check` - YAML parse for `.github/workflows/check.yml`
1 parent 8ad6a94 commit 942a86c

2 files changed

Lines changed: 67 additions & 33 deletions

File tree

.github/workflows/check.yml

Lines changed: 21 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,8 @@ concurrency:
1818
cancel-in-progress: ${{ github.event_name == 'pull_request' }}
1919

2020
jobs:
21-
flake-check:
21+
check-group:
22+
name: check / all checks and schema
2223
runs-on: ubuntu-latest
2324
steps:
2425
- name: Checkout repository
@@ -50,5 +51,22 @@ jobs:
5051
name: indexable-inc
5152
authToken: ${{ secrets.CACHIX_AUTH_TOKEN }}
5253

53-
- name: nix flake check
54-
run: nix flake check -L
54+
- name: Run checks and schema
55+
run: |
56+
nix build -L .#checks.x86_64-linux.all
57+
nix flake check -L --no-build
58+
59+
flake-check:
60+
needs:
61+
- check-group
62+
if: always()
63+
runs-on: ubuntu-latest
64+
steps:
65+
- name: Require all check groups
66+
env:
67+
CHECK_GROUP_RESULT: ${{ needs.check-group.result }}
68+
run: |
69+
if [ "${CHECK_GROUP_RESULT}" != "success" ]; then
70+
echo "::error::One or more check groups failed (${CHECK_GROUP_RESULT})."
71+
exit 1
72+
fi

lib/per-system.nix

Lines changed: 46 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -341,38 +341,54 @@ in
341341
// healthChecks.lifecyclePackages;
342342

343343
checks = lib.optionalAttrs (system == ix.system) (
344-
{
345-
inherit (tests) eval;
346-
agents-md = pkgs.runCommand "agents-md-check" { nativeBuildInputs = [ agentsMd ]; } ''
347-
agents-md --check ${paths.root}
348-
mkdir -p "$out"
349-
'';
350-
cargo-unit-real-workspaces = tests.cargoUnitRealWorkspaces;
351-
# Offline schema gate for the loader manifests. `deepSeq` forces
352-
# every Paper / Velocity / Fabric per-version lock through
353-
# `readLoaderManifest` in `lib/artifacts.nix`, so malformed JSON or a
354-
# missing key fires here before any image starts evaluating. The
355-
# forced surface is the parsed-and-validated manifest data, not the
356-
# wrapped `fetchurl` derivations, to keep this check pure eval.
357-
loader-manifests =
358-
let
359-
forced = builtins.deepSeq ix.artifacts.minecraft.loaderManifests "ok";
360-
in
361-
pkgs.runCommand "loader-manifests-check" { } ''
362-
printf '%s\n' '${forced}' > "$out"
344+
let
345+
rustChecks = {
346+
cargo-unit-real-workspaces = tests.cargoUnitRealWorkspaces;
347+
}
348+
// rustPackageTests;
349+
350+
checkAttrs = {
351+
inherit (tests) eval;
352+
agents-md = pkgs.runCommand "agents-md-check" { nativeBuildInputs = [ agentsMd ]; } ''
353+
agents-md --check ${paths.root}
354+
mkdir -p "$out"
355+
'';
356+
# Offline schema gate for the loader manifests. `deepSeq` forces
357+
# every Paper / Velocity / Fabric per-version lock through
358+
# `readLoaderManifest` in `lib/artifacts.nix`, so malformed JSON or a
359+
# missing key fires here before any image starts evaluating. The
360+
# forced surface is the parsed-and-validated manifest data, not the
361+
# wrapped `fetchurl` derivations, to keep this check pure eval.
362+
loader-manifests =
363+
let
364+
forced = builtins.deepSeq ix.artifacts.minecraft.loaderManifests "ok";
365+
in
366+
pkgs.runCommand "loader-manifests-check" { } ''
367+
printf '%s\n' '${forced}' > "$out"
368+
'';
369+
run-records-session = repoPackages.run.passthru.tests.recordsSession;
370+
lint = pkgs.runCommand "ix-images-lint" { nativeBuildInputs = [ pkgs.coreutils ]; } ''
371+
cp -R ${lintSource} source
372+
chmod -R u+w source
373+
cd source
374+
${lib.getExe lint}
375+
mkdir -p "$out"
363376
'';
364-
run-records-session = repoPackages.run.passthru.tests.recordsSession;
365-
lint = pkgs.runCommand "ix-images-lint" { nativeBuildInputs = [ pkgs.coreutils ]; } ''
366-
cp -R ${lintSource} source
367-
chmod -R u+w source
368-
cd source
369-
${lib.getExe lint}
370-
mkdir -p "$out"
371-
'';
372-
site-test = siteTests.all;
377+
rust-package-tests = pkgs.linkFarm "rust-package-tests" (
378+
lib.mapAttrsToList (name: path: { inherit name path; }) rustChecks
379+
);
380+
site-case-tests = pkgs.linkFarm "site-case-tests" (
381+
lib.mapAttrsToList (name: path: { inherit name path; }) siteTests.cases
382+
);
383+
site-test = siteTests.all;
384+
};
385+
in
386+
checkAttrs
387+
// {
388+
all = pkgs.linkFarm "ix-images-checks" (
389+
lib.mapAttrsToList (name: path: { inherit name path; }) checkAttrs
390+
);
373391
}
374-
// lib.mapAttrs' (caseId: drv: lib.nameValuePair "site-test-${caseId}" drv) siteTests.cases
375-
// rustPackageTests
376392
);
377393

378394
formatter = pkgs.nixfmt;

0 commit comments

Comments
 (0)