Skip to content

Commit f38cfb3

Browse files
committed
ci/release: Use LLVM from Rust CI, support macOS and Linux ARM
Reflect the changes made to the test CI workflows, including: - Usage of LLVM from Rust CI. - Support for macOS and Linux ARM. Add the disk usage reports as well. To make sure that the job does not regress, execute it in a "dry run" mode for each pull request.
1 parent bcf8683 commit f38cfb3

File tree

3 files changed

+64
-37
lines changed

3 files changed

+64
-37
lines changed
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
name: Report disk usage
2+
description: Print disk usage for key directories on the runner
3+
runs:
4+
using: composite
5+
steps:
6+
- name: Report disk usage
7+
shell: bash
8+
run: |
9+
set -euo pipefail
10+
11+
printf "\n== Filesystems ==\n"
12+
df -h
13+
14+
report_dir() {
15+
local dir="$1"
16+
local depth="$2"
17+
18+
[[ -d "$dir" ]] || return
19+
20+
printf "\n== %s ==\n" "$dir"
21+
sudo -n du -x -h --max-depth="$depth" "$dir" 2>/dev/null | sort -h -r | head -n 20
22+
}
23+
24+
report_dir "${{ github.workspace }}" 2
25+
report_dir "$HOME/.cargo" 2
26+
report_dir "$HOME/.rustup" 1
27+
report_dir /tmp 1
28+
report_dir /var/cache/apt/archives 1

.github/workflows/ci.yml

Lines changed: 1 addition & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -335,24 +335,4 @@ jobs:
335335

336336
- name: Report disk usage
337337
if: ${{ always() }}
338-
run: |
339-
set -euo pipefail
340-
341-
printf "\n== Filesystems ==\n"
342-
df -h
343-
344-
report_dir() {
345-
local dir="$1"
346-
local depth="$2"
347-
348-
[[ -d "$dir" ]] || return
349-
350-
printf "\n== %s ==\n" "$dir"
351-
sudo -n du -x -h --max-depth="$depth" "$dir" 2>/dev/null | sort -h -r | head -n 20
352-
}
353-
354-
report_dir "${{ github.workspace }}" 2
355-
report_dir "$HOME/.cargo" 2
356-
report_dir "$HOME/.rustup" 1
357-
report_dir /tmp 1
358-
report_dir /var/cache/apt/archives 1
338+
uses: ./.github/actions/report-disk-usage

.github/workflows/release.yml

Lines changed: 35 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
name: Release
22

33
on:
4+
pull_request:
5+
46
release:
57
types: [published]
68

@@ -9,28 +11,45 @@ jobs:
911
uses: ./.github/workflows/llvm.yml
1012

1113
upload-bins:
12-
# TODO: Build for macos someday.
13-
runs-on: ubuntu-22.04
14-
needs: llvm
14+
runs-on: ${{ matrix.platform.os }}
15+
strategy:
16+
matrix:
17+
platform:
18+
- os: macos-latest
19+
target: aarch64-apple-darwin
20+
- os: macos-15-intel
21+
target: x86_64-apple-darwin
22+
- os: ubuntu-22.04
23+
target: x86_64-unknown-linux-musl
24+
extra-features: deps-link-static
25+
- os: ubuntu-22.04-arm
26+
target: aarch64-unknown-linux-musl
27+
extra-features: deps-link-static
28+
env:
29+
RUST_CI_LLVM_INSTALL_DIR: /tmp/rustc-llvm
1530
steps:
16-
- name: Restore LLVM
17-
uses: actions/cache/restore@v4
18-
with:
19-
path: llvm-install
20-
key: ${{ needs.llvm.outputs.cache-key }}
21-
fail-on-cache-miss: true
22-
23-
- name: Add LLVM to PATH
24-
run: |
25-
echo "${{ github.workspace }}/llvm-install/bin" >> $GITHUB_PATH
26-
echo "$PATH"
27-
2831
- uses: actions/checkout@v5
2932
- uses: Swatinem/rust-cache@v2
3033

34+
- name: Install LLVM from Rust CI
35+
run: |
36+
set -euxo pipefail
37+
sudo mkdir -p $RUST_CI_LLVM_INSTALL_DIR
38+
rustc_date="$(curl -s https://static.rust-lang.org/dist/channel-rust-nightly-date.txt)"
39+
rustc_sha="$(curl -s "https://static.rust-lang.org/dist/$rustc_date/channel-rust-nightly-git-commit-hash.txt")"
40+
wget -q -O - "https://ci-artifacts.rust-lang.org/rustc-builds/$rustc_sha/rust-dev-nightly-${{ matrix.platform.target }}.tar.xz" | \
41+
sudo tar -xJ --strip-components 2 -C $RUST_CI_LLVM_INSTALL_DIR
42+
echo "${RUST_CI_LLVM_INSTALL_DIR}/bin" >> $GITHUB_PATH
43+
3144
- uses: taiki-e/upload-rust-binary-action@v1
3245
with:
3346
bin: bpf-linker
34-
features: llvm-link-static
47+
features: llvm-21,llvm-link-static,${{ matrix.platform.extra-features }}
48+
no-default-features: true
49+
dry-run: ${{ github.event_name != 'release' }}
3550
env:
3651
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
52+
53+
- name: Report disk usage
54+
if: ${{ always() }}
55+
uses: ./.github/actions/report-disk-usage

0 commit comments

Comments
 (0)