| 1 | name: Rust |
| 2 | |
| 3 | on: |
| 4 | push: |
| 5 | branches: [ "main" ] |
| 6 | pull_request: |
| 7 | branches: [ "main" ] |
| 8 | schedule: |
| 9 | - cron: '0 9 * * 1' |
| 10 | |
| 11 | env: |
| 12 | CARGO_TERM_COLOR: always |
| 13 | |
| 14 | jobs: |
| 15 | build: |
| 16 | runs-on: ${{ matrix.os }} |
| 17 | strategy: |
| 18 | fail-fast: false |
| 19 | matrix: |
| 20 | os: [ubuntu-24.04, macos-latest, windows-latest] |
| 21 | steps: |
| 22 | - uses: actions/checkout@v4 |
| 23 | with: |
| 24 | persist-credentials: false |
| 25 | |
| 26 | - name: Set up cargo cache |
| 27 | uses: actions/cache@v4 |
| 28 | with: |
| 29 | path: | |
| 30 | ~/.cargo/bin/ |
| 31 | ~/.cargo/registry/index/ |
| 32 | ~/.cargo/registry/cache/ |
| 33 | ~/.cargo/git/db/ |
| 34 | target/ |
| 35 | key: ${{ runner.os }}-cargo-debug-${{ hashFiles('**/Cargo.lock') }} |
| 36 | restore-keys: ${{ runner.os }}-cargo-debug- |
| 37 | |
| 38 | - name: Build |
| 39 | run: cargo build --verbose |
| 40 | |
| 41 | unit-test: |
| 42 | runs-on: ${{ matrix.os }} |
| 43 | strategy: |
| 44 | fail-fast: false |
| 45 | matrix: |
| 46 | os: [ubuntu-24.04, macos-latest, windows-latest] |
| 47 | steps: |
| 48 | - uses: actions/checkout@v4 |
| 49 | with: |
| 50 | persist-credentials: false |
| 51 | |
| 52 | - name: Set up cargo cache |
| 53 | uses: actions/cache@v4 |
| 54 | with: |
| 55 | path: | |
| 56 | ~/.cargo/bin/ |
| 57 | ~/.cargo/registry/index/ |
| 58 | ~/.cargo/registry/cache/ |
| 59 | ~/.cargo/git/db/ |
| 60 | target/ |
| 61 | key: ${{ runner.os }}-cargo-debug-${{ hashFiles('**/Cargo.lock') }} |
| 62 | restore-keys: ${{ runner.os }}-cargo-debug- |
| 63 | |
| 64 | - name: Run clippy |
| 65 | run: cargo clippy -- -D warnings |
| 66 | - name: Run tests |
| 67 | run: cargo test --verbose |
| 68 | |
| 69 | fmt: |
| 70 | runs-on: ubuntu-24.04 |
| 71 | steps: |
| 72 | - uses: actions/checkout@v4 |
| 73 | with: |
| 74 | persist-credentials: false |
| 75 | - name: Run cargo fmt |
| 76 | run: cargo fmt --all -- --check |