|
1 | 1 | name: CI checks |
2 | 2 |
|
3 | | -on: [push, pull_request] |
| 3 | +on: |
| 4 | + pull_request: |
| 5 | + push: |
| 6 | + branches: main |
4 | 7 |
|
5 | 8 | jobs: |
6 | | - lint: |
7 | | - name: Lint |
8 | | - runs-on: ubuntu-latest |
9 | | - |
| 9 | + test-msrv: |
| 10 | + name: Test MSRV on ${{ matrix.os }} |
| 11 | + runs-on: ${{ matrix.os }} |
| 12 | + strategy: |
| 13 | + matrix: |
| 14 | + os: [ubuntu-latest, windows-latest, macOS-latest] |
10 | 15 | steps: |
11 | | - - uses: actions/checkout@v1 |
12 | | - - uses: actions-rs/toolchain@v1 |
13 | | - with: |
14 | | - toolchain: 1.56.0 |
15 | | - override: true |
16 | | - |
17 | | - # Ensure all code has been formatted with rustfmt |
18 | | - - run: rustup component add rustfmt |
19 | | - - name: Check formatting |
20 | | - uses: actions-rs/cargo@v1 |
21 | | - with: |
22 | | - command: fmt |
23 | | - args: -- --check --color always |
| 16 | + - uses: actions/checkout@v4 |
| 17 | + - name: Run tests |
| 18 | + run: cargo test --verbose --all-features |
| 19 | + - name: Verify working directory is clean |
| 20 | + run: git diff --exit-code |
24 | 21 |
|
25 | | - test: |
26 | | - name: Test on ${{ matrix.os }} |
| 22 | + test-latest: |
| 23 | + name: Test latest on ${{ matrix.os }} |
27 | 24 | runs-on: ${{ matrix.os }} |
28 | 25 | strategy: |
29 | 26 | matrix: |
30 | 27 | os: [ubuntu-latest, windows-latest, macOS-latest] |
31 | | - |
32 | 28 | steps: |
33 | | - - uses: actions/checkout@v1 |
34 | | - - uses: actions-rs/toolchain@v1 |
35 | | - with: |
36 | | - toolchain: 1.56.0 |
37 | | - override: true |
38 | | - - name: cargo fetch |
39 | | - uses: actions-rs/cargo@v1 |
40 | | - with: |
41 | | - command: fetch |
42 | | - - name: Build tests |
43 | | - uses: actions-rs/cargo@v1 |
44 | | - with: |
45 | | - command: build |
46 | | - args: --verbose --release --tests |
| 29 | + - uses: actions/checkout@v4 |
| 30 | + - uses: dtolnay/rust-toolchain@stable |
| 31 | + id: toolchain |
| 32 | + - run: rustup override set ${{steps.toolchain.outputs.name}} |
| 33 | + - name: Remove lockfile to build with latest dependencies |
| 34 | + run: rm Cargo.lock |
47 | 35 | - name: Run tests |
48 | | - uses: actions-rs/cargo@v1 |
49 | | - with: |
50 | | - command: test |
51 | | - args: --verbose --release |
| 36 | + run: cargo test --verbose --all-features |
| 37 | + - name: Verify working directory is clean (excluding lockfile) |
| 38 | + run: git diff --exit-code ':!Cargo.lock' |
52 | 39 |
|
53 | | - no-std: |
54 | | - name: Check no-std compatibility |
| 40 | + build-nodefault: |
| 41 | + name: Build target ${{ matrix.target }} |
55 | 42 | runs-on: ubuntu-latest |
56 | | - |
| 43 | + strategy: |
| 44 | + matrix: |
| 45 | + target: |
| 46 | + - wasm32-wasi |
| 47 | + - thumbv6m-none-eabi |
| 48 | + - thumbv7em-none-eabihf |
57 | 49 | steps: |
58 | | - - uses: actions/checkout@v1 |
59 | | - - uses: actions-rs/toolchain@v1 |
| 50 | + - uses: actions/checkout@v4 |
60 | 51 | with: |
61 | | - toolchain: 1.56.0 |
62 | | - override: true |
63 | | - - run: rustup target add thumbv6m-none-eabi |
64 | | - - name: cargo fetch |
65 | | - uses: actions-rs/cargo@v1 |
66 | | - with: |
67 | | - command: fetch |
68 | | - - name: Build |
69 | | - uses: actions-rs/cargo@v1 |
70 | | - with: |
71 | | - command: build |
72 | | - args: --verbose --target thumbv6m-none-eabi --no-default-features |
| 52 | + path: crate_root |
| 53 | + # We use a synthetic crate to ensure no dev-dependencies are enabled, which can |
| 54 | + # be incompatible with some of these targets. |
| 55 | + - name: Create synthetic crate for testing |
| 56 | + run: cargo init --edition 2021 --lib ci-build |
| 57 | + - name: Copy Rust version into synthetic crate |
| 58 | + run: cp crate_root/rust-toolchain.toml ci-build/ |
| 59 | + - name: Copy patch directives into synthetic crate |
| 60 | + run: | |
| 61 | + echo "[patch.crates-io]" >> ./ci-build/Cargo.toml |
| 62 | + cat ./crate_root/Cargo.toml | sed "0,/.\+\(patch.crates.\+\)/d" >> ./ci-build/Cargo.toml |
| 63 | + - name: Add no_std pragma to lib.rs |
| 64 | + run: | |
| 65 | + echo "#![no_std]" > ./ci-build/src/lib.rs |
| 66 | + - name: Add pairing as a dependency of the synthetic crate |
| 67 | + working-directory: ./ci-build |
| 68 | + # run: cargo add --no-default-features --path ../crate_root |
| 69 | + run: sed -i 's;\[dependencies\];\[dependencies\]\npairing = { path = "../crate_root", default-features = false };g' ./Cargo.toml |
| 70 | + - name: Add target |
| 71 | + working-directory: ./ci-build |
| 72 | + run: rustup target add ${{ matrix.target }} |
| 73 | + - name: Build for target |
| 74 | + working-directory: ./ci-build |
| 75 | + run: cargo build --verbose --target ${{ matrix.target }} |
73 | 76 |
|
74 | 77 | doc-links: |
75 | | - name: Nightly lint |
| 78 | + name: Intra-doc links |
76 | 79 | runs-on: ubuntu-latest |
77 | | - |
78 | 80 | steps: |
79 | | - - uses: actions/checkout@v1 |
80 | | - - uses: actions-rs/toolchain@v1 |
81 | | - with: |
82 | | - toolchain: nightly |
83 | | - override: true |
84 | | - - name: cargo fetch |
85 | | - uses: actions-rs/cargo@v1 |
86 | | - with: |
87 | | - command: fetch |
88 | | - |
89 | | - # Ensure intra-documentation links all resolve correctly |
90 | | - # Requires #![deny(intra_doc_link_resolution_failure)] in crate. |
| 81 | + - uses: actions/checkout@v4 |
| 82 | + - run: cargo fetch |
| 83 | + # Requires #![deny(rustdoc::broken_intra_doc_links)] in crates. |
91 | 84 | - name: Check intra-doc links |
92 | | - uses: actions-rs/cargo@v1 |
93 | | - with: |
94 | | - command: doc |
95 | | - args: --document-private-items |
| 85 | + run: cargo doc --all-features --document-private-items |
| 86 | + |
| 87 | + fmt: |
| 88 | + name: Rustfmt |
| 89 | + runs-on: ubuntu-latest |
| 90 | + steps: |
| 91 | + - uses: actions/checkout@v4 |
| 92 | + - run: cargo fmt -- --check |
0 commit comments