blob: 675faabe91944d946e83b87dacb0c36d2551b37c [file] [log] [blame]
version: 2.1
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
- sonarcloud/scan
- 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
orbs:
sonarcloud: sonarsource/sonarcloud@1.0.1
workflows:
test-and-build:
jobs:
- test:
filters:
tags:
only: /.*/
context: SonarCloud
- distribute:
requires:
- test
filters:
tags:
only: /v[0-9]+(\.[0-9]+)*(-.*)?/
branches:
ignore: /.*/