-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtests.sh
More file actions
executable file
·72 lines (60 loc) · 1.65 KB
/
Copy pathtests.sh
File metadata and controls
executable file
·72 lines (60 loc) · 1.65 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
67
68
69
70
71
72
#!/usr/bin/env bash
set -euo pipefail
if [[ ! -e flake.nix ]]; then
echo "missing flake.nix !!!" >&2
fi
GREP_FILTER=""
RANDOM_ORDER="" # useful for quicker mass-bug-detecting on release upgrades
if [[ ${1:-} == "--grep" ]]; then
GREP_FILTER="$2"
shift 2
elif [[ ${1:-} == "--random-order" ]]; then
RANDOM_ORDER="y"
shift 1
fi
filter() {
if [[ -n "$GREP_FILTER" ]]; then
grep "$GREP_FILTER"
elif [[ -n "$RANDOM_ORDER" ]]; then
shuf
else
cat
fi
}
architecture="$( nix eval --impure --expr "builtins.currentSystem" )"
targetAttr=".#x-banananetwork_ci-targets.${architecture}"
# targets which are to be checked
targets=()
mapfile -t test_targets < <( nix eval --raw "${targetAttr}.testTargetsText" | filter )
targets+=("${test_targets[@]}")
mapfile -t build_targets < <( nix eval --raw "${targetAttr}.buildTargetsText" | filter )
targets+=("${build_targets[@]}")
if [[ "${1:-}" == "--print-out" ]]; then
echo "would build following targets:"
for target in "${targets[@]}"; do
echo " - $target"
done
exit 0
fi
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