-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathtests.sh
executable file
·70 lines (56 loc) · 1.35 KB
/
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
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
#!/bin/bash
# author: deadc0de6 (https://github.com/deadc0de6)
# Copyright (c) 2024, deadc0de6
set -eu -o errtrace -o pipefail
cur=$(cd "$(dirname "${0}")" && pwd)
# deps
echo "install deps..."
go install golang.org/x/lint/golint@latest
go install honnef.co/go/tools/cmd/staticcheck@latest
go install github.com/mgechev/revive@latest
go install github.com/golangci/golangci-lint/cmd/golangci-lint@latest
go install github.com/goreleaser/goreleaser@latest
# download go deps
go mod tidy
# linting
echo "go fmt..."
go fmt ./...
#echo "golint..."
#golint -set_exit_status ./...
echo "golangci-lint..."
golangci-lint run
echo "revive..."
revive -set_exit_status -config ./revive.toml ./...
echo "staticcheck..."
staticcheck ./...
echo "go vet..."
go vet ./...
# unittests
#go test -v ./...
# shell scripts linting
find . -iname '*.sh' | while read -r script; do
echo "-> checking \"${script}\""
shellcheck "${script}"
done
# compilation
echo "compiling..."
make clean
make
rm -rf dist/
# integration tests
find "${cur}/tests-ng" -iname 'test-*.sh' | while read -r line; do
echo "running test script: ${line}"
set +e
"${line}"
ret="$?"
set -e
if [ "${ret}" != "0" ]; then
echo "test \"${line}\" failed!"
exit 1
fi
done
# cross compilation
echo "build releases..."
goreleaser release --snapshot --clean
#rm -rf dist/
echo "done - all tests OK!"