...
1version: 2.1
2
3workflows:
4 workflow:
5 jobs:
6 - go-test:
7 name: Go 1.19
8 docker-image: cimg/go:1.19
9 run-lint: true # golangci-lint doesn't yet work in Go 1.18
10 - go-test:
11 name: Go 1.18
12 docker-image: cimg/go:1.18
13 - benchmarks
14
15jobs:
16 go-test:
17 parameters:
18 docker-image:
19 type: string
20 run-lint:
21 type: boolean
22 default: false
23 with-coverage:
24 type: boolean
25 default: false
26
27 docker:
28 - image: <<parameters.docker-image>>
29 environment:
30 CIRCLE_TEST_REPORTS: /tmp/circle-reports
31 CIRCLE_ARTIFACTS: /tmp/circle-artifacts
32
33 steps:
34 - checkout
35
36 - run:
37 name: install go-junit-report
38 command: go install github.com/jstemmer/go-junit-report/v2@v2.0.0
39
40 - run:
41 name: build (default implementation)
42 command: make build
43
44 - run:
45 name: build (easyjson implementation)
46 command: make build-easyjson
47
48 - when:
49 condition: <<parameters.run-lint>>
50 steps:
51 - run: make lint
52
53 - run:
54 name: run tests (default implementation)
55 command: |
56 mkdir -p $CIRCLE_TEST_REPORTS
57 mkdir -p $CIRCLE_ARTIFACTS
58 make test | tee $CIRCLE_ARTIFACTS/report.txt
59
60 - run:
61 name: run tests (easyjson implementation)
62 command: |
63 make test-easyjson | tee -a $CIRCLE_ARTIFACTS/report.txt
64
65 - run:
66 name: Process test results
67 command: go-junit-report < $CIRCLE_ARTIFACTS/report.txt > $CIRCLE_TEST_REPORTS/junit.xml
68 when: always
69
70 - when:
71 condition: <<parameters.with-coverage>>
72 steps:
73 - run:
74 name: Verify test coverage
75 command: make test-coverage
76 - run:
77 name: Store coverage results
78 command: cp build/coverage* /tmp/circle-artifacts
79 when: always
80
81 - store_test_results:
82 path: /tmp/circle-reports
83
84 - store_artifacts:
85 path: /tmp/circle-artifacts
86
87 benchmarks:
88 docker:
89 - image: cimg/go:1.19
90 environment:
91 CIRCLE_ARTIFACTS: /tmp/circle-artifacts
92
93 steps:
94 - checkout
95 - run: go build ./...
96 - run:
97 name: run benchmarks (default implementation)
98 command: |
99 mkdir -p $CIRCLE_ARTIFACTS
100 make benchmarks | tee $CIRCLE_ARTIFACTS/benchmarks.txt
101 - run:
102 name: run benchmarks (easyjson implementation)
103 command: make benchmarks-easyjson | tee $CIRCLE_ARTIFACTS/benchmarks-easyjson.txt
104
105 - store_artifacts:
106 path: /tmp/circle-artifacts
View as plain text