Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/money-with-wings' into cfgif-money
Browse files Browse the repository at this point in the history
  • Loading branch information
grahamc committed Jul 23, 2024
2 parents 37d451a + c1c2792 commit 3bcebd5
Show file tree
Hide file tree
Showing 3 changed files with 99 additions and 9 deletions.
35 changes: 35 additions & 0 deletions .github/workflows/matrix.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
#!/bin/sh

nix flake show --json --all-systems \
| nix run nixpkgs#gron -- -j \
| nix run nixpkgs#jq -- -r \
--slurp \
--argjson map '
{
"aarch64-darwin": "macos-latest",
"x86_64-darwin": "macos-latest",
"x86_64-linux": "UbuntuLatest32Cores128G",
"aarch64-linux": "UbuntuLatest32Cores128GArm",
"i686-linux": "UbuntuLatest32Cores128G"
}
' \
'
map(select(.[0][-1] == "type" and .[1] == "derivation")
| .[0][0:-1] # Take each attribute name and drop `type`
| select(.[0:3] != ["hydraJobs", "vm-test", "all"]) # Skip the hydraJobs.vm-test.all jobs, which aggregate other jobs
| select(.[0:3] != ["hydraJobs", "container-test", "all"]) # Skip the hydraJobs.container-test.all jobs, which aggregate other jobs
| select(.[-1] != "all") # Skip attributes which are `all` jobs, presumably combining other jobs
| select(.[-1] | endswith("-aggregate") != true) # Skip attributes which end in `-aggregate`, because those just depend on other jobs which build them
| select(.[0] == "hydraJobs") # Select the hydraJobs which are not typically run in CI
| {
attribute: . | join("."),
"nix-system": .[-2],
"runs-on": $map[.[-2]]
}
| if ."runs-on" == null then
("No GitHub Actions Runner system known for the Nix system `" + ."nix-system" + "` on attribute `" + .attribute + "`.\n") | halt_error(1)
else
.
end)
| "matrix=" + tostring
' >> "$GITHUB_OUTPUT"
55 changes: 55 additions & 0 deletions .github/workflows/money-with-wings.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
name: Extensive Release Checks

on:
workflow_dispatch:
push:
branches:
- money-with-wings

jobs:
inventory:
name: Identify outputs to build
runs-on: UbuntuLatest32Cores128G
outputs:
matrix: ${{ steps.inventory.outputs.matrix }}
permissions:
id-token: "write"
contents: "read"
steps:
- uses: actions/checkout@v4
- uses: DeterminateSystems/nix-installer-action@main
with:
flakehub: true
- uses: DeterminateSystems/magic-nix-cache-action@main
- name: Enumerate Checks
id: inventory
run: |
./.github/workflows/matrix.sh
build:
runs-on: ${{ matrix.jobs.runs-on }}
needs: inventory
strategy:
fail-fast: false
matrix:
jobs: ${{ fromJSON(needs.inventory.outputs.matrix) }}

permissions:
id-token: "write"
contents: "read"

steps:
- uses: actions/checkout@v4
- uses: DeterminateSystems/nix-installer-action@main
with:
flakehub: true
- uses: DeterminateSystems/magic-nix-cache-action@main
- name: Build for ${{ matrix.jobs.nix-system }}
run: nix build .#${{ matrix.jobs.attribute }}

success:
runs-on: ubuntu-latest
needs: build

steps:
- run: "true"
18 changes: 9 additions & 9 deletions nix/tests/vm-test/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -600,15 +600,15 @@ let
touch $out
'';

makeTests = name: tests: builtins.mapAttrs
makeTests = name: tests: imagePredicate: builtins.mapAttrs
(imageName: image:
rec {
${image.system} = (builtins.mapAttrs
(testName: test:
makeTest imageName testName test
)
tests) // {
"${name}" = (with (forSystem "x86_64-linux" ({ system, pkgs, ... }: pkgs)); pkgs.releaseTools.aggregate {
"${name}-aggregate" = (with (forSystem "x86_64-linux" ({ system, pkgs, ... }: pkgs)); pkgs.releaseTools.aggregate {
name = name;
constituents = (
pkgs.lib.mapAttrsToList
Expand All @@ -621,17 +621,17 @@ let
};
}
)
images;
(lib.filterAttrs imagePredicate images);

allCases = lib.recursiveUpdate (lib.recursiveUpdate installCases (lib.recursiveUpdate cureSelfCases cureScriptCases)) uninstallCases;

install-tests = makeTests "install" installCases;
install-tests = makeTests "install" installCases (_: _: true);

cure-self-tests = makeTests "cure-self" cureSelfCases;
cure-self-tests = makeTests "cure-self" cureSelfCases (_: _: true);

cure-script-tests = makeTests "cure-script" cureScriptCases;
cure-script-tests = makeTests "cure-script" cureScriptCases (_name: { upstreamScriptsWork ? true, ... }: upstreamScriptsWork);

uninstall-tests = makeTests "uninstall" uninstallCases;
uninstall-tests = makeTests "uninstall" uninstallCases (_: _: true);

all-tests = builtins.mapAttrs
(imageName: image: {
Expand All @@ -652,8 +652,8 @@ in
lib.recursiveUpdate joined-tests {
all."x86_64-linux" = (with (forSystem "x86_64-linux" ({ system, pkgs, ... }: pkgs)); pkgs.lib.mapAttrs (caseName: case:
pkgs.releaseTools.aggregate {
name = caseName;
constituents = pkgs.lib.mapAttrsToList (name: value: value."x86_64-linux"."${caseName}") joined-tests;
name = "${caseName}-aggregate";
constituents = pkgs.lib.mapAttrsToList (name: value: value."x86_64-linux"."${caseName}-aggregate") joined-tests;
}
)) (allCases // { "cure-self" = { }; "cure-script" = { }; "install" = { }; "uninstall" = { }; "all" = { }; });
}

0 comments on commit 3bcebd5

Please sign in to comment.