|
1 | 1 | name: Release |
2 | 2 |
|
3 | 3 | on: |
| 4 | + pull_request: |
| 5 | + |
4 | 6 | release: |
5 | 7 | types: [published] |
6 | 8 |
|
7 | 9 | permissions: {} |
8 | 10 |
|
9 | 11 | jobs: |
10 | | - llvm: |
11 | | - uses: ./.github/workflows/llvm.yml |
12 | | - |
13 | 12 | 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 |
17 | 27 | 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 |
24 | 30 |
|
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++. |
26 | 38 | 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 |
29 | 42 |
|
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 |
32 | 52 |
|
33 | 53 | - uses: taiki-e/upload-rust-binary-action@v1 |
34 | 54 | with: |
35 | 55 | 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' }} |
37 | 59 | env: |
38 | 60 | GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
| 61 | + |
| 62 | + - name: Report disk usage |
| 63 | + if: ${{ always() }} |
| 64 | + uses: ./.github/actions/report-disk-usage |
0 commit comments