diff --git a/.github/workflows/build-and-test.yml b/.github/workflows/build-and-test.yml index 05e57de..8ae7fbd 100644 --- a/.github/workflows/build-and-test.yml +++ b/.github/workflows/build-and-test.yml @@ -13,41 +13,79 @@ jobs: runs-on: ubuntu-latest steps: - name: Checkout Repository - uses: actions/checkout@v3 - - name: Install Rust - uses: actions-rs/toolchain@v1 + uses: actions/checkout@v4 + + - name: Set up Rust + run: | + rustup update ${{ env.NIGHTLY_VERSION }} && rustup default ${{ env.NIGHTLY_VERSION }} + + - name: Cache Cargo registry + uses: actions/cache@v4 with: - profile: minimal - toolchain: ${{ env.NIGHTLY_VERSION }} - override: true - components: rustfmt, clippy - - name: Check Formatting - uses: actions-rs/cargo@v1 + path: ~/.cargo/registry + key: ${{ runner.os }}-cargo-registry-${{ hashFiles('**/Cargo.lock') }} + restore-keys: | + ${{ runner.os }}-cargo-registry- + + - name: Cache Cargo index + uses: actions/cache@v4 with: - command: fmt - args: --all -- --check - - name: Run Clippy - uses: actions-rs/clippy-check@v1 + path: ~/.cargo/git + key: ${{ runner.os }}-cargo-index-${{ hashFiles('**/Cargo.lock') }} + restore-keys: | + ${{ runner.os }}-cargo-index- + + - name: Cache Cargo build + uses: actions/cache@v4 with: - token: ${{ secrets.GITHUB_TOKEN }} - args: --features depth_16,depth_20,depth_30 + path: target + key: ${{ runner.os }}-cargo-build-${{ hashFiles('**/Cargo.lock') }} + restore-keys: | + ${{ runner.os }}-cargo-build- + + - name: Check Formatting + run: cargo fmt --all -- --check + + - name: Run Clippy + run: cargo clippy --features depth_16,depth_20,depth_30 + test: name: Test runs-on: ubuntu-latest steps: - name: Checkout Repository - uses: actions/checkout@v3 - - name: Install Rust - uses: actions-rs/toolchain@v1 + uses: actions/checkout@v4 + + - name: Set up Rust + run: | + rustup update ${{ env.NIGHTLY_VERSION }} && rustup default ${{ env.NIGHTLY_VERSION }} + + - name: Cache Cargo registry + uses: actions/cache@v4 with: - profile: minimal - toolchain: ${{ env.RUST_VERSION }} - override: true - - name: Run Tests - uses: actions-rs/cargo@v1 + path: ~/.cargo/registry + key: ${{ runner.os }}-cargo-registry-${{ hashFiles('**/Cargo.lock') }} + restore-keys: | + ${{ runner.os }}-cargo-registry- + + - name: Cache Cargo index + uses: actions/cache@v4 with: - command: test - args: --features depth_16,depth_20,depth_30 + path: ~/.cargo/git + key: ${{ runner.os }}-cargo-index-${{ hashFiles('**/Cargo.lock') }} + restore-keys: | + ${{ runner.os }}-cargo-index- + + - name: Cache Cargo build + uses: actions/cache@v4 + with: + path: target + key: ${{ runner.os }}-cargo-build-${{ hashFiles('**/Cargo.lock') }} + restore-keys: | + ${{ runner.os }}-cargo-build- + + - name: Run Clippy + run: cargo test --features depth_16,depth_20,depth_30 # vet: # name: Vet Dependencies # runs-on: ubuntu-latest