feat(system): ci options

This commit is contained in:
arcnmx 2024-04-16 03:43:26 -07:00
parent a1e7a31caa
commit 743593452d
9 changed files with 139 additions and 28 deletions

View file

@ -10,6 +10,7 @@ fi
NIX_BUILD_ARGS=(
--show-trace
)
NIX_BUILD_ARGS_ASYNC=()
init_nfargs() {
nflinksuffix="$1"
@ -44,16 +45,31 @@ for nfsystem in "${NF_NIX_SYSTEMS[@]}"; do
nfinstallable="${NF_CONFIG_ROOT}#nixosConfigurations.${nfsystem}.config.system.build.toplevel"
init_nfargs "-$nfsystem"
if [[ -n ${NF_ACTIONS_TEST_ASYNC-} ]]; then
NIX_BUILD_ARGS+=("$nfinstallable")
nfwarn=
if [[ " ${NF_NIX_SYSTEMS_WARN[*]} " = *" $nfsystem "* ]]; then
nfwarn=1
fi
if [[ -n ${NF_ACTIONS_TEST_ASYNC-} && -z $nfwarn ]]; then
NIX_BUILD_ARGS_ASYNC+=("$nfinstallable")
continue
fi
echo "building ${nfsystem}..." >&2
echo >&2
nfbuildexit=0
nix build "$nfinstallable" \
"${nfargs[@]}" \
"$@"
"$@" || nfbuildexit=$?
if [[ $nfbuildexit -ne 0 ]]; then
if [[ -n $nfwarn ]]; then
echo "build failure allowed for ${nfsystem}, ignoring..." >&2
continue
fi
exit $nfbuildexit
fi
nfgc
done
@ -62,6 +78,7 @@ if [[ -n ${NF_ACTIONS_TEST_ASYNC-} ]]; then
init_nfargs ""
nix build \
"${nfargs[@]}" \
"${NIX_BUILD_ARGS_ASYNC[@]}" \
"$@"
nfgc

View file

@ -4,16 +4,5 @@
"nodes.nix"
"flake-cron.nix"
];
nixosSystems = [
"ct"
"hakurei"
"reimu"
"aya"
"utsuho"
"tei"
"litterbox"
"keycloak"
"mediabox"
];
};
}

View file

@ -24,15 +24,14 @@ with lib; {
};
jobs = let
inherit ((import ./nix.nix).ci) nixosSystems;
enabledSystems = filterAttrs (_: system: system.config.ci.enable) channels.nixfiles.lib.systems;
in
mapAttrs' (k: nameValuePair "${k}") (genAttrs nixosSystems (host: {
tasks.${host}.inputs = channels.nixfiles.nixosConfigurations.${host}.config.system.build.toplevel;
})) // {
extern = {
tasks.test.inputs = channels.nixfiles.nixosConfigurations.extern-test.config.system.build.toplevel;
mapAttrs' (name: system: nameValuePair "${name}" {
tasks.system = {
inputs = channels.nixfiles.nixosConfigurations.${name}.config.system.build.toplevel;
warn = system.config.ci.allowFailure;
};
};
}) enabledSystems;
ci.gh-actions.checkoutOptions.submodules = false;
cache.cachix.arc = {