|
| 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 | + |
| 12 | +jobs: |
| 13 | + test: |
| 14 | + name: Test |
| 15 | + runs-on: ubuntu-latest |
| 16 | + steps: |
| 17 | + - uses: actions/checkout@v4 |
| 18 | + |
| 19 | + - name: Install Rust |
| 20 | + uses: dtolnay/rust-toolchain@stable |
| 21 | + |
| 22 | + - name: Cache cargo registry |
| 23 | + uses: actions/cache@v4 |
| 24 | + with: |
| 25 | + path: ~/.cargo/registry |
| 26 | + key: ${{ runner.os }}-cargo-registry-${{ hashFiles('**/Cargo.lock') }} |
| 27 | + |
| 28 | + - name: Cache cargo index |
| 29 | + uses: actions/cache@v4 |
| 30 | + with: |
| 31 | + path: ~/.cargo/git |
| 32 | + key: ${{ runner.os }}-cargo-git-${{ hashFiles('**/Cargo.lock') }} |
| 33 | + |
| 34 | + - name: Cache target directory |
| 35 | + uses: actions/cache@v4 |
| 36 | + with: |
| 37 | + path: target |
| 38 | + key: ${{ runner.os }}-target-${{ hashFiles('**/Cargo.lock') }} |
| 39 | + |
| 40 | + - name: Run tests |
| 41 | + run: cargo test --all-features --workspace |
| 42 | + |
| 43 | + fmt: |
| 44 | + name: Format |
| 45 | + runs-on: ubuntu-latest |
| 46 | + steps: |
| 47 | + - uses: actions/checkout@v4 |
| 48 | + |
| 49 | + - name: Install Rust |
| 50 | + uses: dtolnay/rust-toolchain@stable |
| 51 | + with: |
| 52 | + components: rustfmt |
| 53 | + |
| 54 | + - name: Check formatting |
| 55 | + run: cargo fmt --all -- --check |
| 56 | + |
| 57 | + clippy: |
| 58 | + name: Clippy |
| 59 | + runs-on: ubuntu-latest |
| 60 | + steps: |
| 61 | + - uses: actions/checkout@v4 |
| 62 | + |
| 63 | + - name: Install Rust |
| 64 | + uses: dtolnay/rust-toolchain@stable |
| 65 | + with: |
| 66 | + components: clippy |
| 67 | + |
| 68 | + - name: Cache cargo registry |
| 69 | + uses: actions/cache@v4 |
| 70 | + with: |
| 71 | + path: ~/.cargo/registry |
| 72 | + key: ${{ runner.os }}-cargo-registry-${{ hashFiles('**/Cargo.lock') }} |
| 73 | + |
| 74 | + - name: Cache cargo index |
| 75 | + uses: actions/cache@v4 |
| 76 | + with: |
| 77 | + path: ~/.cargo/git |
| 78 | + key: ${{ runner.os }}-cargo-git-${{ hashFiles('**/Cargo.lock') }} |
| 79 | + |
| 80 | + - name: Cache target directory |
| 81 | + uses: actions/cache@v4 |
| 82 | + with: |
| 83 | + path: target |
| 84 | + key: ${{ runner.os }}-clippy-target-${{ hashFiles('**/Cargo.lock') }} |
| 85 | + |
| 86 | + - name: Run clippy |
| 87 | + run: cargo clippy --all-features --workspace -- -D warnings |
| 88 | + |
| 89 | + build: |
| 90 | + name: Build |
| 91 | + runs-on: ubuntu-latest |
| 92 | + steps: |
| 93 | + - uses: actions/checkout@v4 |
| 94 | + |
| 95 | + - name: Install Rust |
| 96 | + uses: dtolnay/rust-toolchain@stable |
| 97 | + |
| 98 | + - name: Cache cargo registry |
| 99 | + uses: actions/cache@v4 |
| 100 | + with: |
| 101 | + path: ~/.cargo/registry |
| 102 | + key: ${{ runner.os }}-cargo-registry-${{ hashFiles('**/Cargo.lock') }} |
| 103 | + |
| 104 | + - name: Cache cargo index |
| 105 | + uses: actions/cache@v4 |
| 106 | + with: |
| 107 | + path: ~/.cargo/git |
| 108 | + key: ${{ runner.os }}-cargo-git-${{ hashFiles('**/Cargo.lock') }} |
| 109 | + |
| 110 | + - name: Cache target directory |
| 111 | + uses: actions/cache@v4 |
| 112 | + with: |
| 113 | + path: target |
| 114 | + key: ${{ runner.os }}-build-target-${{ hashFiles('**/Cargo.lock') }} |
| 115 | + |
| 116 | + - name: Build |
| 117 | + run: cargo build --all-features --workspace --verbose |
0 commit comments