Skip to content

Commit

Permalink
build: use matrix tests in CircleCI (#27)
Browse files Browse the repository at this point in the history
* build: use matrix tests in CircleCI

Per https://circleci.com/blog/circleci-matrix-jobs/

* build: fix params

* build: fix YAML indent

* build: rename build -> tests

* build: Merge latest && matrix build
  • Loading branch information
elithrar authored Sep 12, 2020
1 parent 580fd73 commit df0c4bf
Showing 1 changed file with 10 additions and 22 deletions.
32 changes: 10 additions & 22 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,9 @@ version: 2.1
jobs:
"test":
parameters:
v:
version:
type: string
default: "latest"
latest:
type: boolean
default: false
golint:
type: boolean
default: true
Expand All @@ -19,7 +16,7 @@ jobs:
type: string
default: ""
docker:
- image: "circleci/golang:<< parameters.v >>"
- image: "circleci/golang:<< parameters.version >>"
working_directory: /go/src/github.com/elithrar/admission-control
environment:
GO111MODULE: "on"
Expand All @@ -43,20 +40,20 @@ jobs:
- run:
name: "Run golint"
command: >
if [ << parameters.latest >> = true ] && [ << parameters.golint >> = true ]; then
if [ << parameters.version >> = "latest" ] && [ << parameters.golint >> = true ]; then
go get -u golang.org/x/lint/golint
golint ./...
fi
- run:
name: "Run gofmt"
command: >
if [[ << parameters.latest >> = true ]]; then
if [[ << parameters.version >> = "latest" ]]; then
diff -u <(echo -n) <(gofmt -d -e .)
fi
- run:
name: "Run go vet"
command: >
if [[ << parameters.latest >> = true ]]; then
if [[ << parameters.version >> = "latest" ]]; then
go vet -v ./...
fi
- run:
Expand All @@ -66,7 +63,7 @@ jobs:
"build-container":
docker:
- image: docker:18
- image: docker:19
working_directory: /go/src/github.com/elithrar/admission-control
steps:
- checkout
Expand All @@ -81,19 +78,10 @@ jobs:
docker build -t elithrar/admissiond-example .
workflows:
build:
tests:
jobs:
- test:
name: "latest"
v: "latest"
latest: true
- test:
name: "v1.15"
v: "1.15"
- test:
name: "v1.14"
v: "1.14"
- test:
name: "v1.13"
v: "1.13"
matrix:
parameters:
version: ["latest", "1.15", "1.14", "1.13"]
- "build-container"

0 comments on commit df0c4bf

Please sign in to comment.