|
| 1 | +# cspell:disable |
| 2 | +name: Rust |
| 3 | + |
| 4 | +on: |
| 5 | + push: |
| 6 | + branches: [ main ] |
| 7 | + pull_request: |
| 8 | + branches: [ main ] |
| 9 | + schedule: |
| 10 | + - cron: '0 0 * * *' |
| 11 | + |
| 12 | +env: |
| 13 | + CARGO_TERM_COLOR: always |
| 14 | + RUST_BACKTRACE: 1 |
| 15 | + |
| 16 | +jobs: |
| 17 | + test: |
| 18 | + name: Test matrix |
| 19 | + runs-on: ${{ matrix.os }} |
| 20 | + strategy: |
| 21 | + fail-fast: true |
| 22 | + matrix: |
| 23 | + rust: |
| 24 | + - stable |
| 25 | + - nightly |
| 26 | + os: |
| 27 | + - ubuntu-latest |
| 28 | + - macos-latest |
| 29 | + - windows-latest |
| 30 | + target_feature: |
| 31 | + - avx2 |
| 32 | + steps: |
| 33 | + - name: Checkout sources |
| 34 | + uses: actions/checkout@v3 |
| 35 | + - name: Rustup ${{ matrix.rust }} toolchain |
| 36 | + uses: actions-rs/toolchain@v1 |
| 37 | + with: |
| 38 | + toolchain: ${{ matrix.rust }} |
| 39 | + override: true |
| 40 | + default: true |
| 41 | + - name: Cache restore |
| 42 | + id: cache-restore |
| 43 | + uses: actions/cache@v3 |
| 44 | + with: |
| 45 | + path: | |
| 46 | + ~/.cargo/bin/ |
| 47 | + ~/.cargo/registry/index/ |
| 48 | + ~/.cargo/registry/cache/ |
| 49 | + ~/.cargo/git/db/ |
| 50 | + target/ |
| 51 | + key: ${{ matrix.os }}-${{ matrix.rust }}-${{ matrix.target_feature }}-cargo-${{ hashFiles('**/Cargo.toml') }} |
| 52 | + - name: Install cargo-all-features |
| 53 | + if: steps.cache-restore.outputs.cache-hit != 'true' |
| 54 | + uses: actions-rs/cargo@v1 |
| 55 | + with: |
| 56 | + command: install |
| 57 | + args: cargo-all-features |
| 58 | + env: |
| 59 | + CARGO_TARGET_DIR: target/ |
| 60 | + - name: Build all feature sets |
| 61 | + uses: actions-rs/cargo@v1 |
| 62 | + with: |
| 63 | + command: build-all-features |
| 64 | + env: |
| 65 | + RUSTFLAGS: "-C target-feature=+${{ matrix.target_feature }} --deny warnings" |
| 66 | + - name: Test all feature sets |
| 67 | + uses: actions-rs/cargo@v1 |
| 68 | + with: |
| 69 | + command: test-all-features |
| 70 | + env: |
| 71 | + RUSTFLAGS: "-C target-feature=+${{ matrix.target_feature }} --deny warnings" |
| 72 | + |
| 73 | + clippy: |
| 74 | + name: Clippy (stable) |
| 75 | + runs-on: ubuntu-latest |
| 76 | + steps: |
| 77 | + - uses: actions/checkout@v3 |
| 78 | + - name: Rustup stable toolchain |
| 79 | + uses: actions-rs/toolchain@v1 |
| 80 | + with: |
| 81 | + toolchain: stable |
| 82 | + components: clippy |
| 83 | + override: true |
| 84 | + default: true |
| 85 | + - name: Build all features |
| 86 | + uses: actions-rs/cargo@v1 |
| 87 | + with: |
| 88 | + command: build |
| 89 | + args: --all-features |
| 90 | + env: |
| 91 | + RUSTFLAGS: "-C target-feature=+avx2 --deny warnings" |
| 92 | + - name: Clippy all features |
| 93 | + uses: actions-rs/clippy-check@v1 |
| 94 | + with: |
| 95 | + token: ${{ secrets.GITHUB_TOKEN }} |
| 96 | + args: --all-features -- --deny warnings |
| 97 | + env: |
| 98 | + RUSTFLAGS: "-C target-feature=+avx2" |
| 99 | + |
| 100 | + clippy-nightly: |
| 101 | + name: Clippy (nightly) |
| 102 | + runs-on: ubuntu-latest |
| 103 | + steps: |
| 104 | + - uses: actions/checkout@v3 |
| 105 | + - name: Rustup nightly toolchain |
| 106 | + uses: actions-rs/toolchain@v1 |
| 107 | + with: |
| 108 | + toolchain: nightly |
| 109 | + components: clippy |
| 110 | + override: true |
| 111 | + default: true |
| 112 | + - name: Build all features |
| 113 | + uses: actions-rs/cargo@v1 |
| 114 | + with: |
| 115 | + command: build |
| 116 | + args: --all-features |
| 117 | + env: |
| 118 | + RUSTFLAGS: "-C target-feature=+avx2 --deny warnings" |
| 119 | + - name: Clippy all features |
| 120 | + uses: actions-rs/clippy-check@v1 |
| 121 | + with: |
| 122 | + token: ${{ secrets.GITHUB_TOKEN }} |
| 123 | + args: --all-features -- --deny warnings |
| 124 | + env: |
| 125 | + RUSTFLAGS: "-C target-feature=+avx2" |
| 126 | + |
| 127 | + docs: |
| 128 | + name: Documentation |
| 129 | + runs-on: ubuntu-latest |
| 130 | + steps: |
| 131 | + - uses: actions/checkout@v3 |
| 132 | + - name: Rustup nightly toolchain |
| 133 | + uses: actions-rs/toolchain@v1 |
| 134 | + with: |
| 135 | + toolchain: nightly |
| 136 | + override: true |
| 137 | + default: true |
| 138 | + - name: cargo doc |
| 139 | + uses: actions-rs/cargo@v1 |
| 140 | + with: |
| 141 | + command: doc |
| 142 | + args: --all-features --no-deps |
| 143 | + env: |
| 144 | + RUSTFLAGS: "-C target-feature=+avx2" |
| 145 | + RUSTDOCFLAGS: "-Dwarnings --cfg docsrs" |
| 146 | + |
| 147 | + format: |
| 148 | + name: Format |
| 149 | + runs-on: ubuntu-latest |
| 150 | + steps: |
| 151 | + - uses: actions/checkout@v3 |
| 152 | + - name: Rustup stable toolchain |
| 153 | + uses: actions-rs/toolchain@v1 |
| 154 | + with: |
| 155 | + toolchain: stable |
| 156 | + components: rustfmt |
| 157 | + override: true |
| 158 | + default: true |
| 159 | + - name: Format |
| 160 | + uses: actions-rs/cargo@v1 |
| 161 | + with: |
| 162 | + command: fmt |
| 163 | + args: --all -- --check |
0 commit comments