• 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          - stable
37          - beta
38          - nightly
39    steps:
40      - uses: actions/checkout@v2
41      - uses: actions-rs/toolchain@v1
42        with:
43          toolchain: ${{ matrix.rust }}
44          override: true
45      - name: Run cargo test
46        # Exclude doctests here, as we don't want to clutter docs themselves
47        # with backwards compatibility workarounds.
48        run: cargo test --lib
49
50  nightly:
51    name: Test Suite (nightly features)
52    runs-on: ubuntu-latest
53    steps:
54      - uses: actions/checkout@v2
55      - uses: actions-rs/toolchain@v1
56        with:
57          toolchain: nightly
58          override: true
59      - name: Run cargo test
60        # `--lib` prevents doctests from being run.
61        # This is due to `unstable_const` requiring extra `feature(...)` directives
62        # which the doctests do not have.
63        run: cargo test --all-features --lib
64
65  miri:
66    name: Test Suite (Miri)
67    runs-on: ubuntu-latest
68    steps:
69      - uses: actions/checkout@v2
70      - name: Install Miri
71        run: |
72          rustup toolchain install nightly --component miri
73          rustup override set nightly
74          cargo miri setup
75      - name: Test with Miri
76        run: |
77          cargo miri test
78          cargo miri test --all-features
79
80  style:
81    name: lints and formatting
82    runs-on: ubuntu-latest
83    steps:
84      - uses: actions/checkout@v2
85      - uses: actions-rs/toolchain@v1
86        with:
87            toolchain: 1.51.0 # pin a version for reproducible results
88            components: rustfmt
89            override: true
90      - name: Check warnings
91        run: RUSTFLAGS="-D warnings" cargo check --all-targets
92      - name: Check formatting
93        run: cargo fmt -- --check
94