infrastructure/workflows/eval-nodes.nix

59 lines
1.3 KiB
Nix

# SPDX-FileCopyrightText: 2024 Tom Hubrecht <tom.hubrecht@dgnum.eu>
#
# SPDX-License-Identifier: EUPL-1.2
{ lib, nix-actions }:
let
inherit (lib) attrNames genAttrs;
nodes = attrNames (import ../meta lib).nodes;
in
{
name = "Build all the nodes";
on = {
pull_request.branches = [ "main" ];
push.branches = [ "main" ];
};
jobs = genAttrs nodes (node: {
runs-on = "nix-infra";
steps = [
{ uses = "actions/checkout@v3"; }
{
name = "Eval ${node}";
run = nix-actions.lib.nix-shell {
script = ''
DRV=$(instantiate-node)
echo "DRV=$DRV" >> $GITHUB_ENV
'';
shell = "eval-nodes";
};
env.BUILD_NODE = node;
}
{
name = "Build ${node}";
run = # bash
''
STORE_PATH="$(nix-store --realise "$DRV")"
echo "STORE_PATH=$STORE_PATH" >> $GITHUB_ENV
'';
}
{
name = "Cache ${node}";
run = nix-actions.lib.nix-shell {
script = ''
push-to-cache "$STORE_PATH"
'';
shell = "eval-nodes";
};
env = {
STORE_ENDPOINT = "https://snix-store.dgnum.eu/infra.signing/";
STORE_USER = "admin";
STORE_PASSWORD = nix-actions.lib.secret "STORE_PASSWORD";
};
}
];
});
}