|
| 1 | +name:CI |
| 2 | + |
| 3 | +on: |
| 4 | +pull_request: |
| 5 | +branches: |
| 6 | + -master |
| 7 | +push: |
| 8 | +branches: |
| 9 | + -master |
| 10 | + |
| 11 | +env: |
| 12 | +RUSTFLAGS:-D warnings |
| 13 | +RUST_BACKTRACE:1 |
| 14 | + |
| 15 | +jobs: |
| 16 | +test: |
| 17 | +name:test |
| 18 | +runs-on:ubuntu-latest |
| 19 | +steps: |
| 20 | + -uses:actions/checkout@v4 |
| 21 | + -name:Install Rust |
| 22 | +run:| |
| 23 | + rustup update --no-self-update stable |
| 24 | + rustup default stable |
| 25 | + -name:Get Rust version |
| 26 | +id:rust-version |
| 27 | +run:echo "::set-output name=version:$(rustc --version)" |
| 28 | + -name:Index cache |
| 29 | +uses:actions/cache@v4 |
| 30 | +with: |
| 31 | +path:~/.cargo/registry/index |
| 32 | +key:index-${{ github.run_id }} |
| 33 | +restore-keys:| |
| 34 | + index- |
| 35 | + -name:Create lockfile |
| 36 | +run:cargo generate-lockfile |
| 37 | + -name:Registry cache |
| 38 | +uses:actions/cache@v4 |
| 39 | +with: |
| 40 | +path:~/.cargo/registry/cache |
| 41 | +key:registry-${{ hashFiles('Cargo.lock') }} |
| 42 | + -name:Fetch dependencies |
| 43 | +run:cargo fetch |
| 44 | + -name:Target cache |
| 45 | +uses:actions/cache@v4 |
| 46 | +with: |
| 47 | +path:target |
| 48 | +key:target-${{ steps.rust-version.outputs.version }}-${{ hashFiles('Cargo.lock') }} |
| 49 | + -name:Test |
| 50 | +run:cargo test |