version: 2.1 orbs: win: circleci/windows@1.0.0 workflows: workflow: jobs: - go-test: name: Go 1.19 docker-image: cimg/go:1.19 with-coverage: true run-lint: true - go-test: name: Go 1.18 docker-image: cimg/go:1.18 - go-test-windows: name: Windows go-version: "1.18.5" 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 - image: redis steps: - checkout - run: name: install go-junit-report command: go install github.com/jstemmer/go-junit-report@latest - when: condition: <> steps: - run: make lint - run: name: Build command: make - run: name: Run tests command: | mkdir -p $CIRCLE_TEST_REPORTS mkdir -p $CIRCLE_ARTIFACTS make test | tee $CIRCLE_ARTIFACTS/report.txt - when: condition: <> steps: - run: name: Make coverage report command: | make test-coverage || true - run: name: Store coverage results command: cp build/coverage* /tmp/circle-artifacts when: always - run: name: Process test results command: go-junit-report < $CIRCLE_ARTIFACTS/report.txt > $CIRCLE_TEST_REPORTS/junit.xml when: always - store_test_results: path: /tmp/circle-reports - store_artifacts: path: /tmp/circle-artifacts go-test-windows: executor: name: win/vs2019 shell: powershell.exe parameters: go-version: type: string environment: GOPATH: C:\Users\VssAdministrator\go steps: - checkout - run: name: download Go <> command: | $ErrorActionPreference = "Stop" $installerUrl = "https://go.dev/dl/go<>.windows-amd64.msi" (New-Object System.Net.WebClient).DownloadFile($installerUrl, "go<>.windows-amd64.msi") - run: name: install Go <> command: Start-Process msiexec.exe -Wait -ArgumentList "/I go<>.windows-amd64.msi /quiet" - run: go version - run: name: setup Redis command: | $ProgressPreference = "SilentlyContinue" iwr -outf redis.zip https://github.com/MicrosoftArchive/redis/releases/download/win-3.0.504/Redis-x64-3.0.504.zip mkdir redis Expand-Archive -Path redis.zip -DestinationPath redis cd redis ./redis-server --service-install ./redis-server --service-start - run: name: build and test command: | cd ${env:GOPATH}\src\${env:PACKAGE_PATH} go test -race ./...