@@ -3,11 +3,12 @@ version: 2.1
3
3
orbs :
4
4
docker-buildx :
sensu/[email protected]
5
5
aws-ecr :
circleci/[email protected]
6
+
6
7
7
8
executors :
8
9
docker-rust :
9
10
docker :
10
- - image : cimg/rust:1.63 .0
11
+ - image : cimg/rust:1.65 .0
11
12
image-ubuntu :
12
13
machine :
13
14
image : ubuntu-2204:2022.04.1
@@ -89,6 +90,7 @@ commands:
89
90
shuttle-persist = { path = "$PWD/resources/persist" }
90
91
shuttle-shared-db = { path = "$PWD/resources/shared-db" }
91
92
shuttle-secrets = { path = "$PWD/resources/secrets" }
93
+ shuttle-static-folder = { path = "$PWD/resources/static-folder" }
92
94
EOF
93
95
install-rust :
94
96
steps :
@@ -106,6 +108,29 @@ commands:
106
108
sudo unzip -o protoc-21.9-linux-x86_64.zip -d /usr bin/protoc &&\
107
109
sudo unzip -o protoc-21.9-linux-x86_64.zip -d /usr/ 'include/*' &&\
108
110
rm -f protoc-21.9-linux-x86_64.zip
111
+ make-artifact :
112
+ parameters :
113
+ target :
114
+ description : " Rust target to put in artifact"
115
+ type : string
116
+ suffix :
117
+ description : " Suffix that is on the binary"
118
+ type : string
119
+ default : " "
120
+ steps :
121
+ - run :
122
+ name : Make artifact
123
+ command : |
124
+ mkdir shuttle
125
+ mv target/<< parameters.target >>/release/cargo-shuttle<< parameters.suffix >> shuttle/cargo-shuttle<< parameters.suffix >>
126
+ mv LICENSE shuttle/
127
+ mv README.md shuttle/
128
+ mkdir artifacts
129
+ tar -cvzf artifacts/cargo-shuttle-${CIRCLE_TAG}-<< parameters.target >>.tar.gz shuttle
130
+ - persist_to_workspace :
131
+ root : artifacts
132
+ paths :
133
+ - cargo-shuttle-${CIRCLE_TAG}-<< parameters.target >>.tar.gz
109
134
110
135
jobs :
111
136
workspace-fmt :
@@ -116,7 +141,9 @@ jobs:
116
141
- install-protoc
117
142
- run : cargo fmt --all --check
118
143
- run : cargo install cargo-sort
119
- - run : cargo sort --check --workspace
144
+ # TODO: this is incompatible with workspace inheritance, uncomment when
145
+ # https://github.com/DevinR528/cargo-sort/pull/29 is merged
146
+ # - run: cargo sort --check --workspace
120
147
- run : cargo check --workspace --all-targets
121
148
- save-cargo-cache
122
149
workspace-clippy :
@@ -151,7 +178,9 @@ jobs:
151
178
- apply-patches
152
179
- run : cargo fmt --all --check --manifest-path << parameters.path >>/Cargo.toml
153
180
- run : cargo install cargo-sort
154
- - run : cargo sort --check << parameters.path >>
181
+ # TODO: this is incompatible with workspace inheritance, uncomment when
182
+ # https://github.com/DevinR528/cargo-sort/pull/29 is merged
183
+ # - run: cargo sort --check << parameters.path >>
155
184
- run : |
156
185
cargo clippy --tests \
157
186
--all-targets \
@@ -186,7 +215,10 @@ jobs:
186
215
executor : image-ubuntu
187
216
steps :
188
217
- install-rust
218
+ - install-protoc
189
219
- checkout
220
+ - run : git submodule sync
221
+ - run : git submodule update --init
190
222
- restore-cargo-cache
191
223
- apply-patches
192
224
- run :
@@ -205,6 +237,8 @@ jobs:
205
237
steps :
206
238
- install-rust
207
239
- checkout
240
+ - run : git submodule sync
241
+ - run : git submodule update --init
208
242
- restore-buildx-cache
209
243
- run :
210
244
name : Make images for tests
@@ -244,6 +278,89 @@ jobs:
244
278
command : |
245
279
PUSH=true PLATFORMS=linux/amd64 make images
246
280
- save-buildx-cache
281
+ build-binaries-linux :
282
+ machine :
283
+ image : << parameters.image >>
284
+ resource_class : << parameters.resource_class >>
285
+ parameters :
286
+ target :
287
+ description : " Linux target to build for"
288
+ type : string
289
+ image :
290
+ description : " Machine image to use"
291
+ type : string
292
+ resource_class :
293
+ description : " The resource type to use for the machine"
294
+ type : string
295
+ steps :
296
+ - checkout
297
+ - run : sudo apt update && sudo DEBIAN_FRONTEND=noninteractive apt install -y libssl-dev musl-tools clang
298
+ - run :
299
+ name : Install Rust
300
+ command : curl --proto '=https' --tlsv1.3 https://sh.rustup.rs -sSf | bash -s -- -y --default-toolchain 1.65.0 --target << parameters.target >>
301
+ - run :
302
+ name : Build
303
+ command : |
304
+ # From https://github.com/briansmith/ring/issues/1414#issuecomment-1055177218
305
+ export CC_aarch64_unknown_linux_musl=clang
306
+ # "vendored-openssl" is from https://github.com/cross-rs/cross/issues/229#issuecomment-597898074
307
+ cargo build --release --package cargo-shuttle --features vendored-openssl --target << parameters.target >>
308
+ - make-artifact :
309
+ target : << parameters.target >>
310
+ build-binaries-windows :
311
+ executor :
312
+ name : win/server-2022
313
+ size : medium
314
+ environment :
315
+ CARGO_NET_GIT_FETCH_WITH_CLI : " true"
316
+ steps :
317
+ - checkout
318
+ - run : choco install -y strawberryperl
319
+ - run :
320
+ name : Install Rust
321
+ command : |
322
+ wget -OutFile "C:\rustup-init.exe" https://static.rust-lang.org/rustup/dist/x86_64-pc-windows-msvc/rustup-init.exe
323
+ C:\rustup-init.exe -y --default-toolchain 1.65.0 --target x86_64-pc-windows-msvc
324
+ - run :
325
+ name : Build
326
+ command : |
327
+ # From https://github.com/alexcrichton/openssl-src-rs/issues/45
328
+ # Because of https://github.com/openssl/openssl/issues/9048
329
+ $env:OPENSSL_SRC_PERL="C:\Strawberry\perl\bin\perl.exe"
330
+ # "vendored-openssl" is from https://github.com/cross-rs/cross/issues/229#issuecomment-597898074
331
+ ..\.cargo\bin\cargo.exe build --release --package cargo-shuttle --features vendored-openssl --target x86_64-pc-windows-msvc
332
+ - make-artifact :
333
+ target : x86_64-pc-windows-msvc
334
+ suffix : " .exe"
335
+ build-binaries-mac :
336
+ macos :
337
+ xcode : 12.5.1
338
+ resource_class : medium
339
+ steps :
340
+ - checkout
341
+ - run :
342
+ name : Install Rust
343
+ command : curl --proto '=https' https://sh.rustup.rs -sSf | bash -s -- -y --default-toolchain 1.65.0 --target x86_64-apple-darwin
344
+ - run :
345
+ name : Build
346
+ command : |
347
+ # "vendored-openssl" is from https://github.com/cross-rs/cross/issues/229#issuecomment-597898074
348
+ cargo build --release --package cargo-shuttle --features vendored-openssl --target x86_64-apple-darwin
349
+ - make-artifact :
350
+ target : x86_64-apple-darwin
351
+ publish-github-release :
352
+ docker :
353
+ - image : cimg/go:1.19.3
354
+ steps :
355
+ - attach_workspace :
356
+ at : artifacts
357
+ - run :
358
+ name : " Publish Release on GitHub"
359
+ environment :
360
+ GITHUB_TOKEN : $GITHUB_TOKEN
361
+ command : |
362
+ go install github.com/tcnksm/[email protected]
363
+ ghr -u ${CIRCLE_PROJECT_USERNAME} -r ${CIRCLE_PROJECT_REPONAME} -c ${CIRCLE_SHA1} -delete -draft ${CIRCLE_TAG} artifacts/
247
364
248
365
workflows :
249
366
version : 2
@@ -256,33 +373,16 @@ workflows:
256
373
- workspace-fmt
257
374
matrix :
258
375
parameters :
259
- framework : ["web-axum", "web-rocket", "web-poem", "web-thruster", "web-tide", "web-tower","web-warp", "web-salvo", "bot-serenity"]
376
+ framework : ["web-actix-web", "web- axum", "web-rocket", "web-poem", "web-thruster", "web-tide", "web-tower","web-warp", "web-salvo", "bot-serenity"]
260
377
- check-standalone :
261
378
matrix :
262
379
parameters :
263
380
path :
264
- - examples/axum/hello-world
265
- - examples/axum/websocket
266
- - examples/poem/hello-world
267
- - examples/poem/mongodb
268
- - examples/poem/postgres
269
- - examples/rocket/authentication
270
- - examples/rocket/hello-world
271
- - examples/rocket/postgres
272
- - examples/rocket/url-shortener
273
- - examples/thruster/hello-world
274
- - examples/thruster/postgres
275
- - examples/salvo/hello-world
276
- - examples/serenity/hello-world
277
- - examples/serenity/postgres
278
- - examples/tide/hello-world
279
- - examples/tide/postgres
280
- - examples/tower/hello-world
281
-
282
381
- resources/aws-rds
283
382
- resources/persist
284
383
- resources/secrets
285
384
- resources/shared-db
385
+ - resources/static-folder
286
386
- service-test :
287
387
requires :
288
388
- workspace-clippy
@@ -297,9 +397,55 @@ workflows:
297
397
- service-test
298
398
- platform-test
299
399
- check-standalone
400
+ filters :
401
+ branches :
402
+ only : production
300
403
- build-and-push :
301
404
requires :
302
405
- e2e-test
303
406
filters :
304
407
branches :
305
- only : main
408
+ only : production
409
+ - build-binaries-linux :
410
+ name : build-binaries-x86_64
411
+ image : ubuntu-2204:2022.04.1
412
+ target : x86_64-unknown-linux-musl
413
+ resource_class : medium
414
+ filters :
415
+ tags :
416
+ only : /^v.*/
417
+ branches :
418
+ only : production
419
+ - build-binaries-linux :
420
+ name : build-binaries-aarch64
421
+ image : ubuntu-2004:202101-01
422
+ target : aarch64-unknown-linux-musl
423
+ resource_class : arm.medium
424
+ filters :
425
+ tags :
426
+ only : /^v.*/
427
+ branches :
428
+ only : production
429
+ - build-binaries-windows :
430
+ filters :
431
+ tags :
432
+ only : /^v.*/
433
+ branches :
434
+ only : production
435
+ - build-binaries-mac :
436
+ filters :
437
+ tags :
438
+ only : /^v.*/
439
+ branches :
440
+ only : production
441
+ - publish-github-release :
442
+ requires :
443
+ - build-binaries-x86_64
444
+ - build-binaries-aarch64
445
+ - build-binaries-windows
446
+ - build-binaries-mac
447
+ filters :
448
+ tags :
449
+ only : /^v.*/
450
+ branches :
451
+ only : production
0 commit comments