-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtests.sh
More file actions
executable file
·66 lines (57 loc) · 1.75 KB
/
tests.sh
File metadata and controls
executable file
·66 lines (57 loc) · 1.75 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
#!/usr/bin/env bash
set -euo pipefail
if [[ ! -e flake.nix ]]; then
echo "missing flake.nix !!!" >&2
fi
architecture="x86_64-linux"
# targets which are to be checked
targets=()
# tests which must succeed
test_targets=(
"bind-dynamic"
"diskoOfflineInstall"
"docs_includeAllModules_banananetwork"
"docs_includeAllModules_disko"
"docs_includeAllModules_hm_banananetwork"
"docs_includeAllModules_home-manager"
"docs_includeAllModules_impermanence"
"docs_includeAllModules_nixpkgs"
"docs_includeAllModules_router"
"docs_includeAllModules_secrix"
"dynamicIssue-module-sshHostKey"
"empty"
"router"
"router-tailscale"
)
for test_target in "${test_targets[@]}"; do
targets+=("nixosTests.${architecture}.${test_target}")
done
# all configs must succeed (& are faster to be built remotely)
mapfile -t configs < <( nix eval --raw .#nixosConfigurations --apply 'a: with builtins; concatStringsSep "\n" (attrNames a)' )
for config in "${configs[@]}"; do
targets+=("nixosConfigurations.\"${config}\".config.system.build.toplevel")
done
# last one to be available as result
targets+=("nixosConfigurations.mgmt-iso.config.system.build.isoImage")
rememberGC() {
if [[ ${CI_GCROOT:-} == "" ]]; then
return 0
fi
new_loc="$CI_GCROOT/$1"
mv ./result "$new_loc"
nix-store --add-root "$new_loc" --realise "$new_loc"
}
set -x
for target in "${targets[@]}"; do
for i in 0 1 last; do
if ./build_remote.sh "$@" .#"$target"; then
rememberGC "$target"
break # continue outside
elif [[ $i == "last" ]]; then
echo "last attempt failed, forward error" >&2
exit 1
else
echo "attempt no. $i failed, retry" >&2
fi
done
done