Skip to content

Commit afe8127

Browse files
authored
Merge pull request #1647 from 0xMiden/mmagician-ci-job-fixes
chore: free up disk space in CI runs for releases
2 parents d93e71a + 6cc3eb8 commit afe8127

File tree

3 files changed

+30
-3
lines changed

3 files changed

+30
-3
lines changed
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
name: 'Cleanup Runner'
2+
description: 'Remove unused tools in the runner image to free disk space'
3+
4+
runs:
5+
using: 'composite'
6+
steps:
7+
- name: Remove unused tools in the runner image
8+
shell: bash
9+
run: |
10+
sudo rm -rf /usr/share/dotnet /usr/local/lib/android /opt/ghc /opt/hostedtoolcache/CodeQL
11+
sudo docker image prune --all --force || true
12+
sudo docker builder prune -a --force || true

.github/workflows/publish-crates-dry-run.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,9 @@ jobs:
1818
with:
1919
fetch-depth: 0
2020

21+
- name: Cleanup large tools for build space
22+
uses: ./.github/actions/cleanup-runner
23+
2124
- name: Update Rust toolchain
2225
run: |
2326
rustup update --no-self-update

.github/workflows/publish-crates-release.yml

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,15 +12,22 @@ jobs:
1212
runs-on: ubuntu-latest
1313
env:
1414
CARGO_TERM_COLOR: always
15+
# Important: use an absolute path so `cargo publish` verification builds
16+
# (which happen from `target/package/...`) don't create nested `target/` dirs.
17+
CARGO_TARGET_DIR: ${{ github.workspace }}/target
1518
steps:
1619
- name: Check out code
1720
uses: actions/checkout@v4
1821
with:
1922
fetch-depth: 0
23+
# Ensure the release tag refers to the latest commit on main.
24+
# Compare the commit SHA that triggered the workflow with the HEAD of the branch we just
25+
# checked out (main).
2026
ref: main
21-
# Ensure the release tag refers to the latest commit on main.
22-
# Compare the commit SHA that triggered the workflow with the HEAD of the branch we just
23-
# checked out (main).
27+
28+
- name: Cleanup large tools for build space
29+
uses: ./.github/actions/cleanup-runner
30+
2431
- name: Verify release was triggered from main HEAD
2532
run: |
2633
tag_sha="${{ github.sha }}"
@@ -50,6 +57,11 @@ jobs:
5057
cd ../web-client
5158
cargo publish --dry-run
5259
60+
- name: Cleanup cargo package artifacts (after dry-run)
61+
if: always()
62+
run: |
63+
rm -rf "$CARGO_TARGET_DIR/package" || true
64+
5365
- name: Publish crates
5466
env:
5567
CARGO_REGISTRY_TOKEN: ${{ secrets.CRATES_IO_TOKEN }}

0 commit comments

Comments
 (0)