diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index a4070731..b24d3794 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -24,15 +24,21 @@ jobs: - uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4 - name: Setup Rust toolchain - uses: dtolnay/rust-toolchain@stable + uses: dtolnay/rust-toolchain@master with: toolchain: stable components: rustfmt, clippy - profile: minimal - override: true - - name: Cache Cargo build files - uses: Leafwing-Studios/cargo-cache@5edda26afa3d28be5d6ee87d4c69c246e3ee37fb # v1 + - name: Cache Cargo files + uses: actions/cache@13aacd865c20de90d75de3b17ebe84f7a17d57d2 # v4 + with: + path: | + ~/.cargo/bin/ + ~/.cargo/registry/index/ + ~/.cargo/registry/cache/ + ~/.cargo/git/db/ + key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }} + save-always: true - name: Prepare build env run: | @@ -43,8 +49,27 @@ jobs: (echo url=https://github.com; echo "username=${GH_USER}"; echo "password=${GH_TOKEN}"; echo ) | git credential approve sudo apt-get install -y lld librdkafka-dev libsasl2-dev - - run: cargo check + - name: Install Cargo-sweep + uses: baptiste0928/cargo-install@v2 + with: + crate: cargo-sweep + + - name: Cache build artifacts + id: cache-build-artifacts + uses: actions/cache@13aacd865c20de90d75de3b17ebe84f7a17d57d2 # v4 + with: + path: target/ + key: ${{ runner.os }}-build-artifacts-${{ hashFiles('**/Cargo.lock') }} + + # Clean up build artifacts older than 5 days + - name: Sweep Cargo build artifacts + if: steps.cache-build-artifacts.outputs.cache-hit == 'true' + run: cargo sweep --time 5 + - run: cargo fmt --all -- --check + + - run: cargo check + - run: cargo clippy -- -D warnings - name: Unit tests