|
1 | 1 | name: build |
| 2 | + |
2 | 3 | # This should ensure that the workflow won't run on `dev-*` branches, but will |
3 | | -# otherwise execute on any other branch and any pull request (including dev |
4 | | -# branches). |
| 4 | +# otherwise execute on any other branch and any pull request (including PRs |
| 5 | +# from dev branches). |
5 | 6 | on: |
6 | 7 | push: |
7 | 8 | branches-ignore: |
|
16 | 17 | # Make sure to update this from time to time. |
17 | 18 | RUST_VERSION: "1.77.0" |
18 | 19 | jobs: |
19 | | - # Check formatting |
| 20 | + # Checks syntax formatting. |
20 | 21 | fmt: |
21 | 22 | name: Rustfmt |
22 | 23 | runs-on: ubuntu-latest |
23 | 24 | env: |
24 | 25 | RUSTFLAGS: "-D warnings" |
25 | 26 | steps: |
26 | | - - name: Checkout. |
27 | | - uses: actions/checkout@v3 |
28 | | - - name: Install Rust toolchain. |
29 | | - run: curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y --default-toolchain ${{ env.RUST_VERSION }} |
30 | | - - name: Rust format check. |
31 | | - run: cargo fmt --all -- --check |
| 27 | + - uses: actions/checkout@v4 |
| 28 | + - uses: dtolnay/rust-toolchain@stable |
| 29 | + with: |
| 30 | + toolchain: ${{ env.RUST_VERSION }} |
| 31 | + components: rustfmt |
| 32 | + - run: cargo fmt --all -- --check |
32 | 33 |
|
33 | | - # Run basic code validity check |
| 34 | + # Run basic code validity check. |
34 | 35 | check: |
35 | 36 | needs: fmt |
36 | 37 | name: Check |
37 | 38 | runs-on: ubuntu-latest |
38 | 39 | env: |
39 | 40 | RUSTFLAGS: "-D warnings" |
40 | 41 | steps: |
41 | | - - name: Checkout. |
42 | | - uses: actions/checkout@v3 |
43 | | - - name: Install Rust toolchain. |
44 | | - run: curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y --default-toolchain ${{ env.RUST_VERSION }} |
45 | | - - name: Rust code validity check. |
46 | | - run: cargo check |
| 42 | + - uses: actions/checkout@v4 |
| 43 | + - uses: dtolnay/rust-toolchain@stable |
| 44 | + with: |
| 45 | + toolchain: ${{ env.RUST_VERSION }} |
| 46 | + - run: cargo check --all-features |
47 | 47 |
|
48 | | - # Run all tests |
| 48 | + # Run tests. |
49 | 49 | test: |
50 | 50 | needs: check |
51 | | - name: Test Suite |
| 51 | + name: Test Suite (linux) |
52 | 52 | runs-on: ubuntu-latest |
53 | 53 | env: |
54 | 54 | RUSTFLAGS: "-D warnings" |
55 | 55 | steps: |
56 | | - - uses: actions/checkout@v3 |
57 | | - - name: Checkout. |
58 | | - uses: actions/checkout@v3 |
59 | | - - name: Install Rust toolchain. |
60 | | - run: curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y --default-toolchain ${{ env.RUST_VERSION }} |
61 | | - - name: Run tests. |
62 | | - run: cargo test --all-features |
| 56 | + - uses: actions/checkout@v4 |
| 57 | + - uses: dtolnay/rust-toolchain@stable |
| 58 | + with: |
| 59 | + toolchain: ${{ env.RUST_VERSION }} |
| 60 | + components: rustfmt |
| 61 | + - run: cargo test --all-features |
63 | 62 |
|
64 | | - # Check code style |
| 63 | + # Checks code style. |
65 | 64 | clippy: |
66 | 65 | needs: check |
67 | 66 | name: Clippy |
68 | 67 | runs-on: ubuntu-latest |
69 | 68 | env: |
70 | 69 | RUSTFLAGS: "-D warnings" |
71 | 70 | steps: |
72 | | - - name: Checkout. |
73 | | - uses: actions/checkout@v3 |
74 | | - - name: Install Rust toolchain. |
75 | | - run: curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y --default-toolchain ${{ env.RUST_VERSION }} |
76 | | - - name: Run clippy. |
77 | | - run: cargo clippy |
| 71 | + - uses: actions/checkout@v4 |
| 72 | + - uses: dtolnay/rust-toolchain@stable |
| 73 | + with: |
| 74 | + toolchain: ${{ env.RUST_VERSION }} |
| 75 | + components: clippy |
| 76 | + - run: cargo clippy --all-features |
78 | 77 |
|
79 | 78 | # Compute code coverage |
80 | 79 | codecov: |
81 | 80 | needs: test |
82 | 81 | name: Code coverage |
83 | 82 | runs-on: ubuntu-latest |
84 | 83 | steps: |
85 | | - - name: Checkout. |
86 | | - uses: actions/checkout@v3 |
87 | | - - name: Install Rust toolchain. |
88 | | - run: curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y --default-toolchain ${{ env.RUST_VERSION }} |
89 | | - - name: Setup cargo-tarpaulin. |
90 | | - run: cargo install cargo-tarpaulin |
91 | | - - name: Run tarpaulin to compute coverage. |
92 | | - run: cargo tarpaulin --verbose --lib --examples --all-features --out xml |
| 84 | + - uses: actions/checkout@v4 |
| 85 | + - uses: dtolnay/rust-toolchain@stable |
| 86 | + with: |
| 87 | + toolchain: ${{ env.RUST_VERSION }} |
| 88 | + # Install action using cargo-binstall, which is faster because we don't have to compile tarpaulin every time. |
| 89 | + - uses: taiki-e/install-action@v2 |
| 90 | + with: |
| 91 | + tool: cargo-tarpaulin |
| 92 | + - run: cargo tarpaulin --verbose --lib --examples --all-features --out xml |
93 | 93 | - name: Upload to codecov.io |
94 | | - uses: codecov/codecov-action@v1.0.2 |
| 94 | + uses: codecov/codecov-action@v4 |
95 | 95 | with: |
96 | 96 | token: ${{ secrets.CODECOV_TOKEN }} |
97 | 97 | - name: Archive code coverage results |
98 | | - uses: actions/upload-artifact@v1 |
| 98 | + uses: actions/upload-artifact@v4 |
99 | 99 | with: |
100 | 100 | name: code-coverage-report |
101 | 101 | path: cobertura.xml |
0 commit comments