|
| 1 | +name: Build Golem Binaries |
| 2 | + |
| 3 | +on: |
| 4 | + workflow_dispatch: |
| 5 | + push: |
| 6 | + branches: |
| 7 | + - '**' |
| 8 | + |
| 9 | +concurrency: |
| 10 | + group: build-golem-binaries-${{ github.ref }} |
| 11 | + cancel-in-progress: true |
| 12 | + |
| 13 | +permissions: |
| 14 | + actions: write |
| 15 | + contents: read |
| 16 | + |
| 17 | +jobs: |
| 18 | + check-trigger: |
| 19 | + runs-on: ubuntu-latest |
| 20 | + outputs: |
| 21 | + should_run: ${{ steps.check.outputs.should_run }} |
| 22 | + steps: |
| 23 | + - uses: actions/checkout@v5 |
| 24 | + with: |
| 25 | + fetch-depth: 1 |
| 26 | + - name: Check trigger condition |
| 27 | + id: check |
| 28 | + run: | |
| 29 | + if [ "${{ github.event_name }}" = "workflow_dispatch" ]; then |
| 30 | + echo "should_run=true" >> "$GITHUB_OUTPUT" |
| 31 | + else |
| 32 | + MSG=$(git log -1 --pretty=%s) |
| 33 | + if echo "$MSG" | grep -q "rebuild golem artifact"; then |
| 34 | + echo "should_run=true" >> "$GITHUB_OUTPUT" |
| 35 | + else |
| 36 | + echo "should_run=false" >> "$GITHUB_OUTPUT" |
| 37 | + fi |
| 38 | + fi |
| 39 | +
|
| 40 | + build: |
| 41 | + needs: check-trigger |
| 42 | + if: needs.check-trigger.outputs.should_run == 'true' |
| 43 | + env: |
| 44 | + CARGO_BUILD_JOBS: 20 |
| 45 | + runs-on: blacksmith-32vcpu-ubuntu-2204 |
| 46 | + steps: |
| 47 | + - name: Checkout |
| 48 | + uses: actions/checkout@v5 |
| 49 | + with: |
| 50 | + fetch-depth: 1 |
| 51 | + |
| 52 | + # --- Rust toolchain (matches ci.yaml build-and-store + publish-binaries) --- |
| 53 | + - name: Setup Rust |
| 54 | + run: rustup update stable --no-self-update && rustup default stable && rustup target add wasm32-wasip1 wasm32-wasip2 |
| 55 | + - uses: Swatinem/rust-cache@v2 |
| 56 | + with: |
| 57 | + prefix-key: v4-rust |
| 58 | + shared-key: release |
| 59 | + cache-all-crates: true |
| 60 | + save-if: true |
| 61 | + - uses: davidB/rust-cargo-make@v1 |
| 62 | + # --- Build golem-cli and golem server (release, matches publish-binaries) --- |
| 63 | + - name: Purge v8 from cache |
| 64 | + run: cargo make --profile ci clear-v8 |
| 65 | + |
| 66 | + - name: Build golem-cli |
| 67 | + run: cargo build -p golem-cli --release |
| 68 | + timeout-minutes: 30 |
| 69 | + |
| 70 | + - name: Build golem server |
| 71 | + run: cargo build -p golem --release |
| 72 | + timeout-minutes: 30 |
| 73 | + |
| 74 | + # --- Upload artifacts --- |
| 75 | + - name: Upload golem-cli |
| 76 | + uses: actions/upload-artifact@v4 |
| 77 | + with: |
| 78 | + name: golem-cli |
| 79 | + path: target/release/golem-cli |
| 80 | + retention-days: 30 |
| 81 | + |
| 82 | + - name: Upload golem server |
| 83 | + uses: actions/upload-artifact@v4 |
| 84 | + with: |
| 85 | + name: golem-server |
| 86 | + path: target/release/golem |
| 87 | + retention-days: 30 |
0 commit comments