Skip to content

Commit

Permalink
fix/improve circle tests
Browse files Browse the repository at this point in the history
  • Loading branch information
wagoodman committed Nov 9, 2019
1 parent 7a5992f commit 873f578
Show file tree
Hide file tree
Showing 4 changed files with 41 additions and 44 deletions.
65 changes: 27 additions & 38 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
@@ -1,70 +1,59 @@
version: 2
version: 2.1

jobs:
golang-1.11:
run-static-analyses:
parameters:
version:
type: string
working_directory: /home/circleci/app
docker:
- image: circleci/golang:1.11
- image: circleci/golang:<< parameters.version >>
environment:
GO111MODULE: "on"
steps:
- checkout
- restore_cache:
keys:
- golang-1.11-{{ checksum "go.sum" }}
- run: make setup-ci
- golang-<< parameters.version >>-{{ checksum "go.sum" }}
- run: make ci-install-go-tools
- save_cache:
key: golang-1.11-{{ checksum "go.sum" }}
key: golang-<< parameters.version >>-{{ checksum "go.sum" }}
paths:
- "/go/pkg/mod"
- run:
name: run static analysis & tests
command: make ci
name: run static analysis
command: make ci-static-analyses

golang-1.12:
run-tests:
parameters:
version:
type: string
working_directory: /home/circleci/app
docker:
- image: circleci/golang:1.12
- image: circleci/golang:<< parameters.version >>
environment:
GO111MODULE: "on"
steps:
- checkout
- restore_cache:
keys:
- golang-1.12-{{ checksum "go.sum" }}
- run: make setup-ci
- golang-<< parameters.version >>-{{ checksum "go.sum" }}
- run: make ci-install-go-tools
- save_cache:
key: golang-1.12-{{ checksum "go.sum" }}
key: golang-<< parameters.version >>-{{ checksum "go.sum" }}
paths:
- "/go/pkg/mod"
- run:
name: run static analysis & tests
command: make ci
name: run unit tests
command: make ci-unit-test

golang-1.13:
working_directory: /home/circleci/app
docker:
- image: circleci/golang:1.13
environment:
GO111MODULE: "on"
steps:
- checkout
- restore_cache:
keys:
- golang-1.13-{{ checksum "go.sum" }}
- run: make setup-ci
- save_cache:
key: golang-1.13-{{ checksum "go.sum" }}
paths:
- "/go/pkg/mod"
- run:
name: run static analysis & tests
command: make ci

workflows:
version: 2
commit:
jobs:
- golang-1.11
- golang-1.12
- golang-1.13
- run-static-analyses:
version: "1.13"
- run-tests:
version: "1.12"
- run-tests:
version: "1.13"
10 changes: 5 additions & 5 deletions .github/workflows/pipeline.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@ on: [ push, pull_request ]
env:
DOCKER_CLI_VERSION: "19.03.1"
jobs:
# This will run on merge to master, and for PRs with folks that also are part of the GHA beta.
# Circle ci will also run for redundancy until GHA is out of beta, since circle checks will always run.
unit-test:
strategy:
matrix:
Expand Down Expand Up @@ -33,7 +35,7 @@ jobs:
run: go get ./...

- name: Test
run: make ci-test
run: make ci-unit-test

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

# todo: test gofmt

- name: Lint
run: golangci-lint run -v
- name: Linting, formatting, and other static code analyses
run: make ci-static-analyses

- name: Build snapshot artifacts
uses: goreleaser/goreleaser-action@v1
Expand Down
1 change: 1 addition & 0 deletions .goreleaser.yml
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ dockers:
binaries:
- dive
dockerfile: Dockerfile
# todo: on 1.0 remove 'v' prefix
image_templates:
- "wagoodman/dive:latest"
- "wagoodman/dive:{{ .Tag }}"
Expand Down
9 changes: 8 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,15 @@ all: clean build

## For CI

ci-test:
ci-unit-test:
go test -cover -v -race ./...

ci-static-analyses:
grep -R 'const allowTestDataCapture = false' runtime/ui/viewmodel
go vet ./...
@! gofmt -s -l . 2>&1 | grep -vE '^\.git/' | grep -vE '^\.cache/'
golangci-lint run

ci-install-go-tools:
curl -sfL https://install.goreleaser.com/github.com/golangci/golangci-lint.sh | sudo sh -s -- -b /usr/local/bin/ latest

Expand All @@ -34,6 +40,7 @@ ci-test-production-image:
'${TEST_IMAGE}' \
--ci


## For development

run: build
Expand Down

0 comments on commit 873f578

Please sign in to comment.