|
1 | | -name: Continuous Integration |
| 1 | +name: CI |
| 2 | + |
| 3 | +permissions: |
| 4 | + contents: read |
2 | 5 |
|
3 | 6 | on: |
4 | 7 | pull_request: |
5 | | - paths: |
6 | | - - "**.rs" |
7 | | - - "Cargo.toml" |
8 | | - - "Cargo.lock" |
| 8 | + push: |
| 9 | + branches: |
| 10 | + - main |
| 11 | + |
| 12 | +env: |
| 13 | + RUST_BACKTRACE: 1 |
| 14 | + CARGO_TERM_COLOR: always |
| 15 | + CLICOLOR: 1 |
9 | 16 |
|
10 | 17 | jobs: |
11 | | - fmt: |
12 | | - name: Source formatting check |
| 18 | + ci: |
| 19 | + permissions: |
| 20 | + contents: none |
| 21 | + name: CI |
| 22 | + needs: [test, msrv, docs, rustfmt, clippy] |
13 | 23 | runs-on: ubuntu-latest |
14 | 24 | steps: |
15 | | - - name: Checkout sources |
16 | | - uses: actions/checkout@v2 |
17 | | - |
18 | | - - name: Install Rust toolchain |
19 | | - uses: actions-rs/toolchain@v1 |
20 | | - with: |
21 | | - profile: minimal |
22 | | - toolchain: nightly |
23 | | - override: true |
24 | | - components: rustfmt |
25 | | - |
26 | | - - name: Check formatting |
27 | | - uses: actions-rs/cargo@v1 |
28 | | - with: |
29 | | - command: fmt |
30 | | - args: -- --check |
31 | | - |
32 | | - check: |
33 | | - name: Compilation check |
34 | | - runs-on: ubuntu-latest |
| 25 | + - name: Done |
| 26 | + run: exit 0 |
| 27 | + test: |
| 28 | + name: Test |
35 | 29 | strategy: |
36 | | - fail-fast: true |
37 | 30 | matrix: |
38 | | - rust: |
39 | | - - stable |
40 | | - - beta |
41 | | - - nightly |
42 | | - - 1.41.0 |
| 31 | + os: ["ubuntu-latest", "windows-latest", "macos-latest"] |
| 32 | + rust: ["stable"] |
| 33 | + continue-on-error: ${{ matrix.rust != 'stable' }} |
| 34 | + runs-on: ${{ matrix.os }} |
43 | 35 | steps: |
44 | | - - name: Checkout sources |
45 | | - uses: actions/checkout@v2 |
46 | | - |
47 | | - - name: Install Rust toolchain |
48 | | - uses: actions-rs/toolchain@v1 |
49 | | - with: |
50 | | - profile: minimal |
51 | | - toolchain: ${{ matrix.rust }} |
52 | | - override: true |
53 | | - |
54 | | - - name: Run cargo check |
55 | | - uses: actions-rs/cargo@v1 |
56 | | - with: |
57 | | - command: check |
58 | | - |
59 | | - clippy: |
60 | | - name: Lint check |
| 36 | + - name: Checkout repository |
| 37 | + uses: actions/checkout@v3 |
| 38 | + - name: Install Rust |
| 39 | + uses: actions-rs/toolchain@v1 |
| 40 | + with: |
| 41 | + toolchain: ${{ matrix.rust }} |
| 42 | + profile: minimal |
| 43 | + override: true |
| 44 | + - uses: Swatinem/rust-cache@v1 |
| 45 | + - name: Build |
| 46 | + run: cargo test --no-run --workspace --all-features |
| 47 | + - name: Default features |
| 48 | + run: cargo test --workspace |
| 49 | + - name: All features |
| 50 | + run: cargo test --workspace --all-features |
| 51 | + - name: No-default features |
| 52 | + run: cargo test --workspace --no-default-features |
| 53 | + - name: Check feature combinations |
| 54 | + run: cargo run -p ci |
| 55 | + - name: Run crate example |
| 56 | + run: cargo run --example default |
| 57 | + msrv: |
| 58 | + name: "Check MSRV: 1.41.0" |
61 | 59 | runs-on: ubuntu-latest |
62 | 60 | steps: |
63 | | - - name: Checkout sources |
64 | | - uses: actions/checkout@v2 |
65 | | - |
66 | | - - name: Install Rust toolchain |
67 | | - uses: actions-rs/toolchain@v1 |
68 | | - with: |
69 | | - profile: minimal |
70 | | - toolchain: stable |
71 | | - override: true |
72 | | - components: clippy |
73 | | - |
74 | | - - name: Run lints |
75 | | - uses: actions-rs/cargo@v1 |
76 | | - with: |
77 | | - command: clippy |
78 | | - args: -- -D warnings |
79 | | - |
80 | | - ci-crate: |
81 | | - name: CI crate check |
| 61 | + - name: Checkout repository |
| 62 | + uses: actions/checkout@v3 |
| 63 | + - name: Install Rust |
| 64 | + uses: actions-rs/toolchain@v1 |
| 65 | + with: |
| 66 | + toolchain: 1.41.0 # MSRV |
| 67 | + profile: minimal |
| 68 | + override: true |
| 69 | + - uses: Swatinem/rust-cache@v1 |
| 70 | + - name: Default features |
| 71 | + run: cargo check --workspace --all-targets |
| 72 | + - name: All features |
| 73 | + run: cargo check --workspace --all-targets --all-features |
| 74 | + - name: No-default features |
| 75 | + run: cargo check --workspace --all-targets --no-default-features |
| 76 | + docs: |
| 77 | + name: Docs |
82 | 78 | runs-on: ubuntu-latest |
83 | 79 | steps: |
84 | | - - name: Checkout sources |
85 | | - uses: actions/checkout@v2 |
86 | | - |
87 | | - - name: Install Rust toolchain |
88 | | - uses: actions-rs/toolchain@v1 |
89 | | - with: |
90 | | - profile: minimal |
91 | | - |
92 | | - - name: Run ci crate |
93 | | - uses: actions-rs/cargo@v1 |
94 | | - with: |
95 | | - command: run |
96 | | - args: -p ci |
97 | | - |
98 | | - crate-example: |
99 | | - name: Crate example check |
| 80 | + - name: Checkout repository |
| 81 | + uses: actions/checkout@v3 |
| 82 | + - name: Install Rust |
| 83 | + uses: actions-rs/toolchain@v1 |
| 84 | + with: |
| 85 | + toolchain: stable |
| 86 | + profile: minimal |
| 87 | + override: true |
| 88 | + - uses: Swatinem/rust-cache@v1 |
| 89 | + - name: Check documentation |
| 90 | + env: |
| 91 | + RUSTDOCFLAGS: -D warnings |
| 92 | + run: cargo doc --workspace --all-features --no-deps --document-private-items |
| 93 | + rustfmt: |
| 94 | + name: rustfmt |
100 | 95 | runs-on: ubuntu-latest |
101 | 96 | steps: |
102 | | - - name: Checkout sources |
103 | | - uses: actions/checkout@v2 |
104 | | - |
105 | | - - name: Install Rust toolchain |
106 | | - uses: actions-rs/toolchain@v1 |
107 | | - with: |
108 | | - profile: minimal |
109 | | - |
110 | | - - name: Run crate example |
111 | | - uses: actions-rs/cargo@v1 |
112 | | - with: |
113 | | - command: run |
114 | | - args: --example default |
| 97 | + - name: Checkout repository |
| 98 | + uses: actions/checkout@v3 |
| 99 | + - name: Install Rust |
| 100 | + uses: actions-rs/toolchain@v1 |
| 101 | + with: |
| 102 | + # Not MSRV because its harder to jump between versions and people are |
| 103 | + # more likely to have stable |
| 104 | + toolchain: stable |
| 105 | + profile: minimal |
| 106 | + override: true |
| 107 | + components: rustfmt |
| 108 | + - uses: Swatinem/rust-cache@v1 |
| 109 | + - name: Check formatting |
| 110 | + run: cargo fmt --all -- --check |
| 111 | + clippy: |
| 112 | + name: clippy |
| 113 | + runs-on: ubuntu-latest |
| 114 | + permissions: |
| 115 | + checks: write # to create check (actions-rs/audit-check) |
| 116 | + steps: |
| 117 | + - name: Checkout repository |
| 118 | + uses: actions/checkout@v3 |
| 119 | + - name: Install Rust |
| 120 | + uses: actions-rs/toolchain@v1 |
| 121 | + with: |
| 122 | + toolchain: 1.41.0 # MSRV |
| 123 | + profile: minimal |
| 124 | + override: true |
| 125 | + components: clippy |
| 126 | + - uses: Swatinem/rust-cache@v1 |
| 127 | + - uses: actions-rs/clippy-check@v1 |
| 128 | + with: |
| 129 | + token: ${{ secrets.GITHUB_TOKEN }} |
| 130 | + args: --workspace --all-features --all-targets -- -D warnings --allow deprecated |
0 commit comments