version: 2.1 workflows: workflow: jobs: - go-test: name: Go 1.19 docker-image: cimg/go:1.19 run-lint: true # golangci-lint doesn't yet work in Go 1.18 - go-test: name: Go 1.18 docker-image: cimg/go:1.18 - 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 steps: - checkout - run: name: install go-junit-report command: go install github.com/jstemmer/go-junit-report/v2@v2.0.0 - run: name: build (default implementation) command: make build - run: name: build (easyjson implementation) command: make build-easyjson - when: condition: <> steps: - run: make lint - run: name: run tests (default implementation) command: | mkdir -p $CIRCLE_TEST_REPORTS mkdir -p $CIRCLE_ARTIFACTS make test | tee $CIRCLE_ARTIFACTS/report.txt - run: name: run tests (easyjson implementation) command: | make test-easyjson | tee -a $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 benchmarks: docker: - image: cimg/go:1.19 environment: CIRCLE_ARTIFACTS: /tmp/circle-artifacts steps: - checkout - run: go build ./... - run: name: run benchmarks (default implementation) command: | mkdir -p $CIRCLE_ARTIFACTS make benchmarks | tee $CIRCLE_ARTIFACTS/benchmarks.txt - run: name: run benchmarks (easyjson implementation) command: make benchmarks-easyjson | tee $CIRCLE_ARTIFACTS/benchmarks-easyjson.txt - store_artifacts: path: /tmp/circle-artifacts