treewide: rework CI, allow skipping some hosts
some of the hosts aren't actually deployed that often, while building their configuration is long (eg. kernel rebuilds).
This commit is contained in:
parent
5bf73fc5a2
commit
0320d68273
7 changed files with 23 additions and 10 deletions
18
.ci.sh
18
.ci.sh
|
@ -14,10 +14,14 @@ set -x
|
|||
while read hostOutput; do
|
||||
echo "${hostOutput}"
|
||||
nixos-rebuild build --verbose --flake ".#${hostOutput}"
|
||||
done < <(nix eval -I nixpkgs=$(nix flake metadata nixpkgs --json | jq -r .path) --raw --impure --expr '
|
||||
with import <nixpkgs> { };
|
||||
(lib.strings.concatStringsSep "\n"
|
||||
(lib.mapAttrsToList (n: v: n)
|
||||
(lib.attrsets.filterAttrs (n: v: v.pkgs.system == pkgs.system)
|
||||
(builtins.getFlake(builtins.toString ./.)).outputs.nixosConfigurations)))
|
||||
'; echo "")
|
||||
done < <(nix eval --raw --impure --expr '
|
||||
let
|
||||
hosts = (import ./meta.nix).hosts;
|
||||
filterHosts = hosts: (
|
||||
builtins.filter (h: !hosts.${h}.ciSkip && hosts.${h}.system == builtins.currentSystem)
|
||||
(builtins.attrNames hosts)
|
||||
);
|
||||
in
|
||||
builtins.concatStringsSep "\n" (filterHosts hosts)
|
||||
'; echo ""
|
||||
)
|
||||
|
|
8
.github/workflows/ci.yml
vendored
8
.github/workflows/ci.yml
vendored
|
@ -20,9 +20,13 @@ jobs:
|
|||
echo -n "matrix="
|
||||
nix eval --raw --impure --expr '
|
||||
let
|
||||
f = configs: builtins.groupBy (n: configs.${n}.pkgs.system) (builtins.attrNames configs);
|
||||
groupHosts = hosts:
|
||||
builtins.groupBy (n: hosts.${n}.system)
|
||||
(builtins.filter (h: !hosts.${h}.ciSkip)
|
||||
(builtins.attrNames hosts));
|
||||
hosts = (import ./meta.nix).hosts;
|
||||
in
|
||||
builtins.toJSON (f (builtins.getFlake(builtins.toString ./.)).outputs.nixosConfigurations)'
|
||||
builtins.toJSON (groupHosts hosts)'
|
||||
echo ""
|
||||
} >> "$GITHUB_OUTPUT"
|
||||
|
||||
|
|
1
meta.nix
1
meta.nix
|
@ -10,6 +10,7 @@ in {
|
|||
hosts = builtins.mapAttrs (name: value:
|
||||
{
|
||||
targetHost = name + "." + defaultDomain;
|
||||
ciSkip = false;
|
||||
}
|
||||
// builtins.fromJSON (builtins.readFile (./nixos/. + "/${name}/meta.json")))
|
||||
(builtins.readDir ./nixos);
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
{
|
||||
"publicKey": "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIKb4i+BmIb2wiT4y5uWsCOmSo1dRp6Ql36toUsRHN6pC",
|
||||
"ciSkip": true,
|
||||
"system": "aarch64-linux"
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
{
|
||||
"publicKey": "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIE4rFVYs5t4uBpZK9kmDQkr9ONLDE41jOCP/tMmM+SMb",
|
||||
"ciSkip": true,
|
||||
"system": "x86_64-linux"
|
||||
}
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
{
|
||||
"publicKey": "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIKb4i+BmIb2wiT4y5uWsCOmSo1dRp6Ql36toUsRHN6pC",
|
||||
"ciSkip": true,
|
||||
"system": "aarch64-linux"
|
||||
}
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
{
|
||||
"publicKey": "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIAs/jPJBvAVB+BgkywNDSUqcuqzFaWTmBn5hTnKm1wjF",
|
||||
"ciSkip": true,
|
||||
"system": "x86_64-linux"
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue