-
-
Notifications
You must be signed in to change notification settings - Fork 0
/
test.sh
executable file
·109 lines (86 loc) · 2.1 KB
/
test.sh
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
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
#!/bin/bash
set -euo pipefail
BAZEL=bazel
if command -v bazelisk; then
BAZEL=bazelisk
fi
git --no-pager diff -- example_* && [[ 0 -eq "$(git diff -- example_* | wc -l)" ]]
L=resolved.bzl
# FIXME: https://github.com/bazelbuild/bazel/issues/11067
make_resolved.bzl_hermetic() {
grep -v -F '"definition_information": ' $L >$L~
mv $L~ $L
}
echo
echo Updating scripts
echo
./sync.sh
git --no-pager diff -- sync.sh && [[ 0 -eq "$(git diff -- sync.sh | wc -l)" ]]
echo
echo Running locked
echo
for workspace in example_*; do
echo
echo "$workspace"
pushd "$workspace" >/dev/null
$BAZEL run hello
git --no-pager diff . && [[ 0 -eq "$(git diff . | wc -l)" ]]
popd >/dev/null
done
echo
echo Upgrading dependencies
echo
for workspace in example_*; do
echo
echo "$workspace"
pushd "$workspace" >/dev/null
# FIXME: https://stackoverflow.com/questions/60864626/cannot-fetch-eigen-with-bazel-406-not-acceptable
[[ "$workspace" = example_upgradable_gitlab_archive_constrained ]] && echo "SKIPPING: example_upgradable_gitlab_archive_constrained" && continue
cp $L before.py
rm $L
$BAZEL sync
make_resolved.bzl_hermetic
$BAZEL clean --expunge
cp $L after.py
set +e
python3 ../diff.py "$PWD"
diffed=$?
set -e
rm before.py after.py
if [[ "$diffed" -ne 0 ]]; then
case "$workspace" in
*upgradable*HEAD*)
# Since this example follows HEAD we expect these values to change:
# * sha256
# * strip_prefix
# * urls
# * output_tree_hash
exit $diffed #FIXME
;;
*)
# There may be changes to values we do not care about here:
# * output_tree_hash
exit $diffed #FIXME
esac
fi
git checkout -- $L
if [[ 0 -ne "$(git diff . | wc -l)" ]]; then
git --no-pager diff .
exit 1
fi
popd >/dev/null
done
echo
echo Running locked, again
echo
for workspace in example_*; do
[[ "$workspace" != *upgradable* ]] && continue
echo
echo "$workspace"
pushd "$workspace" >/dev/null
$BAZEL run hello
git --no-pager diff . && [[ 0 -eq "$(git diff . | wc -l)" ]]
popd >/dev/null
done
git --no-pager diff -- example_* && [[ 0 -eq "$(git diff -- example_* | wc -l)" ]]
echo PASSED