Skip to content

Commit c3dd95a

Browse files
authored
build: use build matrix; drop Go <= 1.10 (#629)
1 parent 78ab81e commit c3dd95a

File tree

1 file changed

+61
-67
lines changed

1 file changed

+61
-67
lines changed

.circleci/config.yml

Lines changed: 61 additions & 67 deletions
Original file line numberDiff line numberDiff line change
@@ -1,76 +1,70 @@
1-
version: 2.0
1+
version: 2.1
22

33
jobs:
4-
# Base test configuration for Go library tests Each distinct version should
5-
# inherit this base, and override (at least) the container image used.
6-
"test": &test
4+
"test":
5+
parameters:
6+
version:
7+
type: string
8+
default: "latest"
9+
golint:
10+
type: boolean
11+
default: true
12+
modules:
13+
type: boolean
14+
default: true
15+
goproxy:
16+
type: string
17+
default: ""
718
docker:
8-
- image: circleci/golang:latest
19+
- image: "circleci/golang:<< parameters.version >>"
920
working_directory: /go/src/github.com/gorilla/websocket
10-
steps: &steps
21+
environment:
22+
GO111MODULE: "on"
23+
GOPROXY: "<< parameters.goproxy >>"
24+
steps:
1125
- checkout
12-
- run: go version
13-
- run: go get -t -v ./...
26+
- run:
27+
name: "Print the Go version"
28+
command: >
29+
go version
30+
- run:
31+
name: "Fetch dependencies"
32+
command: >
33+
if [[ << parameters.modules >> = true ]]; then
34+
go mod download
35+
export GO111MODULE=on
36+
else
37+
go get -v ./...
38+
fi
1439
# Only run gofmt, vet & lint against the latest Go version
15-
- run: >
16-
if [[ "$LATEST" = true ]]; then
17-
go get -u golang.org/x/lint/golint
18-
golint ./...
19-
fi
20-
- run: >
21-
if [[ "$LATEST" = true ]]; then
22-
diff -u <(echo -n) <(gofmt -d .)
23-
fi
24-
- run: >
25-
if [[ "$LATEST" = true ]]; then
26-
go vet -v .
27-
fi
28-
- run: if [[ "$LATEST" = true ]]; then go vet -v .; fi
29-
- run: go test -v -race ./...
30-
31-
"latest":
32-
<<: *test
33-
environment:
34-
LATEST: true
35-
36-
"1.12":
37-
<<: *test
38-
docker:
39-
- image: circleci/golang:1.12
40-
41-
"1.11":
42-
<<: *test
43-
docker:
44-
- image: circleci/golang:1.11
45-
46-
"1.10":
47-
<<: *test
48-
docker:
49-
- image: circleci/golang:1.10
50-
51-
"1.9":
52-
<<: *test
53-
docker:
54-
- image: circleci/golang:1.9
55-
56-
"1.8":
57-
<<: *test
58-
docker:
59-
- image: circleci/golang:1.8
60-
61-
"1.7":
62-
<<: *test
63-
docker:
64-
- image: circleci/golang:1.7
40+
- run:
41+
name: "Run golint"
42+
command: >
43+
if [ << parameters.version >> = "latest" ] && [ << parameters.golint >> = true ]; then
44+
go get -u golang.org/x/lint/golint
45+
golint ./...
46+
fi
47+
- run:
48+
name: "Run gofmt"
49+
command: >
50+
if [[ << parameters.version >> = "latest" ]]; then
51+
diff -u <(echo -n) <(gofmt -d -e .)
52+
fi
53+
- run:
54+
name: "Run go vet"
55+
command: >
56+
if [[ << parameters.version >> = "latest" ]]; then
57+
go vet -v ./...
58+
fi
59+
- run:
60+
name: "Run go test (+ race detector)"
61+
command: >
62+
go test -v -race ./...
6563
6664
workflows:
67-
version: 2
68-
build:
65+
tests:
6966
jobs:
70-
- "latest"
71-
- "1.12"
72-
- "1.11"
73-
- "1.10"
74-
- "1.9"
75-
- "1.8"
76-
- "1.7"
67+
- test:
68+
matrix:
69+
parameters:
70+
version: ["latest", "1.15", "1.14", "1.13", "1.12", "1.11"]

0 commit comments

Comments
 (0)