diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 66219ea..cc257f0 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -14,8 +14,21 @@ jobs: os: [ubuntu-latest, windows-latest, macOS-latest] steps: - uses: actions/checkout@v4 + + - name: Cache cargo registry and index + uses: actions/cache@v4 + with: + path: | + ~/.cargo/registry/index/ + ~/.cargo/registry/cache/ + ~/.cargo/git/db/ + key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }} + restore-keys: | + ${{ runner.os }}-cargo- + - name: Run tests run: cargo test --verbose --all-features + - name: Verify working directory is clean run: git diff --exit-code @@ -27,13 +40,29 @@ jobs: os: [ubuntu-latest, windows-latest, macOS-latest] steps: - uses: actions/checkout@v4 + - uses: dtolnay/rust-toolchain@stable id: toolchain + - run: rustup override set ${{steps.toolchain.outputs.name}} + + - name: Cache cargo registry and index + uses: actions/cache@v4 + with: + path: | + ~/.cargo/registry/index/ + ~/.cargo/registry/cache/ + ~/.cargo/git/db/ + key: ${{ runner.os }}-cargo-latest-${{ hashFiles('**/Cargo.lock') }} + restore-keys: | + ${{ runner.os }}-cargo-latest- + - name: Remove lockfile to build with latest dependencies run: rm Cargo.lock + - name: Run tests run: cargo test --verbose --all-features + - name: Verify working directory is clean (excluding lockfile) run: git diff --exit-code ':!Cargo.lock'