Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore(ci): use cargo-sweep to reduce build artifacts cache size #555

Closed
wants to merge 2 commits into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
37 changes: 31 additions & 6 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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: |
Expand All @@ -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
Expand Down