fix/improve circle tests

This commit is contained in:
Alex Goodman 2019-11-09 14:49:42 -05:00
parent 7a5992fe18
commit 873f5783e7
No known key found for this signature in database
GPG Key ID: 98AF011C5C78EB7E
4 changed files with 41 additions and 44 deletions

View File

@ -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"

View File

@ -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:
@ -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
@ -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

View File

@ -39,6 +39,7 @@ dockers:
binaries:
- dive
dockerfile: Dockerfile
# todo: on 1.0 remove 'v' prefix
image_templates:
- "wagoodman/dive:latest"
- "wagoodman/dive:{{ .Tag }}"

View File

@ -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
@ -34,6 +40,7 @@ ci-test-production-image:
'${TEST_IMAGE}' \
--ci
## For development
run: build