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 COMMON_GO_PACKAGES: > github.com/golang/dep/cmd/dep github.com/jstemmer/go-junit-report GOPRIVATE: github.com/launchdarkly steps: - checkout - run: name: Install go-junit-report command: go install github.com/jstemmer/go-junit-report/v2@v2.0.0 - run: name: Build command: make build - run: name: Build (easyjson implementation) command: make build-easyjson - when: condition: <> steps: - run: name: Lint command: make lint - run: name: Run tests command: | mkdir -p $CIRCLE_TEST_REPORTS mkdir -p $CIRCLE_ARTIFACTS make test | tee $CIRCLE_ARTIFACTS/report.txt - run: name: Run tests (easyjson implementation) command: | mkdir -p $CIRCLE_TEST_REPORTS mkdir -p $CIRCLE_ARTIFACTS make test | tee $CIRCLE_ARTIFACTS/report.txt - run: name: Process test results command: go-junit-report < $CIRCLE_ARTIFACTS/report.txt > $CIRCLE_TEST_REPORTS/junit.xml when: always - 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 GOPRIVATE: github.com/launchdarkly 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: | cd ${env:GOPATH}\src\${env:PACKAGE_PATH} go test -race ./... benchmarks: docker: - image: cimg/go:1.19 environment: CIRCLE_ARTIFACTS: /tmp/circle-artifacts GOPRIVATE: github.com/launchdarkly steps: - checkout - run: name: Run benchmarks command: | mkdir -p $CIRCLE_ARTIFACTS make benchmarks | tee $CIRCLE_ARTIFACTS/benchmarks.txt - run: name: Run benchmarks (easyjson implementation) command: | make benchmarks | tee $CIRCLE_ARTIFACTS/benchmarks-easyjson.txt - store_artifacts: path: /tmp/circle-artifacts