• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1version: 2
2
3jobs:
4  build:
5    docker:
6      - image: circleci/rust:latest
7    steps:
8      - checkout
9      - run:
10          name: Setup Rust
11          command: |
12            rustup toolchain uninstall nightly
13            rustup toolchain install nightly -c miri rust-src rustfmt
14      - run:
15          name: Version information
16          command: |
17            rustc --version
18            cargo --version
19            rustc +nightly --version
20            cargo +nightly --version
21            rustup --version
22      - run:
23          name: Calculate dependencies
24          command: cargo generate-lockfile
25      - restore_cache:
26          keys:
27            - cargo-cache-{{ arch }}-{{ checksum "Cargo.lock" }}
28      - run:
29          name: Check Formatting
30          command: |
31            rustfmt --version
32            cargo fmt --all -- --check --color=auto
33      - run:
34          name: Build all targets
35          command: cargo build --all --all-targets
36      - run:
37          name: Run all tests
38          command: cargo test --all
39      - run:
40          name: Run all tests under miri
41          command: |
42            cargo +nightly miri test
43      - run:
44          name: Run all tests under sanitizers
45          command: |
46            RUSTFLAGS="-Z sanitizer=address" cargo +nightly -Z build-std test --target x86_64-unknown-linux-gnu
47            RUSTFLAGS="-Z sanitizer=leak" cargo +nightly test -Z build-std --target x86_64-unknown-linux-gnu
48            RUSTFLAGS="-Z sanitizer=memory" cargo +nightly test -Z build-std --target x86_64-unknown-linux-gnu
49      - save_cache:
50          paths:
51            - /usr/local/cargo/registry
52            - target/debug/.fingerprint
53            - target/debug/build
54            - target/debug/deps
55          key: cargo-cache-{{ arch }}-{{ checksum "Cargo.lock" }}
56