Codebase list golang-github-gorilla-securecookie / f37875e
build: use build matrix; drop Go <= 1.10 (#74) Matt Silverlock authored 3 years ago GitHub committed 3 years ago
1 changed file(s) with 62 addition(s) and 57 deletion(s). Raw diff Collapse all Expand all
0 version: 2.0
0 version: 2.1
11
22 jobs:
3 # Base test configuration for Go library tests Each distinct version should
4 # inherit this base, and override (at least) the container image used.
5 "test": &test
3 "test":
4 parameters:
5 version:
6 type: string
7 default: "latest"
8 golint:
9 type: boolean
10 default: true
11 modules:
12 type: boolean
13 default: true
14 goproxy:
15 type: string
16 default: ""
617 docker:
7 - image: circleci/golang:latest
18 - image: "circleci/golang:<< parameters.version >>"
819 working_directory: /go/src/github.com/gorilla/securecookie
9 steps: &steps
20 environment:
21 GO111MODULE: "on"
22 GOPROXY: "<< parameters.goproxy >>"
23 steps:
1024 - checkout
11 - run: go version
12 - run: go get -t -v ./...
13 - run: diff -u <(echo -n) <(gofmt -d .)
14 - run: if [[ "$LATEST" = true ]]; then go vet -v .; fi
15 - run: go test -v -race ./...
16
17 "latest":
18 <<: *test
19 environment:
20 LATEST: true
21
22
23 "1.12":
24 <<: *test
25 docker:
26 - image: circleci/golang:1.12
27
28 "1.11":
29 <<: *test
30 docker:
31 - image: circleci/golang:1.11
32
33 "1.10":
34 <<: *test
35 docker:
36 - image: circleci/golang:1.10
37
38 "1.9":
39 <<: *test
40 docker:
41 - image: circleci/golang:1.9
42
43 "1.8":
44 <<: *test
45 docker:
46 - image: circleci/golang:1.8
47
48 "1.7":
49 <<: *test
50 docker:
51 - image: circleci/golang:1.7
52
25 - run:
26 name: "Print the Go version"
27 command: >
28 go version
29 - run:
30 name: "Fetch dependencies"
31 command: >
32 if [[ << parameters.modules >> = true ]]; then
33 go mod download
34 export GO111MODULE=on
35 else
36 go get -v ./...
37 fi
38 # Only run gofmt, vet & lint against the latest Go version
39 - run:
40 name: "Run golint"
41 command: >
42 if [ << parameters.version >> = "latest" ] && [ << parameters.golint >> = true ]; then
43 go get -u golang.org/x/lint/golint
44 golint ./...
45 fi
46 - run:
47 name: "Run gofmt"
48 command: >
49 if [[ << parameters.version >> = "latest" ]]; then
50 diff -u <(echo -n) <(gofmt -d -e .)
51 fi
52 - run:
53 name: "Run go vet"
54 command: >
55 if [[ << parameters.version >> = "latest" ]]; then
56 go vet -v ./...
57 fi
58 - run:
59 name: "Run go test (+ race detector)"
60 command: >
61 go test -v -race ./...
5362
5463 workflows:
55 version: 2
56 build:
64 tests:
5765 jobs:
58 - "latest"
59 - "1.12"
60 - "1.11"
61 - "1.10"
62 - "1.9"
63 - "1.8"
64 - "1.7"
66 - test:
67 matrix:
68 parameters:
69 version: ["latest", "1.15", "1.14", "1.13", "1.12", "1.11"]