@@ -8,36 +8,51 @@ workflows:
8
8
matrix :
9
9
parameters :
10
10
rust_img : [
11
- # The default rust images (not -slim or -alpine) are based on buildpack-deps. Hopefully this will
12
- # be easier on the CI hosts since presumably those fat lower layers will already be cached, and
13
- # therefore faster than a minimal, customized alpine.
14
- # MSRV
15
- ' rust:1.47.0' ,
16
- # stable
17
- ' rust:latest' ,
18
- ' rustlang/rust:nightly'
19
- # would be nice to have beta as well: https://github.com/rust-lang/docker-rust/issues/14
11
+ # Yes, a single-parameter axis, but means it can be referred to as a cache parameter easily without
12
+ # duplicating the magic version number throughout this file.
13
+ # The default rust images (not -slim or -alpine) are based on buildpack-deps. Hopefully this will
14
+ # be easier on the CI hosts since presumably those fat lower layers will already be cached, and
15
+ # therefore faster than a minimal, customized alpine.
16
+ # MSRV
17
+ ' rust:1.47.0'
18
+ ]
19
+ # a hacky scheme to work around CircleCI's inability to deal with mutable docker tags, forcing us to
20
+ # get a nightly or stable toolchain via rustup instead of a mutable docker tag
21
+ toolchain_override : [
22
+ ' __msrv__' , # won't add any other toolchains, just uses what's in the docker image
23
+ ' stable' ,
24
+ ' nightly'
20
25
]
21
26
22
27
jobs :
23
28
build :
24
29
parameters :
25
30
rust_img :
26
31
type : string
32
+ toolchain_override :
33
+ type : string
27
34
docker :
28
35
- image : << parameters.rust_img >>
29
36
steps :
30
37
- checkout
31
38
- restore_cache :
32
- key : project-cache-v3-<< parameters.rust_img >>-{{ checksum "Cargo.toml" }}
39
+ key : project-cache-v5-<< parameters.rust_img >>-<< parameters.toolchain_override >>-{{ checksum "Cargo.toml" }}
40
+ - run :
41
+ name : Setup toolchain
42
+ command : |
43
+ if [[ '<< parameters.toolchain_override >>' != '__msrv__' ]]
44
+ then
45
+ rustup toolchain add '<< parameters.toolchain_override >>'
46
+ rustup default '<< parameters.toolchain_override >>'
47
+ fi
48
+ - run :
49
+ name : Log rustc version
50
+ command : rustc --version
33
51
- run :
34
52
name : Check formatting
35
53
command : |
36
54
rustup component add rustfmt
37
55
cargo fmt -- --check
38
- - run :
39
- name : Add arm toolchain
40
- command : rustup target add thumbv6m-none-eabi
41
56
- run :
42
57
name : Build all targets
43
58
command : cargo build --all-targets
47
62
- run :
48
63
name : Build with only alloc
49
64
command : cargo build --no-default-features --features alloc
65
+ - run :
66
+ name : Add arm toolchain
67
+ command : rustup target add thumbv6m-none-eabi
50
68
- run :
51
69
name : Build ARM without default features (no_std)
52
70
command : cargo build --target thumbv6m-none-eabi --no-default-features
@@ -60,19 +78,19 @@ jobs:
60
78
name : Build docs
61
79
command : cargo doc --verbose
62
80
- run :
63
- name : Confirm a fuzzer can run
81
+ name : Confirm fuzzers can run
64
82
# TERM=dumb prevents cargo fuzz list from printing with color
65
83
environment :
66
84
TERM : dumb
67
85
command : |
68
- if [[ '<< parameters.rust_img >>' = 'rustlang/rust: nightly' ]]
86
+ if [[ '<< parameters.toolchain_override >>' = 'nightly' ]]
69
87
then
70
88
cargo install cargo-fuzz
71
89
cargo fuzz list | xargs -I FUZZER cargo fuzz run FUZZER -- -max_total_time=1
72
90
fi
73
91
74
92
- save_cache :
75
- key : project-cache-v3 -<< parameters.rust_img >>-{{ checksum "Cargo.toml" }}
93
+ key : project-cache-v5 -<< parameters.rust_img >>-<< parameters.toolchain_override >>-{{ checksum "Cargo.toml" }}
76
94
paths :
77
95
# rust docker img doesn't use $HOME/[.cargo,.rustup]
78
96
- /usr/local/cargo
0 commit comments