forked from decred/dcrdex
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathrun_tests.sh
executable file
·56 lines (48 loc) · 1.52 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
48
49
50
51
52
53
54
55
56
#!/bin/bash
set -ex
dir=$(pwd)
# list of all modules to test
modules=". server/cmd/dcrdex client/cmd/dexc client/cmd/dexcctl"
# For each module, run go mod tidy, build and run test.
for m in $modules
do
cd $dir/$m
# run `go mod tidy` and fail if the git status of go.mod and/or
# go.sum changes
MOD_STATUS=$(git status --porcelain go.mod go.sum)
go mod tidy
UPDATED_MOD_STATUS=$(git status --porcelain go.mod go.sum)
if [ "$UPDATED_MOD_STATUS" != "$MOD_STATUS" ]; then
echo "$m: running 'go mod tidy' modified go.mod and/or go.sum"
git diff --unified=0 go.mod go.sum
exit 1
fi
# build and run tests
if [ "$m" != '.' ]; then go build; fi
env GORACE="halt_on_error=1" go test -race -short ./...
done
cd $dir
dumptags="-c -o /dev/null -tags"
go test $dumptags live ./client/webserver
go test $dumptags harness ./client/asset/dcr
go test $dumptags harness ./client/asset/btc/livetest
go test $dumptags harness ./client/asset/ltc
go test $dumptags harness ./client/core
go test $dumptags dcrlive ./server/asset/dcr
go test $dumptags btclive ./server/asset/btc
go test $dumptags ltclive ./server/asset/ltc
go test $dumptags pgonline ./server/db/driver/pg
# Return to initial directory.
cd $dir
# golangci-lint (github.com/golangci/golangci-lint) is used to run each
# static checker.
# check linters
golangci-lint run --disable-all --deadline=10m \
--out-format=github-actions \
--enable=goimports \
--enable=govet \
--enable=gosimple \
--enable=unconvert \
--enable=structcheck \
--enable=ineffassign \
--enable=asciicheck