-
Notifications
You must be signed in to change notification settings - Fork 152
/
config.yml
229 lines (221 loc) · 7.23 KB
/
config.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
version: 2
jobs:
test:
docker:
- image: quay.io/influxdb/flux-build:latest
resource_class: large
environment:
GOCACHE: /tmp/go-cache
GOFLAGS: -p=8
GOPATH: /tmp/go
GO111MODULE: 'on' # must be quoted to force string type instead of boolean type
SCCACHE_CACHE_SIZE: 1G
steps:
- checkout
# Populate GOPATH/pkg.
- restore_cache:
name: Restoring GOPATH/pkg/mod
keys:
- flux-gomod-{{checksum "go.sum"}}
# Populate Rust cache
- restore_cache:
name: Restoring Rust Cache
keys:
- flux-rust-{{ .Branch }}-{{ .Revision }} # Matches when retrying a single run.
- flux-rust-{{ .Branch }}- # Matches a new commit on an existing branch.
- flux-rust- # Matches a new branch.
# Run tests
- run: make checkgenerate
- run: make checkfmt
- run: make checktidy
- run: make checkdocs
- run: make checkrelease
- run: make vet
- run: GOGC=50 make staticcheck
- run: make libflux-wasm
- run: make test GO_TEST_FLAGS='-coverprofile=coverage.txt -covermode=atomic' GO_TAGS=assert
- save_cache:
name: Saving GOPATH/pkg/mod
key: flux-gomod-{{checksum "go.sum"}}
paths:
- /tmp/go/pkg/mod
- save_cache:
name: Saving Rust Cache
key: flux-rust-{{ .Branch }}-{{ .Revision }}
paths:
- "~/.cache/sccache"
when: always
test-race:
docker:
- image: quay.io/influxdb/flux-build:latest
resource_class: large
environment:
GOPATH: /tmp/go
GOFLAGS: -p=8
GO111MODULE: 'on' # must be quoted to force string type instead of boolean type
steps:
- checkout
# Building go with -race does not use the cache
# Populate GOPATH/pkg.
- restore_cache:
name: Restoring GOPATH/pkg/mod
keys:
- flux-gomod-{{checksum "go.sum"}}
# Run tests
- run: make test-race GO_TAGS=assert
# No need to save the pkg/mod cache since the other job does it
test-bench:
docker:
- image: quay.io/influxdb/flux-build:latest
environment:
GOPATH: /tmp/go
GOFLAGS: -p=1
GO111MODULE: 'on' # must be quoted to force string type instead of boolean type
steps:
- checkout
- restore_cache:
name: Restoring GOPATH/pkg/mod
keys:
- flux-gomod-{{checksum "go.sum"}}
# Run tests
- run:
command: make test-bench
no_output_timeout: 20m
# No need to save the pkg/mod cache since the other job does it
test-build-reproducibility:
docker:
- image: quay.io/influxdb/flux-build:latest
steps:
- checkout
- run: make checkreproducibility
test-valgrind:
docker:
- image: quay.io/influxdb/flux-build:latest
steps:
- checkout
- run: make test-valgrind
build-windows:
machine:
image: windows-server-2019-vs2019:stable
resource_class: windows.medium
shell: bash.exe -eo pipefail
steps:
- run:
name: Install system dependencies
command: |
choco install git
git clone https://github.com/influxdata/rustup.install.git "${TMP}/rustup.install"
cd "${TMP}/rustup.install"
git checkout bump-v1.25.1
choco pack --pre ./rustup.install.nuspec
choco install rustup.install --source="C:\Users\circleci\AppData\Local\Temp\rustup.install"
cd -
choco upgrade golang --version=1.21 --allow-downgrade
choco install \
grep \
llvm \
pkgconfiglite
# rustc depends on a version of libgcc_eh that isn't present in the latest mingw.
choco install mingw --version=8.1.0
echo 'export PATH="${HOME}/.cargo/bin:/c/Program Files/Go/bin:${PATH}"' >> $BASH_ENV
- checkout
- run:
name: Pin rust version and install mingw rustup target
command: |
RUST_VERSION=$(sed -E -ne 's/channel = "(.*)"/\1/p' rust-toolchain.toml)
if [ -z "$RUST_VERSION" ]; then
echo "Error: couldn't parse Rust version from rust-toolchain.toml!"
exit 1
fi
rustup default ${RUST_VERSION}
rustup target add x86_64-pc-windows-gnu
# Cargo's built-in support for fetching dependencies from GitHub requires
# an ssh agent to be set up, which doesn't work on Circle's Windows executors.
# See https://github.com/rust-lang/cargo/issues/1851#issuecomment-450130685
cat <<EOF >> ~/.cargo/config
[net]
git-fetch-with-cli = true
EOF
- run:
name: Install pkg-config wrapper
command: |
export GOPATH="${HOME}/go"
echo "export GOPATH='${GOPATH}'" >> $BASH_ENV
mkdir -p "${GOPATH}/bin"
echo 'export PATH="${GOPATH}/bin:${PATH}"' >> $BASH_ENV
go install github.com/influxdata/pkg-config
- run:
name: Generate libflux
command: go generate ./libflux/go/libflux
- run:
name: Build flux
no_output_timeout: 20m
command: go build ./...
release:
docker:
- image: quay.io/influxdb/flux-build:latest
environment:
GOCACHE: /tmp/go-cache
GOFLAGS: -p=8
GOPATH: /tmp/go
GO111MODULE: 'on' # must be quoted to force string type instead of boolean type
steps:
- checkout
- run:
name: Generate changelog
command: |
./gotool.sh github.com/influxdata/changelog generate \
--version $CIRCLE_TAG \
--commit-url https://github.com/influxdata/flux/commit \
-o release-notes.txt
- run:
name: Install pkg-config
command: go build -o /go/bin/pkg-config github.com/influxdata/pkg-config
# Make the flux documentation JSON archives to add to the release
- run: make fluxdocs
- run:
# Parallelism for goreleaser must be set to 1 so it doesn't
# attempt to invoke pkg-config, which invokes cargo,
# for multiple targets at the same time.
name: Perform release
command: |
./gotool.sh github.com/goreleaser/goreleaser release \
--rm-dist -p 1 --release-notes release-notes.txt
build-ci-image:
machine:
image: ubuntu-2204:current
resource_class: medium
steps:
- checkout
- run:
name: Build docker image
command: ./etc/build-ci-image.sh
- run:
name: Publish docker image
command: ./etc/publish-ci-image.sh
workflows:
version: 2
build-and-test:
jobs:
- test
- test-race
- test-bench
- test-build-reproducibility
- test-valgrind
- build-windows
release:
jobs:
- release:
filters:
tags:
only: /^v\d\.\d+\.\d+$/
branches:
ignore: /.*/
image:
jobs:
- build-ci-image:
filters:
branches:
only:
- master
- /^ci\/.*/