Browse Source
* build: CircleCI 2.1 + build matrix * build: drop Go 1.9 & Go 1.10 * build: remove erroneous versionpull/602/head
1 changed files with 43 additions and 60 deletions
@ -1,87 +1,70 @@ |
|||||||
version: 2.0 |
version: 2.1 |
||||||
|
|
||||||
jobs: |
jobs: |
||||||
# Base test configuration for Go library tests Each distinct version should |
"test": |
||||||
# inherit this base, and override (at least) the container image used. |
parameters: |
||||||
"test": &test |
version: |
||||||
|
type: string |
||||||
|
default: "latest" |
||||||
|
golint: |
||||||
|
type: boolean |
||||||
|
default: true |
||||||
|
modules: |
||||||
|
type: boolean |
||||||
|
default: true |
||||||
|
goproxy: |
||||||
|
type: string |
||||||
|
default: "" |
||||||
docker: |
docker: |
||||||
- image: circleci/golang:latest |
- image: "circleci/golang:<< parameters.version >>" |
||||||
working_directory: /go/src/github.com/gorilla/mux |
working_directory: /go/src/github.com/gorilla/mux |
||||||
steps: &steps |
environment: |
||||||
# Our build steps: we checkout the repo, fetch our deps, lint, and finally |
GO111MODULE: "on" |
||||||
# run "go test" on the package. |
GOPROXY: "<< parameters.goproxy >>" |
||||||
|
steps: |
||||||
- checkout |
- checkout |
||||||
# Logs the version in our build logs, for posterity |
- run: |
||||||
- run: go version |
name: "Print the Go version" |
||||||
|
command: > |
||||||
|
go version |
||||||
- run: |
- run: |
||||||
name: "Fetch dependencies" |
name: "Fetch dependencies" |
||||||
command: > |
command: > |
||||||
go get -t -v ./... |
if [[ << parameters.modules >> = true ]]; then |
||||||
|
go mod download |
||||||
|
export GO111MODULE=on |
||||||
|
else |
||||||
|
go get -v ./... |
||||||
|
fi |
||||||
# Only run gofmt, vet & lint against the latest Go version |
# Only run gofmt, vet & lint against the latest Go version |
||||||
- run: |
- run: |
||||||
name: "Run golint" |
name: "Run golint" |
||||||
command: > |
command: > |
||||||
if [ "${LATEST}" = true ] && [ -z "${SKIP_GOLINT}" ]; then |
if [ << parameters.version >> = "latest" ] && [ << parameters.golint >> = true ]; then |
||||||
go get -u golang.org/x/lint/golint |
go get -u golang.org/x/lint/golint |
||||||
golint ./... |
golint ./... |
||||||
fi |
fi |
||||||
- run: |
- run: |
||||||
name: "Run gofmt" |
name: "Run gofmt" |
||||||
command: > |
command: > |
||||||
if [[ "${LATEST}" = true ]]; then |
if [[ << parameters.version >> = "latest" ]]; then |
||||||
diff -u <(echo -n) <(gofmt -d -e .) |
diff -u <(echo -n) <(gofmt -d -e .) |
||||||
fi |
fi |
||||||
- run: |
- run: |
||||||
name: "Run go vet" |
name: "Run go vet" |
||||||
command: > |
command: > |
||||||
if [[ "${LATEST}" = true ]]; then |
if [[ << parameters.version >> = "latest" ]]; then |
||||||
go vet -v ./... |
go vet -v ./... |
||||||
fi |
fi |
||||||
- run: go test -v -race ./... |
- run: |
||||||
|
name: "Run go test (+ race detector)" |
||||||
"latest": |
command: > |
||||||
<<: *test |
go test -v -race ./... |
||||||
environment: |
|
||||||
LATEST: true |
|
||||||
|
|
||||||
"1.12": |
|
||||||
<<: *test |
|
||||||
docker: |
|
||||||
- image: circleci/golang:1.12 |
|
||||||
|
|
||||||
"1.11": |
|
||||||
<<: *test |
|
||||||
docker: |
|
||||||
- image: circleci/golang:1.11 |
|
||||||
|
|
||||||
"1.10": |
|
||||||
<<: *test |
|
||||||
docker: |
|
||||||
- image: circleci/golang:1.10 |
|
||||||
|
|
||||||
"1.9": |
|
||||||
<<: *test |
|
||||||
docker: |
|
||||||
- image: circleci/golang:1.9 |
|
||||||
|
|
||||||
"1.8": |
|
||||||
<<: *test |
|
||||||
docker: |
|
||||||
- image: circleci/golang:1.8 |
|
||||||
|
|
||||||
"1.7": |
|
||||||
<<: *test |
|
||||||
docker: |
|
||||||
- image: circleci/golang:1.7 |
|
||||||
|
|
||||||
workflows: |
workflows: |
||||||
version: 2 |
tests: |
||||||
build: |
|
||||||
jobs: |
jobs: |
||||||
- "latest" |
- test: |
||||||
- "1.12" |
matrix: |
||||||
- "1.11" |
parameters: |
||||||
- "1.10" |
version: ["latest", "1.15", "1.14", "1.13", "1.12", "1.11"] |
||||||
- "1.9" |
|
||||||
- "1.8" |
|
||||||
- "1.7" |
|
||||||
|
|||||||
Loading…
Reference in new issue