...
1version: 2.1
2
3orbs:
4 win: circleci/windows@2.4.0
5
6workflows:
7 workflow:
8 jobs:
9 - go-test:
10 name: Go 1.19
11 docker-image: cimg/go:1.19
12 run-lint: true
13 with-coverage: true
14 - go-test:
15 name: Go 1.18
16 docker-image: cimg/go:1.18
17 - go-test-windows:
18 name: Windows
19 - benchmarks
20
21jobs:
22 go-test:
23 parameters:
24 docker-image:
25 type: string
26 run-lint:
27 type: boolean
28 default: false
29 with-coverage:
30 type: boolean
31 default: false
32 docker:
33 - image: <<parameters.docker-image>>
34 environment:
35 CIRCLE_TEST_REPORTS: /tmp/circle-reports
36 CIRCLE_ARTIFACTS: /tmp/circle-artifacts
37 COMMON_GO_PACKAGES: >
38 github.com/golang/dep/cmd/dep
39 github.com/jstemmer/go-junit-report
40 GOPRIVATE: github.com/launchdarkly
41
42 steps:
43 - checkout
44 - run:
45 name: Install go-junit-report
46 command: go install github.com/jstemmer/go-junit-report/v2@v2.0.0
47
48 - run:
49 name: Build
50 command: make build
51
52 - run:
53 name: Build (easyjson implementation)
54 command: make build-easyjson
55
56 - when:
57 condition: <<parameters.run-lint>>
58 steps:
59 - run:
60 name: Lint
61 command: make lint
62
63 - run:
64 name: Run tests
65 command: |
66 mkdir -p $CIRCLE_TEST_REPORTS
67 mkdir -p $CIRCLE_ARTIFACTS
68 make test | tee $CIRCLE_ARTIFACTS/report.txt
69
70 - run:
71 name: Run tests (easyjson implementation)
72 command: |
73 mkdir -p $CIRCLE_TEST_REPORTS
74 mkdir -p $CIRCLE_ARTIFACTS
75 make test | tee $CIRCLE_ARTIFACTS/report.txt
76
77 - run:
78 name: Process test results
79 command: go-junit-report < $CIRCLE_ARTIFACTS/report.txt > $CIRCLE_TEST_REPORTS/junit.xml
80 when: always
81
82 - when:
83 condition: <<parameters.with-coverage>>
84 steps:
85 - run:
86 name: Verify test coverage
87 command: make test-coverage
88 - run:
89 name: Store coverage results
90 command: cp build/coverage* /tmp/circle-artifacts
91 when: always
92
93 - store_test_results:
94 path: /tmp/circle-reports
95
96 - store_artifacts:
97 path: /tmp/circle-artifacts
98
99 go-test-windows:
100 executor:
101 name: win/default
102 shell: powershell.exe
103
104 environment:
105 GOPATH: C:\Users\VssAdministrator\go
106 GOPRIVATE: github.com/launchdarkly
107
108 steps:
109 - checkout
110 - run:
111 name: download Go 1.18.5
112 command: |
113 $ErrorActionPreference = "Stop"
114 $installerUrl = "https://go.dev/dl/go1.18.5.windows-amd64.msi"
115 (New-Object System.Net.WebClient).DownloadFile($installerUrl, "go1.18.5.windows-amd64.msi")
116 - run:
117 name: install Go 1.18.5
118 command: Start-Process msiexec.exe -Wait -ArgumentList "/I go1.18.5.windows-amd64.msi /quiet"
119 - run: go version
120 - run:
121 name: build and test
122 command: |
123 cd ${env:GOPATH}\src\${env:PACKAGE_PATH}
124 go test -race ./...
125
126 benchmarks:
127 docker:
128 - image: cimg/go:1.19
129 environment:
130 CIRCLE_ARTIFACTS: /tmp/circle-artifacts
131 GOPRIVATE: github.com/launchdarkly
132
133 steps:
134 - checkout
135
136 - run:
137 name: Run benchmarks
138 command: |
139 mkdir -p $CIRCLE_ARTIFACTS
140 make benchmarks | tee $CIRCLE_ARTIFACTS/benchmarks.txt
141 - run:
142 name: Run benchmarks (easyjson implementation)
143 command: |
144 make benchmarks | tee $CIRCLE_ARTIFACTS/benchmarks-easyjson.txt
145
146 - store_artifacts:
147 path: /tmp/circle-artifacts
View as plain text