-
Notifications
You must be signed in to change notification settings - Fork 55
/
run-tests.sh
executable file
·47 lines (41 loc) · 1.39 KB
/
run-tests.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
#!/usr/bin/env bash
set -e
echo "Ensuring all dependencies are present in LICENSE-3rdparty.csv ..."
go mod tidy
ALL_DEPS=$(cat go.sum tests/go.sum | awk '{print $1}' | uniq | sort | sed "s|^\(.*\)|go.sum,\1,|")
DEPS_NOT_FOUND=""
set +e
for one_dep in $ALL_DEPS; do
cat LICENSE-3rdparty.csv | grep "$one_dep" > /dev/null 2>&1
if [ $? -ne 0 ]; then
DEPS_NOT_FOUND="${DEPS_NOT_FOUND}\n${one_dep}<LICENSE>,<COPYRIGHT>"
fi
done
set -e
if [ -n "$DEPS_NOT_FOUND" ]; then
echo "Some dependencies were not found in LICENSE-3rdparty.csv, please add: $DEPS_NOT_FOUND"
exit 1
else
echo "LICENSE-3rdparty.csv is up to date"
fi
# make sure the below installed dependencies don't get added to go.mod/go.sum
# unfortunately there's no better way to fix this than change directory
# this might get solved in Go 1.14: https://github.com/golang/go/issues/30515
cd "$(mktemp -d)"
GO111MODULE=on go install honnef.co/go/tools/cmd/[email protected]
GO111MODULE=on go install gotest.tools/gotestsum@latest
cd -
staticcheck -checks -SA1009 ./api/...
go mod tidy
go clean -testcache
# Run the same in tests submodule
cd tests
staticcheck -checks inherit,-SA1019 ./...
go mod tidy
go clean -testcache
if [ "$RECORD" == "none" ]; then
gotestsum --rerun-fails=1 --format short-verbose --packages ./... -- -timeout=20m $TESTARGS
else
gotestsum --format short-verbose --packages ./... -- $TESTARGS
fi
cd ..