version: 2.1 orbs: win: circleci/windows@2.4.0 workflows: workflow: jobs: - go-test: name: Go 1.19 docker-image: cimg/go:1.19 run-lint: true with-coverage: true - go-test: name: Go 1.18 docker-image: cimg/go:1.18 - go-test-windows: name: Windows - benchmarks jobs: go-test: parameters: docker-image: type: string run-lint: type: boolean default: false with-coverage: type: boolean default: false docker: - image: <> environment: CIRCLE_TEST_REPORTS: /tmp/circle-reports CIRCLE_ARTIFACTS: /tmp/circle-artifacts GOPRIVATE: github.com/launchdarkly/*-private steps: - checkout - run: name: install go-junit-report command: go install github.com/jstemmer/go-junit-report/v2@v2.0.0 - run: go build ./... - when: condition: <> steps: - run: make lint - run: name: Run tests command: | mkdir -p $CIRCLE_TEST_REPORTS mkdir -p $CIRCLE_ARTIFACTS trap "go-junit-report < $CIRCLE_ARTIFACTS/report.txt > $CIRCLE_TEST_REPORTS/junit.xml" EXIT make test | tee $CIRCLE_ARTIFACTS/report.txt - when: condition: <> steps: - run: name: Verify test coverage command: make test-coverage - run: name: Store coverage results command: cp build/coverage* /tmp/circle-artifacts when: always - store_test_results: path: /tmp/circle-reports - store_artifacts: path: /tmp/circle-artifacts go-test-windows: executor: name: win/default shell: powershell.exe environment: GOPATH: C:\Users\VssAdministrator\go steps: - checkout - run: name: download Go 1.18.5 command: | $ErrorActionPreference = "Stop" $installerUrl = "https://go.dev/dl/go1.18.5.windows-amd64.msi" (New-Object System.Net.WebClient).DownloadFile($installerUrl, "go1.18.5.windows-amd64.msi") - run: name: install Go 1.18.5 command: Start-Process msiexec.exe -Wait -ArgumentList "/I go1.18.5.windows-amd64.msi /quiet" - run: go version - run: name: build and test command: | go test -race ./... benchmarks: docker: - image: cimg/go:1.19 environment: CIRCLE_ARTIFACTS: /tmp/circle-artifacts steps: - checkout - run: go build ./... - run: name: Run benchmarks command: | mkdir -p $CIRCLE_ARTIFACTS make benchmarks | tee $CIRCLE_ARTIFACTS/benchmarks.txt - store_artifacts: path: /tmp/circle-artifacts