Skip to content

Commit 873f578

Browse files
committed
fix/improve circle tests
1 parent 7a5992f commit 873f578

File tree

4 files changed

+41
-44
lines changed

4 files changed

+41
-44
lines changed

.circleci/config.yml

+27-38
Original file line numberDiff line numberDiff line change
@@ -1,70 +1,59 @@
1-
version: 2
1+
version: 2.1
22

33
jobs:
4-
golang-1.11:
4+
run-static-analyses:
5+
parameters:
6+
version:
7+
type: string
58
working_directory: /home/circleci/app
69
docker:
7-
- image: circleci/golang:1.11
10+
- image: circleci/golang:<< parameters.version >>
811
environment:
912
GO111MODULE: "on"
1013
steps:
1114
- checkout
1215
- restore_cache:
1316
keys:
14-
- golang-1.11-{{ checksum "go.sum" }}
15-
- run: make setup-ci
17+
- golang-<< parameters.version >>-{{ checksum "go.sum" }}
18+
- run: make ci-install-go-tools
1619
- save_cache:
17-
key: golang-1.11-{{ checksum "go.sum" }}
20+
key: golang-<< parameters.version >>-{{ checksum "go.sum" }}
1821
paths:
1922
- "/go/pkg/mod"
2023
- run:
21-
name: run static analysis & tests
22-
command: make ci
24+
name: run static analysis
25+
command: make ci-static-analyses
2326

24-
golang-1.12:
27+
run-tests:
28+
parameters:
29+
version:
30+
type: string
2531
working_directory: /home/circleci/app
2632
docker:
27-
- image: circleci/golang:1.12
33+
- image: circleci/golang:<< parameters.version >>
2834
environment:
2935
GO111MODULE: "on"
3036
steps:
3137
- checkout
3238
- restore_cache:
3339
keys:
34-
- golang-1.12-{{ checksum "go.sum" }}
35-
- run: make setup-ci
40+
- golang-<< parameters.version >>-{{ checksum "go.sum" }}
41+
- run: make ci-install-go-tools
3642
- save_cache:
37-
key: golang-1.12-{{ checksum "go.sum" }}
43+
key: golang-<< parameters.version >>-{{ checksum "go.sum" }}
3844
paths:
3945
- "/go/pkg/mod"
4046
- run:
41-
name: run static analysis & tests
42-
command: make ci
47+
name: run unit tests
48+
command: make ci-unit-test
4349

44-
golang-1.13:
45-
working_directory: /home/circleci/app
46-
docker:
47-
- image: circleci/golang:1.13
48-
environment:
49-
GO111MODULE: "on"
50-
steps:
51-
- checkout
52-
- restore_cache:
53-
keys:
54-
- golang-1.13-{{ checksum "go.sum" }}
55-
- run: make setup-ci
56-
- save_cache:
57-
key: golang-1.13-{{ checksum "go.sum" }}
58-
paths:
59-
- "/go/pkg/mod"
60-
- run:
61-
name: run static analysis & tests
62-
command: make ci
6350

6451
workflows:
65-
version: 2
6652
commit:
6753
jobs:
68-
- golang-1.11
69-
- golang-1.12
70-
- golang-1.13
54+
- run-static-analyses:
55+
version: "1.13"
56+
- run-tests:
57+
version: "1.12"
58+
- run-tests:
59+
version: "1.13"

.github/workflows/pipeline.yml

+5-5
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,8 @@ on: [ push, pull_request ]
33
env:
44
DOCKER_CLI_VERSION: "19.03.1"
55
jobs:
6+
# This will run on merge to master, and for PRs with folks that also are part of the GHA beta.
7+
# Circle ci will also run for redundancy until GHA is out of beta, since circle checks will always run.
68
unit-test:
79
strategy:
810
matrix:
@@ -33,7 +35,7 @@ jobs:
3335
run: go get ./...
3436

3537
- name: Test
36-
run: make ci-test
38+
run: make ci-unit-test
3739

3840
build-artifacts:
3941
runs-on: ubuntu-latest
@@ -60,10 +62,8 @@ jobs:
6062
if: steps.package-cache-go-dependencies.outputs.cache-hit != 'true'
6163
run: go get ./...
6264

63-
# todo: test gofmt
64-
65-
- name: Lint
66-
run: golangci-lint run -v
65+
- name: Linting, formatting, and other static code analyses
66+
run: make ci-static-analyses
6767

6868
- name: Build snapshot artifacts
6969
uses: goreleaser/goreleaser-action@v1

.goreleaser.yml

+1
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@ dockers:
3939
binaries:
4040
- dive
4141
dockerfile: Dockerfile
42+
# todo: on 1.0 remove 'v' prefix
4243
image_templates:
4344
- "wagoodman/dive:latest"
4445
- "wagoodman/dive:{{ .Tag }}"

Makefile

+8-1
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,15 @@ all: clean build
99

1010
## For CI
1111

12-
ci-test:
12+
ci-unit-test:
1313
go test -cover -v -race ./...
1414

15+
ci-static-analyses:
16+
grep -R 'const allowTestDataCapture = false' runtime/ui/viewmodel
17+
go vet ./...
18+
@! gofmt -s -l . 2>&1 | grep -vE '^\.git/' | grep -vE '^\.cache/'
19+
golangci-lint run
20+
1521
ci-install-go-tools:
1622
curl -sfL https://install.goreleaser.com/github.com/golangci/golangci-lint.sh | sudo sh -s -- -b /usr/local/bin/ latest
1723

@@ -34,6 +40,7 @@ ci-test-production-image:
3440
'${TEST_IMAGE}' \
3541
--ci
3642

43+
3744
## For development
3845

3946
run: build

0 commit comments

Comments
 (0)