1version: 2.1
2
3jobs:
4  linux:
5    parameters:
6      image:
7        type: string
8    docker:
9      - image: rust:<< parameters.image >>
10    environment:
11      RUST_BACKTRACE: 1
12      RUSTFLAGS: -D warnings
13    steps:
14      - checkout
15      - restore_cache:
16          key: registry
17      - run: cargo generate-lockfile
18      - save_cache:
19          key: registry-{{ .BuildNum }}
20          paths:
21            - /usr/local/cargo/registry/index
22      - restore_cache:
23          key: deps-<< parameters.image >>-{{ checksum "Cargo.lock" }}
24      - run: cargo test
25      - run: rustdoc --test README.md -L target/debug/deps -L target/debug
26      - save_cache:
27          key: deps-<< parameters.image >>-{{ checksum "Cargo.lock" }}
28          paths:
29            - /usr/local/cargo/registry/cache
30            - target
31
32  macos:
33    parameters:
34      version:
35        type: string
36    macos:
37      xcode: "9.0"
38    environment:
39      RUST_BACKTRACE: 1
40      RUSTFLAGS: -D warnings
41    steps:
42      - checkout
43      - run: curl https://sh.rustup.rs -sSf | sh -s -- -y --default-toolchain << parameters.version >>
44      - run: ln -s ~/.cargo/bin/* /usr/local/bin
45      - restore_cache:
46          key: macos-registry
47      - run: cargo generate-lockfile
48      - save_cache:
49          key: macos-registry-{{ .BuildNum }}
50          paths:
51            - ~/.cargo/registry/index
52      - restore_cache:
53          key: macos-deps-<< parameters.version >>
54      - run: cargo test
55      - save_cache:
56          key: macos-deps-<< parameters.version >>
57          paths:
58            - ~/.cargo/registry/cache
59            - target
60
61workflows:
62  test:
63    jobs:
64      - linux:
65          name: openssl
66          image: 1.37.0
67      - macos:
68          version: 1.37.0
69