| 1 |
on: |
| 2 |
push: |
| 3 |
|
| 4 |
branches: |
| 5 |
- main |
| 6 |
|
| 7 |
pull_request: |
| 8 |
branches: |
| 9 |
- main |
| 10 |
|
| 11 |
|
| 12 |
name: ci |
| 13 |
|
| 14 |
jobs: |
| 15 |
|
| 16 |
format: |
| 17 |
runs-on: ubuntu-22.04 |
| 18 |
|
| 19 |
steps: |
| 20 |
- uses: actions/checkout@v4 |
| 21 |
|
| 22 |
- name: Run cargo fmt |
| 23 |
run: cargo fmt --all -- --check |
| 24 |
|
| 25 |
check: |
| 26 |
runs-on: ${{ matrix.os }} |
| 27 |
|
| 28 |
needs: |
| 29 |
- format |
| 30 |
|
| 31 |
strategy: |
| 32 |
matrix: |
| 33 |
os: |
| 34 |
- ubuntu-22.04 |
| 35 |
- macos-12 |
| 36 |
- windows-2019 |
| 37 |
toolchain: |
| 38 |
- stable |
| 39 |
- 1.70.0 |
| 40 |
|
| 41 |
steps: |
| 42 |
|
| 43 |
- uses: actions/checkout@v4 |
| 44 |
|
| 45 |
- uses: actions/cache@v4 |
| 46 |
with: |
| 47 |
path: | |
| 48 |
~/.cargo/bin/ |
| 49 |
~/.cargo/registry/index/ |
| 50 |
~/.cargo/registry/cache/ |
| 51 |
~/.cargo/git/db/ |
| 52 |
target/ |
| 53 |
key: ${{ runner.os }}-cargo-${{ matrix.os }}-${{ matrix.toolchain }}-${{ hashFiles('**/Cargo.toml') }} |
| 54 |
|
| 55 |
- name: Install toolchain |
| 56 |
run: | |
| 57 |
rustup toolchain install ${{ matrix.toolchain }} |
| 58 |
rustup default ${{ matrix.toolchain }} |
| 59 |
|
| 60 |
- name: Run cargo check |
| 61 |
run: cargo +${{ matrix.toolchain }} check |
| 62 |
|
| 63 |
- name: Run cargo test |
| 64 |
run: cargo +${{ matrix.toolchain }} test -- --nocapture --test-threads 1 |