| 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.19 |
| 11 |
docker-image: cimg/go:1.19 |
| 12 |
run-lint: true |
| 13 |
- go-test: |
| 14 |
name: Go 1.18 |
| 15 |
docker-image: cimg/go:1.18 |
| 16 |
- go-test-windows: |
| 17 |
name: Windows |
| 18 |
|
| 19 |
jobs: |
| 20 |
go-test: |
| 21 |
parameters: |
| 22 |
docker-image: |
| 23 |
type: string |
| 24 |
run-lint: |
| 25 |
type: boolean |
| 26 |
default: false |
| 27 |
|
| 28 |
docker: |
| 29 |
- image: <<parameters.docker-image>> |
| 30 |
environment: |
| 31 |
CIRCLE_TEST_REPORTS: /tmp/circle-reports |
| 32 |
CIRCLE_ARTIFACTS: /tmp/circle-artifacts |
| 33 |
|
| 34 |
steps: |
| 35 |
- checkout |
| 36 |
- run: |
| 37 |
name: install go-junit-report |
| 38 |
command: go install github.com/jstemmer/go-junit-report/[email protected] |
| 39 |
|
| 40 |
- when: |
| 41 |
condition: <<parameters.run-lint>> |
| 42 |
steps: |
| 43 |
- run: make lint |
| 44 |
|
| 45 |
- run: |
| 46 |
name: Run tests |
| 47 |
command: | |
| 48 |
mkdir -p $CIRCLE_TEST_REPORTS |
| 49 |
mkdir -p $CIRCLE_ARTIFACTS |
| 50 |
trap "go-junit-report < $CIRCLE_ARTIFACTS/report.txt > $CIRCLE_TEST_REPORTS/junit.xml" EXIT |
| 51 |
make test | tee $CIRCLE_ARTIFACTS/report.txt |
| 52 |
|
| 53 |
- store_test_results: |
| 54 |
path: /tmp/circle-reports |
| 55 |
|
| 56 |
- store_artifacts: |
| 57 |
path: /tmp/circle-artifacts |
| 58 |
|
| 59 |
go-test-windows: |
| 60 |
executor: |
| 61 |
name: win/vs2019 |
| 62 |
shell: powershell.exe |
| 63 |
|
| 64 |
environment: |
| 65 |
GOPATH: C:\Users\VssAdministrator\go |
| 66 |
|
| 67 |
steps: |
| 68 |
- checkout |
| 69 |
- run: |
| 70 |
name: download Go 1.18.5 |
| 71 |
command: | |
| 72 |
$ErrorActionPreference = "Stop" |
| 73 |
$installerUrl = "https://go.dev/dl/go1.18.5.windows-amd64.msi" |
| 74 |
(New-Object System.Net.WebClient).DownloadFile($installerUrl, "go1.18.5.windows-amd64.msi") |
| 75 |
- run: |
| 76 |
name: install Go 1.18.5 |
| 77 |
command: Start-Process msiexec.exe -Wait -ArgumentList "/I go1.18.5.windows-amd64.msi /quiet" |
| 78 |
- run: go version |
| 79 |
- run: |
| 80 |
name: build and test |
| 81 |
command: | |
| 82 |
go test -race ./... |