summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlisdair McDiarmid <alisdair@users.noreply.github.com>2020-04-15 15:16:44 -0400
committerAlisdair McDiarmid <alisdair@users.noreply.github.com>2020-04-15 15:16:44 -0400
commit7098edec61606e3944779d70b6f71a353e6f96bc (patch)
tree3c44befc8c93dc4b54d6b4179f9df078e1b2a087
parent10b94c0a9407282cecbdc062d0184f92da0435ab (diff)
Fix CircleCI config
-rw-r--r--.circleci/config.yml74
1 files changed, 56 insertions, 18 deletions
diff --git a/.circleci/config.yml b/.circleci/config.yml
index da7b067..e7b95a6 100644
--- a/.circleci/config.yml
+++ b/.circleci/config.yml
@@ -1,25 +1,63 @@
version: 2.1
-jobs:
- build:
- branches:
- only:
- - master
- - hcl2
+
+executors:
+ go:
docker:
- - image: circleci/golang:1.12
- environment:
- GO111MODULE: "on"
- GOPROXY: "https://proxy.golang.org"
+ - image: circleci/golang:1.14
+ environment:
+ GOMAXPROCS: 4
+ GO111MODULE: "on"
+ GOPROXY: https://proxy.golang.org/
+ TEST_RESULTS_DIR: &TEST_RESULTS_DIR /tmp/test-results
+
+jobs:
+ go-checks:
+ executor:
+ name: go
+ steps:
+ - checkout
+ - run: go mod verify
+ - run: make fmt
+ - run:
+ name: verify no code was generated
+ command: |
+ if [[ -z $(git status --porcelain) ]]; then
+ echo "Git directory is clean."
+ else
+ echo "Git is dirty. Run `make fmt` and `make generate` locally and commit any formatting fixes or generated code."
+ git status --porcelain
+ exit 1
+ fi
+
+ go-test:
+ executor:
+ name: go
steps:
- checkout
- - restore_cache:
- keys:
- - v1-mod-cache
+ - attach_workspace:
+ at: .
+ - run: mkdir -p $TEST_RESULTS_DIR
- run:
- name: "Tests"
+ name: Run Go Tests
command: |
- go test ./...
- - save_cache:
- key: v1-mod-cache
+ PACKAGE_NAMES=$(go list ./... | circleci tests split --split-by=timings --timings-type=classname)
+ echo "Running $(echo $PACKAGE_NAMES | wc -w) packages"
+ echo $PACKAGE_NAMES
+ gotestsum --format=short-verbose --junitfile $TEST_RESULTS_DIR/gotestsum-report.xml -- -p 2 -cover -coverprofile=cov_$CIRCLE_NODE_INDEX.part $PACKAGE_NAMES
+
+ # save coverage report parts
+ - persist_to_workspace:
+ root: .
paths:
- - "/go/pkg/mod"
+ - cov_*.part
+
+ - store_test_results:
+ path: *TEST_RESULTS_DIR
+ - store_artifacts:
+ path: *TEST_RESULTS_DIR
+
+workflows:
+ version: 2
+ test:
+ jobs:
+ - go-test