|
| 1 | +version: '2.1' |
| 2 | + |
| 3 | +workflows: |
| 4 | + version: 2 |
| 5 | + build: |
| 6 | + jobs: |
| 7 | + - build: |
| 8 | + matrix: |
| 9 | + parameters: |
| 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.42.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 |
| 20 | + ] |
| 21 | + |
| 22 | +jobs: |
| 23 | + build: |
| 24 | + parameters: |
| 25 | + rust_img: |
| 26 | + type: string |
| 27 | + docker: |
| 28 | + - image: << parameters.rust_img >> |
| 29 | + steps: |
| 30 | + - checkout |
| 31 | + - restore_cache: |
| 32 | + key: project-cache-v2-<< parameters.rust_img >>-{{ checksum "Cargo.toml" }} |
| 33 | + # enable once the rest of circle ci is up and running |
| 34 | +# - run: |
| 35 | +# name: Check formatting |
| 36 | +# command: cargo fmt -- --check |
| 37 | + - run: |
| 38 | + name: Add arm toolchain |
| 39 | + command: rustup target add thumbv6m-none-eabi |
| 40 | + - run: |
| 41 | + name: Build all targets |
| 42 | + command: cargo build --all-targets |
| 43 | + - run: |
| 44 | + name: Build without default features |
| 45 | + command: cargo build --no-default-features |
| 46 | + - run: |
| 47 | + name: Build with only alloc |
| 48 | + command: cargo build --no-default-features --features alloc |
| 49 | + - run: |
| 50 | + name: Build ARM without default features (no_std) |
| 51 | + command: cargo build --target thumbv6m-none-eabi --no-default-features |
| 52 | + - run: |
| 53 | + name: Build ARM with only alloc feature |
| 54 | + command: cargo build --target thumbv6m-none-eabi --no-default-features --features alloc |
| 55 | + - run: |
| 56 | + name: Run tests |
| 57 | + command: cargo test --verbose |
| 58 | + - run: |
| 59 | + name: Build docs |
| 60 | + command: cargo doc --verbose |
| 61 | + - run: |
| 62 | + name: Confirm a fuzzer can run |
| 63 | + # TERM=dumb prevents cargo fuzz list from printing with color |
| 64 | + environment: |
| 65 | + TERM: dumb |
| 66 | + command: | |
| 67 | + if [[ '<< parameters.rust_img >>' = 'rustlang/rust:nightly' ]] |
| 68 | + then |
| 69 | + cargo +nightly install cargo-fuzz |
| 70 | + cargo fuzz list | xargs -L 1 -I FUZZER cargo fuzz run FUZZER -- -max_total_time=1 |
| 71 | + fi |
| 72 | +
|
| 73 | + - save_cache: |
| 74 | + key: project-cache-v2-<< parameters.rust_img >>-{{ checksum "Cargo.toml" }} |
| 75 | + paths: |
| 76 | + # rust docker img doesn't use $HOME/[.cargo,.rustup] |
| 77 | + - /usr/local/cargo |
| 78 | + - /usr/local/rustup |
| 79 | + - ./target |
0 commit comments