forked from HcashOrg/hcashd
-
Notifications
You must be signed in to change notification settings - Fork 0
/
run_tests.sh
52 lines (42 loc) · 1.41 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
#!/usr/bin/env bash
set -ex
# The script does automatic checking on a Go package and its sub-packages,
# including:
# 1. gofmt (http://golang.org/cmd/gofmt/)
# 2. go vet (http://golang.org/cmd/vet)
# 3. unconvert (https://github.com/mdempsky/unconvert)
# 4. race detector (http://blog.golang.org/race-detector)
# gometalinter (github.com/alecthomas/gometalinter) is used to run each each
# static checker.
# To run on docker on windows, symlink /mnt/c to /c and then execute the script
# from the repo path under /c. See:
# https://github.com/Microsoft/BashOnWindows/issues/1854
# for more details.
#Default GOVERSION
GOVERSION=${1:-1.9}
REPO=hcashd
TESTCMD="test -z \"\$(gometalinter --disable-all \
--enable=gofmt \
--enable=vet \
--enable=unconvert \
--vendor \
--deadline=10m . | tee /dev/stderr)\"&& \
env GORACE='halt_on_error=1' go test -short -race \
-tags rpctest \
\$(glide novendor)"
if [ $GOVERSION == "local" ]; then
eval $TESTCMD
exit
fi
DOCKER_IMAGE_TAG=hypercash-golang-builder-$GOVERSION
docker pull HcashOrg/$DOCKER_IMAGE_TAG
docker run --rm -it -v $(pwd):/src HcashOrg/$DOCKER_IMAGE_TAG /bin/bash -c "\
rsync -ra --filter=':- .gitignore' \
/src/ /go/src/github.com/HcashOrg/$REPO/ && \
cd github.com/HcashOrg/$REPO/ && \
glide install && \
go install \$(glide novendor) && \
$TESTCMD
"
echo "------------------------------------------"
echo "Tests complete."