Skip to content

Commit 1b98e88

Browse files
committed
ci/release: Use LLVM from Rust CI, support macOS and Linux ARM
- Use LLVM from Rust CI instead of LLVM built from source. - Support for macOS and Linux ARM. - Add the disk usage reports. - To make sure that the job does not regress, execute it in a "dry run" mode for each pull request.
1 parent 8518c78 commit 1b98e88

File tree

1 file changed

+35
-19
lines changed

1 file changed

+35
-19
lines changed

.github/workflows/release.yml

Lines changed: 35 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,38 +1,54 @@
11
name: Release
22

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

79
permissions: {}
810

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

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

0 commit comments

Comments
 (0)