| 1 |
version: 2.1 |
| 2 |
|
| 3 |
orbs: |
| 4 |
win: circleci/[email protected] |
| 5 |
|
| 6 |
workflows: |
| 7 |
workflow: |
| 8 |
jobs: |
| 9 |
- go-test: |
| 10 |
name: Go 1.15 |
| 11 |
docker-image: circleci/golang:1.14 |
| 12 |
run-lint: true |
| 13 |
with-coverage: true |
| 14 |
- go-test: |
| 15 |
name: Go 1.14 |
| 16 |
docker-image: circleci/golang:1.14 |
| 17 |
- go-test-windows: |
| 18 |
name: Windows |
| 19 |
- benchmarks |
| 20 |
|
| 21 |
jobs: |
| 22 |
go-test: |
| 23 |
parameters: |
| 24 |
docker-image: |
| 25 |
type: string |
| 26 |
run-lint: |
| 27 |
type: boolean |
| 28 |
default: false |
| 29 |
with-coverage: |
| 30 |
type: boolean |
| 31 |
default: false |
| 32 |
|
| 33 |
docker: |
| 34 |
- image: <<parameters.docker-image>> |
| 35 |
environment: |
| 36 |
CIRCLE_TEST_REPORTS: /tmp/circle-reports |
| 37 |
CIRCLE_ARTIFACTS: /tmp/circle-artifacts |
| 38 |
|
| 39 |
steps: |
| 40 |
- checkout |
| 41 |
|
| 42 |
- run: |
| 43 |
name: install go-junit-report |
| 44 |
command: go get -u github.com/jstemmer/go-junit-report |
| 45 |
|
| 46 |
- run: |
| 47 |
name: build |
| 48 |
command: make build |
| 49 |
|
| 50 |
- when: |
| 51 |
condition: <<parameters.run-lint>> |
| 52 |
steps: |
| 53 |
- run: |
| 54 |
name: lint |
| 55 |
command: make lint |
| 56 |
|
| 57 |
- run: |
| 58 |
name: test |
| 59 |
command: | |
| 60 |
mkdir -p $CIRCLE_TEST_REPORTS |
| 61 |
mkdir -p $CIRCLE_ARTIFACTS |
| 62 |
make test | tee $CIRCLE_ARTIFACTS/report.txt |
| 63 |
|
| 64 |
- run: |
| 65 |
name: Process test results |
| 66 |
command: go-junit-report < $CIRCLE_ARTIFACTS/report.txt > $CIRCLE_TEST_REPORTS/junit.xml |
| 67 |
when: always |
| 68 |
|
| 69 |
- when: |
| 70 |
condition: <<parameters.with-coverage>> |
| 71 |
steps: |
| 72 |
- run: |
| 73 |
name: Verify test coverage |
| 74 |
command: make test-coverage |
| 75 |
- run: |
| 76 |
name: Store coverage results |
| 77 |
command: cp build/coverage* /tmp/circle-artifacts |
| 78 |
when: always |
| 79 |
|
| 80 |
- store_test_results: |
| 81 |
path: /tmp/circle-reports |
| 82 |
|
| 83 |
- store_artifacts: |
| 84 |
path: /tmp/circle-artifacts |
| 85 |
|
| 86 |
go-test-windows: |
| 87 |
executor: |
| 88 |
name: win/vs2019 |
| 89 |
shell: powershell.exe |
| 90 |
|
| 91 |
environment: |
| 92 |
GOPATH: C:\Users\VssAdministrator\go |
| 93 |
|
| 94 |
steps: |
| 95 |
- checkout |
| 96 |
- run: go version |
| 97 |
- run: go build ./... |
| 98 |
- run: go test ./... |
| 99 |
|
| 100 |
benchmarks: |
| 101 |
docker: |
| 102 |
- image: circleci/golang:1.14 |
| 103 |
environment: |
| 104 |
CIRCLE_ARTIFACTS: /tmp/circle-artifacts |
| 105 |
|
| 106 |
steps: |
| 107 |
- checkout |
| 108 |
- run: go build ./... |
| 109 |
- run: |
| 110 |
name: Run benchmarks |
| 111 |
command: | |
| 112 |
mkdir -p $CIRCLE_ARTIFACTS |
| 113 |
make benchmarks | tee $CIRCLE_ARTIFACTS/benchmarks.txt |
| 114 |
|
| 115 |
- store_artifacts: |
| 116 |
path: /tmp/circle-artifacts |