File tree Expand file tree Collapse file tree 18 files changed +185
-220
lines changed Expand file tree Collapse file tree 18 files changed +185
-220
lines changed Original file line number Diff line number Diff line change
1
+ version : 2
2
+ jobs :
3
+ fmt :
4
+ docker :
5
+ - image : golang:1
6
+ steps :
7
+ - checkout
8
+ - restore_cache :
9
+ keys :
10
+ - go-{{ checksum "go.sum" }}
11
+ # Fallback to using the latest cache if no exact match is found.
12
+ - go-
13
+ - run : ./ci/fmt.sh
14
+ - save_cache :
15
+ paths :
16
+ - /go
17
+ - /root/.cache/go-build
18
+ key : go-{{ checksum "go.sum" }}
19
+
20
+ lint :
21
+ docker :
22
+ - image : golang:1
23
+ steps :
24
+ - checkout
25
+ - restore_cache :
26
+ keys :
27
+ - go-{{ checksum "go.sum" }}
28
+ # Fallback to using the latest cache if no exact match is found.
29
+ - go-
30
+ - run : ./ci/lint.sh
31
+ - save_cache :
32
+ paths :
33
+ - /go
34
+ - /root/.cache/go-build
35
+ key : go-{{ checksum "go.sum" }}
36
+
37
+ test :
38
+ docker :
39
+ - image : golang:1
40
+ steps :
41
+ - checkout
42
+ - restore_cache :
43
+ keys :
44
+ - go-{{ checksum "go.sum" }}
45
+ # Fallback to using the latest cache if no exact match is found.
46
+ - go-
47
+ - run : ./ci/test.sh
48
+ - save_cache :
49
+ paths :
50
+ - /go
51
+ - /root/.cache/go-build
52
+ key : go-{{ checksum "go.sum" }}
53
+
54
+ workflows :
55
+ version : 2
56
+ fmt :
57
+ jobs :
58
+ - fmt
59
+ lint :
60
+ jobs :
61
+ - lint
62
+ test :
63
+ jobs :
64
+ - test
Load Diff This file was deleted.
Original file line number Diff line number Diff line change
1
+ comment : off
1
2
coverage :
2
3
status :
3
4
# Prevent small changes in coverage from failing CI.
Original file line number Diff line number Diff line change
1
+ #! /usr/bin/env bash
2
+
3
+ set -euo pipefail
4
+ cd " $( dirname " ${0} " ) "
5
+ source ./lib.sh
6
+
7
+ go test --vet=off --run=^$ -bench=. -o=ci/out/websocket.test \
8
+ -cpuprofile=ci/out/cpu.prof \
9
+ -memprofile=ci/out/mem.prof \
10
+ -blockprofile=ci/out/block.prof \
11
+ -mutexprofile=ci/out/mutex.prof \
12
+ .
13
+
14
+ echo
15
+ echo " Profiles are in ./ci/out/*.prof
16
+ Keep in mind that every profiler Go provides is enabled so that may skew the benchmarks."
Load Diff This file was deleted.
Load Diff This file was deleted.
Original file line number Diff line number Diff line change
1
+ #! /usr/bin/env bash
2
+
3
+ set -euo pipefail
4
+ cd " $( dirname " ${0} " ) "
5
+ source ./lib.sh
6
+
7
+ unstaged_files () {
8
+ git ls-files --other --modified --exclude-standard
9
+ }
10
+
11
+ gen () {
12
+ # Unfortunately, this is the only way to ensure go.mod and go.sum are correct.
13
+ # See https://github.com/golang/go/issues/27005
14
+ go list ./... > /dev/null
15
+ go mod tidy
16
+
17
+ go generate ./...
18
+ }
19
+
20
+ fmt () {
21
+ gofmt -w -s .
22
+ go run go.coder.com/go-tools/cmd/goimports -w " -local=$( go list -m) " .
23
+ go run mvdan.cc/sh/cmd/shfmt -i 2 -w -s -sr .
24
+ }
25
+
26
+ gen
27
+ fmt
28
+
29
+ if [[ $CI && $( unstaged_files) != " " ]]; then
30
+ echo
31
+ echo " Files either need generation or are formatted incorrectly."
32
+ echo " Please run:"
33
+ echo " ./ci/fmt.sh"
34
+ echo
35
+ git status
36
+ exit 1
37
+ fi
Load Diff This file was deleted.
Load Diff This file was deleted.
Original file line number Diff line number Diff line change 1
1
#! /usr/bin/env bash
2
2
3
- set -euxo pipefail || exit 1
4
-
5
- export GO111MODULE=on
6
- export PAGER=cat
7
-
8
- # shellcheck disable=SC2034
9
- # CI is used by the scripts that source this file.
10
- export CI=${GITHUB_ACTION-}
3
+ set -euo pipefail
11
4
5
+ # Ensures $CI can be used if it's set or not.
6
+ export CI=${CI:- }
12
7
if [[ $CI ]]; then
13
- export GOFLAGS=-mod=readonly
8
+ export GOFLAGS=-mod=readonly
9
+ export DEBIAN_FRONTEND=noninteractive
14
10
fi
11
+
12
+ cd " $( git rev-parse --show-toplevel) "
Original file line number Diff line number Diff line change
1
+ #! /usr/bin/env bash
2
+
3
+ set -euo pipefail
4
+ cd " $( dirname " ${0} " ) "
5
+ source ./lib.sh
6
+
7
+ if [[ $CI ]]; then
8
+ apt-get update -qq
9
+ apt-get install -qq shellcheck > /dev/null
10
+ fi
11
+
12
+ # shellcheck disable=SC2046
13
+ shellcheck -e SC1091 -x $( git ls-files " *.sh" )
14
+ go vet ./...
15
+ go run golang.org/x/lint/golint -set_exit_status ./...
Load Diff This file was deleted.
Load Diff This file was deleted.
Original file line number Diff line number Diff line change 1
1
#! /usr/bin/env bash
2
2
3
- # This script is for local testing. See .github for CI.
3
+ # This script is for local testing. See .circleci for CI.
4
4
5
- cd " $( dirname " ${0} " ) /.." || exit 1
6
- source ci/lib.sh || exit 1
5
+ set -euo pipefail
6
+ cd " $( dirname " ${0} " ) "
7
+ source ./lib.sh
7
8
8
- function docker_run() {
9
- local DIR=" $1 "
10
- local IMAGE
11
- IMAGE=" $( docker build -q " $DIR " ) "
12
- docker run \
13
- -it \
14
- -v " ${PWD} :/repo" \
15
- -v " $( go env GOPATH) :/go" \
16
- -v " $( go env GOCACHE) :/root/.cache/go-build" \
17
- -w /repo \
18
- " ${IMAGE} "
19
- }
20
-
21
- function help() {
22
- set +x
23
- echo
24
- echo " $0 [-h] <step>"
25
- cat << EOF
26
-
27
- If you do not pass in an explicit step, all steps will be ran in order.
28
- Pass "analyze" as the step to be put into an interactive container to analyze
29
- profiles.
30
- EOF
31
- exit 1
32
- }
33
-
34
- # Use this to analyze benchmark profiles.
35
- if [[ ${1-} == " analyze" ]]; then
36
- docker run \
37
- -it \
38
- -v " ${PWD} :/repo" \
39
- -v " $( go env GOPATH) :/go" \
40
- -v " $( go env GOCACHE) :/root/.cache/go-build" \
41
- -w /repo \
42
- golang:1.12
43
- fi
44
-
45
- if [[ ${1-} == " -h" || ${1-} == " --help" || ${1-} == " help" ]]; then
46
- help
47
- fi
48
-
49
- if [[ $# -gt 0 ]]; then
50
- if [[ ! -d " ci/$* " ]]; then
51
- help
52
- fi
53
-
54
- docker_run " ci/$* "
55
- exit 0
56
- fi
57
-
58
- docker_run ci/fmt
59
- docker_run ci/lint
60
- docker_run ci/test
61
- docker_run ci/bench
9
+ ./fmt.sh
10
+ ./lint.sh
11
+ ./test.sh
Original file line number Diff line number Diff line change
1
+ #! /usr/bin/env bash
2
+
3
+ set -euo pipefail
4
+ cd " $( dirname " ${0} " ) "
5
+ source ./lib.sh
6
+
7
+ echo " This step includes benchmarks for race detection and coverage purposes
8
+ but the numbers will be misleading. please see the bench step or ./bench.sh for
9
+ more accurate numbers."
10
+ echo
11
+
12
+ if [[ $CI ]]; then
13
+ apt-get update -qq
14
+ apt-get install -qq python-pip > /dev/null
15
+ # Need to add pip install directory to $PATH.
16
+ export PATH=" /home/circleci/.local/bin:$PATH "
17
+ pip install -qqq autobahntestsuite
18
+ fi
19
+
20
+ go test -race -coverprofile=ci/out/coverage.prof --vet=off -bench=. -coverpkg=./... ./...
21
+ go tool cover -func=ci/out/coverage.prof
22
+
23
+ if [[ $CI ]]; then
24
+ bash <( curl -s https://codecov.io/bash) -f ci/out/coverage.prof
25
+ else
26
+ go tool cover -html=ci/out/coverage.prof -o=ci/out/coverage.html
27
+
28
+ echo
29
+ echo " Please open ci/out/coverage.html to see detailed test coverage stats."
30
+ fi
Load Diff This file was deleted.
You can’t perform that action at this time.
0 commit comments