• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1name: CI
2
3on: [push, pull_request]
4
5jobs:
6  test:
7    name: Test Suite
8    runs-on: ubuntu-latest
9    strategy:
10      matrix:
11        rust:
12          - stable
13          - beta
14          - nightly
15    steps:
16      - uses: actions/checkout@v2
17      - uses: actions-rs/toolchain@v1
18        with:
19          toolchain: ${{ matrix.rust }}
20          override: true
21      - name: Run cargo test
22        run: cargo test
23
24  test-msrv:
25    name: Test Suite
26    runs-on: ubuntu-latest
27    strategy:
28      matrix:
29        rust:
30          - 1.19.0  # Oldest supported (first version with numeric fields in struct patterns)
31          - 1.20.0  # Oldest supported with tuple_ty
32          - 1.31.0  # Oldest supported with allow(clippy)
33          - 1.36.0  # Oldest supported with MaybeUninit
34          - 1.40.0  # Oldest supported with cfg(doctest)
35          - 1.51.0  # Oldest supported with ptr::addr_of!
36          - 1.65.0  # Oldest supported with stable const evaluation (sans cell)
37          - stable
38          - beta
39          - nightly
40    steps:
41      - uses: actions/checkout@v2
42      - uses: actions-rs/toolchain@v1
43        with:
44          toolchain: ${{ matrix.rust }}
45          override: true
46      - name: Run cargo test
47        # Exclude doctests here, as we don't want to clutter docs themselves
48        # with backwards compatibility workarounds.
49        run: cargo test --lib
50
51  nightly:
52    name: Test Suite (nightly features)
53    runs-on: ubuntu-latest
54    steps:
55      - uses: actions/checkout@v2
56      - uses: actions-rs/toolchain@v1
57        with:
58          toolchain: nightly
59          override: true
60      - name: Run cargo test
61        # `--lib` prevents doctests from being run.
62        # This is due to `unstable_const` requiring extra `feature(...)` directives
63        # which the doctests do not have.
64        run: cargo test --all-features --lib
65
66  miri:
67    name: Test Suite (Miri)
68    runs-on: ubuntu-latest
69    steps:
70      - uses: actions/checkout@v2
71      - name: Install Miri
72        run: |
73          rustup toolchain install nightly --component miri
74          rustup override set nightly
75          cargo miri setup
76      - name: Test with Miri
77        run: |
78          cargo miri test
79          cargo miri test --all-features
80
81  style:
82    name: lints and formatting
83    runs-on: ubuntu-latest
84    steps:
85      - uses: actions/checkout@v2
86      - uses: actions-rs/toolchain@v1
87        with:
88            toolchain: 1.51.0 # pin a version for reproducible results
89            components: rustfmt
90            override: true
91      - name: Check warnings
92        run: RUSTFLAGS="-D warnings" cargo check --all-targets
93      - name: Check formatting
94        run: cargo fmt -- --check
95