Skip to content

Commit fbacf75

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 0795a01 commit fbacf75

File tree

1 file changed

+44
-18
lines changed

1 file changed

+44
-18
lines changed

.github/workflows/release.yml

Lines changed: 44 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,38 +1,64 @@
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+
- os: ubuntu-22.04-arm
24+
target: aarch64-unknown-linux-musl
25+
env:
26+
RUST_CI_LLVM_INSTALL_DIR: /tmp/rustc-llvm
1727
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
28+
- uses: actions/checkout@v6
29+
- uses: Swatinem/rust-cache@v2
2430

25-
- name: Add LLVM to PATH
31+
- name: Install static libraries (macOS)
32+
if: runner.os == 'macOS'
33+
# macOS does not provide any static libraries. Homebrew does provide
34+
# them, but in custom paths that the system-wide clang is not aware of.
35+
# Point build.rs to them by setting environment variables.
36+
#
37+
# We install llvm package only for libc++.
2638
run: |
27-
echo "${{ github.workspace }}/llvm-install/bin" >> $GITHUB_PATH
28-
echo "$PATH"
39+
brew install llvm zlib
40+
echo "CXXSTDLIB_PATH=$(brew --prefix llvm)/lib/c++" >> $GITHUB_ENV
41+
echo "ZLIB_PATH=$(brew --prefix zlib)/lib" >> $GITHUB_ENV
2942
30-
- uses: actions/checkout@v6
31-
- uses: Swatinem/rust-cache@v2
43+
- name: Install LLVM from Rust CI
44+
run: |
45+
set -euxo pipefail
46+
sudo mkdir -p $RUST_CI_LLVM_INSTALL_DIR
47+
rustc_date="$(curl -s https://static.rust-lang.org/dist/channel-rust-nightly-date.txt)"
48+
rustc_sha="$(curl -s "https://static.rust-lang.org/dist/$rustc_date/channel-rust-nightly-git-commit-hash.txt")"
49+
wget -q -O - "https://ci-artifacts.rust-lang.org/rustc-builds/$rustc_sha/rust-dev-nightly-${{ matrix.platform.target }}.tar.xz" | \
50+
sudo tar -xJ --strip-components 2 -C $RUST_CI_LLVM_INSTALL_DIR
51+
echo "${RUST_CI_LLVM_INSTALL_DIR}/bin" >> $GITHUB_PATH
3252
3353
- uses: taiki-e/upload-rust-binary-action@v1
3454
with:
3555
bin: bpf-linker
36-
features: llvm-link-static
56+
features: llvm-21,llvm-link-static
57+
no-default-features: true
58+
dry-run: ${{ github.event_name != 'release' }}
3759
env:
3860
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
61+
62+
- name: Report disk usage
63+
if: ${{ always() }}
64+
uses: ./.github/actions/report-disk-usage

0 commit comments

Comments
 (0)