|
27 | 27 | echo $STAGING_PRIVATE_KEY_PEM > ~/.config/dfx/identity/bootstrap-super-leader/identity.pem |
28 | 28 | bazel test //rs/cli:unit_test --spawn_strategy=local --test_env=HOME=/home/runner |
29 | 29 |
|
30 | | - release: |
| 30 | + build-macos: |
31 | 31 | needs: [test] |
| 32 | + runs-on: macos-14 |
| 33 | + steps: |
| 34 | + - uses: actions/checkout@v4 |
| 35 | + with: |
| 36 | + fetch-depth: 0 |
| 37 | + |
| 38 | + - name: Determine Rust toolchain from rust-toolchain.toml |
| 39 | + id: rust |
| 40 | + run: | |
| 41 | + set -euo pipefail |
| 42 | + ver=$(awk -F\" '/^channel =/ {print $2}' rust-toolchain.toml) |
| 43 | + if [ -z "$ver" ]; then |
| 44 | + echo "Failed to parse Rust toolchain channel from rust-toolchain.toml" >&2 |
| 45 | + exit 1 |
| 46 | + fi |
| 47 | + echo "toolchain=$ver" >> "$GITHUB_OUTPUT" |
| 48 | +
|
| 49 | + - name: Set up Rust toolchain |
| 50 | + uses: dtolnay/rust-toolchain@master |
| 51 | + with: |
| 52 | + toolchain: ${{ steps.rust.outputs.toolchain }} |
| 53 | + |
| 54 | + - name: Install protoc (protobuf) and export env |
| 55 | + run: | |
| 56 | + set -euo pipefail |
| 57 | + brew update |
| 58 | + brew install protobuf |
| 59 | + prefix=$(brew --prefix protobuf) |
| 60 | + echo "PROTOC=$prefix/bin/protoc" >> "$GITHUB_ENV" |
| 61 | + echo "PROTOC_INCLUDE=$prefix/include" >> "$GITHUB_ENV" |
| 62 | + "$prefix/bin/protoc" --version |
| 63 | +
|
| 64 | + - name: Add Rust targets |
| 65 | + run: | |
| 66 | + set -euo pipefail |
| 67 | + rustup target add aarch64-apple-darwin x86_64-apple-darwin |
| 68 | +
|
| 69 | + - name: Build dre (aarch64-apple-darwin) |
| 70 | + run: | |
| 71 | + set -euo pipefail |
| 72 | + cargo build --release -p dre --target aarch64-apple-darwin |
| 73 | +
|
| 74 | + - name: Upload macOS aarch64 artifact |
| 75 | + uses: actions/upload-artifact@v4 |
| 76 | + with: |
| 77 | + name: dre-aarch64-apple-darwin |
| 78 | + path: target/aarch64-apple-darwin/release/dre |
| 79 | + if-no-files-found: error |
| 80 | + |
| 81 | + - name: Build dre (x86_64-apple-darwin) via Apple Silicon cross-linker |
| 82 | + run: | |
| 83 | + set -euo pipefail |
| 84 | + export SDKROOT=$(xcrun --sdk macosx --show-sdk-path) |
| 85 | + export MACOSX_DEPLOYMENT_TARGET=11.0 |
| 86 | + export CC_x86_64_apple_darwin="$(xcrun -f clang)" |
| 87 | + export CXX_x86_64_apple_darwin="$(xcrun -f clang++)" |
| 88 | + export CARGO_TARGET_X86_64_APPLE_DARWIN_LINKER="$(xcrun -f clang)" |
| 89 | + export RUSTFLAGS="-C link-arg=-target -C link-arg=x86_64-apple-macos11.0 ${RUSTFLAGS:-}" |
| 90 | + cargo build --release -p dre --target x86_64-apple-darwin |
| 91 | +
|
| 92 | + - name: Upload macOS x86_64 artifact |
| 93 | + uses: actions/upload-artifact@v4 |
| 94 | + with: |
| 95 | + name: dre-x86_64-apple-darwin |
| 96 | + path: target/x86_64-apple-darwin/release/dre |
| 97 | + if-no-files-found: error |
| 98 | + |
| 99 | + release: |
| 100 | + needs: [test, build-macos] |
32 | 101 | runs-on: |
33 | 102 | labels: dre-runner-custom |
34 | 103 | container: ghcr.io/dfinity/dre/actions-runner:6413f2909a49329ecbf5371ee7ddf07a9799b625 |
@@ -76,17 +145,34 @@ jobs: |
76 | 145 | - name: Build artifacts |
77 | 146 | shell: bash |
78 | 147 | run: | |
79 | | - rustup target add x86_64-apple-darwin |
80 | | - rustup target add aarch64-apple-darwin |
81 | 148 | CARGO_BAZEL_REPIN=true bazel build --config=ci //rs/cli:dre |
82 | | - cargo cross-x86 |
83 | | - cargo cross-aarch |
84 | 149 |
|
85 | 150 | mkdir -p release/artifacts |
86 | 151 | cp --dereference bazel-out/k8-opt/bin/rs/cli/dre release/artifacts/dre-x86_64-unknown-linux |
87 | | - cp target/x86_64-apple-darwin/release/dre release/artifacts/dre-x86_64-apple-darwin |
88 | | - cp target/aarch64-apple-darwin/release/dre release/artifacts/dre-aarch64-apple-darwin |
89 | 152 |
|
| 153 | + - name: Download macOS x86_64 artifact |
| 154 | + uses: actions/download-artifact@v4 |
| 155 | + with: |
| 156 | + name: dre-x86_64-apple-darwin |
| 157 | + path: release/artifacts/ |
| 158 | + |
| 159 | + - name: Rename macOS x86_64 artifact |
| 160 | + shell: bash |
| 161 | + run: mv release/artifacts/dre release/artifacts/dre-x86_64-apple-darwin |
| 162 | + |
| 163 | + - name: Download macOS aarch64 artifact |
| 164 | + uses: actions/download-artifact@v4 |
| 165 | + with: |
| 166 | + name: dre-aarch64-apple-darwin |
| 167 | + path: release/artifacts/ |
| 168 | + |
| 169 | + - name: Rename macOS aarch64 artifact |
| 170 | + shell: bash |
| 171 | + run: mv release/artifacts/dre release/artifacts/dre-aarch64-apple-darwin |
| 172 | + |
| 173 | + - name: Generate changelog |
| 174 | + shell: bash |
| 175 | + run: | |
90 | 176 | git cliff --current --sort newest > release/CHANGELOG.md |
91 | 177 |
|
92 | 178 | - name: "🆕 📢 Prepare release" |
|
0 commit comments