blob: e1a7bafef4f767b9a3e884f67aa6065d80f86df3 [file] [log] [blame]
version: 2
jobs:
test:
docker:
- image: circleci/golang:1.14
working_directory: /go/src/github.com/lrills/helm-unittest
steps:
- checkout
- run:
name: Create temp directories for artifacts
command: |
mkdir -p /tmp/test-artifacts
mkdir -p /tmp/test-results
- run:
name: Install JUnit plugin for uploading testresults
command: go get -u github.com/jstemmer/go-junit-report
- run:
name: Test include Codecoverage
command: |
trap "go-junit-report < /tmp/go-test-output > /tmp/test-results/go-test-report.xml" EXIT
go test ./unittest/... -coverprofile=/tmp/coverage -v -covermode=atomic | tee /tmp/go-test-output
- run:
name: Convert coverage to correct artifacts
command: |
go tool cover -html=/tmp/coverage -o /tmp/test-artifacts/coverage.html
bash <(curl -s https://codecov.io/bash) -f /tmp/coverage
- run:
name: Check formated
command: "! gofmt -l . 2>&1 | read"
- run:
name: Cleanup dependencies
command: go mod tidy
- store_test_results:
path: /tmp/test-results
- store_artifacts:
path: /tmp/test-artifacts
distribute:
docker:
- image: golang:1.14
working_directory: /go/src/github.com/lrills/helm-unittest
steps:
- checkout
- run:
name: Insatll ghr
command: go get -u github.com/tcnksm/ghr
- run:
name: Build binaries
command: make dist
- run:
name: Upload binaries
command: ghr -u $CIRCLE_USERNAME $CIRCLE_TAG _dist
workflows:
version: 2
test-and-build:
jobs:
- test:
filters:
tags:
only: /.*/
- distribute:
requires:
- test
filters:
tags:
only: /v[0-9]+(\.[0-9]+)*(-.*)?/
branches:
ignore: /.*/