|
| 1 | +name: CI |
| 2 | + |
| 3 | +on: |
| 4 | + push: |
| 5 | + branches: [main] |
| 6 | + pull_request: |
| 7 | + branches: [main] |
| 8 | + |
| 9 | +env: |
| 10 | + CARGO_TERM_COLOR: always |
| 11 | + RUST_BACKTRACE: 1 |
| 12 | + |
| 13 | +jobs: |
| 14 | + test: |
| 15 | + name: Test |
| 16 | + runs-on: ${{ matrix.os }} |
| 17 | + strategy: |
| 18 | + matrix: |
| 19 | + os: [ubuntu-latest, macos-latest, windows-latest] |
| 20 | + rust: [stable, beta] |
| 21 | + steps: |
| 22 | + - uses: actions/checkout@v5 |
| 23 | + |
| 24 | + - name: Install Rust |
| 25 | + uses: dtolnay/rust-toolchain@master |
| 26 | + with: |
| 27 | + toolchain: ${{ matrix.rust }} |
| 28 | + |
| 29 | + - name: Cache cargo registry |
| 30 | + uses: actions/cache@v4 |
| 31 | + with: |
| 32 | + path: ~/.cargo/registry/index |
| 33 | + key: ${{ runner.os }}-cargo-registry-${{ hashFiles('**/Cargo.lock') }} |
| 34 | + restore-keys: | |
| 35 | + ${{ runner.os }}-cargo-registry- |
| 36 | +
|
| 37 | + - name: Cache cargo index |
| 38 | + uses: actions/cache@v4 |
| 39 | + with: |
| 40 | + path: ~/.cargo/registry/cache |
| 41 | + key: ${{ runner.os }}-cargo-index-${{ hashFiles('**/Cargo.lock') }} |
| 42 | + restore-keys: | |
| 43 | + ${{ runner.os }}-cargo-index- |
| 44 | +
|
| 45 | + - name: Cache cargo build |
| 46 | + uses: actions/cache@v4 |
| 47 | + with: |
| 48 | + path: target |
| 49 | + key: ${{ runner.os }}-cargo-build-${{ matrix.rust }}-${{ hashFiles('**/Cargo.lock') }} |
| 50 | + restore-keys: | |
| 51 | + ${{ runner.os }}-cargo-build-${{ matrix.rust }}- |
| 52 | + ${{ runner.os }}-cargo-build- |
| 53 | +
|
| 54 | + - name: Install cargo-nextest |
| 55 | + uses: taiki-e/install-action@v2 |
| 56 | + with: |
| 57 | + tool: cargo-nextest |
| 58 | + |
| 59 | + - name: Run tests |
| 60 | + run: cargo nextest run --all-features --workspace |
| 61 | + |
| 62 | + fmt: |
| 63 | + name: Format |
| 64 | + runs-on: ubuntu-latest |
| 65 | + steps: |
| 66 | + - uses: actions/checkout@v5 |
| 67 | + |
| 68 | + - name: Install Rust |
| 69 | + uses: dtolnay/rust-toolchain@stable |
| 70 | + with: |
| 71 | + components: rustfmt |
| 72 | + |
| 73 | + - name: Check formatting |
| 74 | + run: cargo fmt --all -- --check |
| 75 | + |
| 76 | + clippy: |
| 77 | + name: Clippy |
| 78 | + runs-on: ubuntu-latest |
| 79 | + steps: |
| 80 | + - uses: actions/checkout@v5 |
| 81 | + |
| 82 | + - name: Install Rust |
| 83 | + uses: dtolnay/rust-toolchain@stable |
| 84 | + with: |
| 85 | + components: clippy |
| 86 | + |
| 87 | + - name: Cache cargo registry |
| 88 | + uses: actions/cache@v4 |
| 89 | + with: |
| 90 | + path: ~/.cargo/registry/index |
| 91 | + key: ${{ runner.os }}-cargo-registry-${{ hashFiles('**/Cargo.lock') }} |
| 92 | + restore-keys: | |
| 93 | + ${{ runner.os }}-cargo-registry- |
| 94 | +
|
| 95 | + - name: Cache cargo index |
| 96 | + uses: actions/cache@v4 |
| 97 | + with: |
| 98 | + path: ~/.cargo/registry/cache |
| 99 | + key: ${{ runner.os }}-cargo-index-${{ hashFiles('**/Cargo.lock') }} |
| 100 | + restore-keys: | |
| 101 | + ${{ runner.os }}-cargo-index- |
| 102 | +
|
| 103 | + - name: Cache cargo build |
| 104 | + uses: actions/cache@v4 |
| 105 | + with: |
| 106 | + path: target |
| 107 | + key: ${{ runner.os }}-cargo-clippy-${{ hashFiles('**/Cargo.lock') }} |
| 108 | + restore-keys: | |
| 109 | + ${{ runner.os }}-cargo-clippy- |
| 110 | +
|
| 111 | + - name: Run clippy |
| 112 | + run: cargo clippy --all-features --workspace -- -D warnings |
| 113 | + |
| 114 | + docs: |
| 115 | + name: Documentation |
| 116 | + runs-on: ubuntu-latest |
| 117 | + steps: |
| 118 | + - uses: actions/checkout@v5 |
| 119 | + |
| 120 | + - name: Install Rust |
| 121 | + uses: dtolnay/rust-toolchain@stable |
| 122 | + |
| 123 | + - name: Cache cargo registry |
| 124 | + uses: actions/cache@v4 |
| 125 | + with: |
| 126 | + path: ~/.cargo/registry/index |
| 127 | + key: ${{ runner.os }}-cargo-registry-${{ hashFiles('**/Cargo.lock') }} |
| 128 | + restore-keys: | |
| 129 | + ${{ runner.os }}-cargo-registry- |
| 130 | +
|
| 131 | + - name: Cache cargo index |
| 132 | + uses: actions/cache@v4 |
| 133 | + with: |
| 134 | + path: ~/.cargo/registry/cache |
| 135 | + key: ${{ runner.os }}-cargo-index-${{ hashFiles('**/Cargo.lock') }} |
| 136 | + restore-keys: | |
| 137 | + ${{ runner.os }}-cargo-index- |
| 138 | +
|
| 139 | + - name: Check documentation |
| 140 | + run: cargo doc --all-features --workspace --no-deps |
| 141 | + env: |
| 142 | + RUSTDOCFLAGS: -D warnings |
0 commit comments