|
| 1 | +name: Build native image |
| 2 | +defaults: |
| 3 | + run: |
| 4 | + shell: bash -euo pipefail -O nullglob {0} |
| 5 | +on: |
| 6 | + workflow_dispatch: |
| 7 | + inputs: |
| 8 | + ref: |
| 9 | + type: string |
| 10 | + description: "Git ref from which to release" |
| 11 | + required: true |
| 12 | + default: "master" |
| 13 | + workflow_call: |
| 14 | + inputs: |
| 15 | + ref: |
| 16 | + type: string |
| 17 | + description: "Git ref from which to release" |
| 18 | + required: true |
| 19 | + default: "master" |
| 20 | +env: |
| 21 | + INPUT_REF: ${{ github.event.inputs.ref }} |
| 22 | + |
| 23 | +jobs: |
| 24 | + build_native_images: |
| 25 | + name: Build native test server |
| 26 | + strategy: |
| 27 | + fail-fast: false |
| 28 | + matrix: |
| 29 | + include: |
| 30 | + - runner: ubuntu-latest |
| 31 | + os_family: linux |
| 32 | + arch: amd64 |
| 33 | + - runner: macos-13 |
| 34 | + os_family: macOS |
| 35 | + arch: amd64 |
| 36 | + - runner: macos-latest |
| 37 | + os_family: macOS |
| 38 | + arch: arm64 |
| 39 | + - runner: ubuntu-24.04-arm |
| 40 | + os_family: linux |
| 41 | + arch: arm64 |
| 42 | + - runner: windows-2019 |
| 43 | + os_family: windows |
| 44 | + arch: amd64 |
| 45 | + runs-on: ${{ matrix.runner }} |
| 46 | + steps: |
| 47 | + - name: Checkout repo |
| 48 | + uses: actions/checkout@v4 |
| 49 | + with: |
| 50 | + submodules: recursive |
| 51 | + ref: ${{ env.INPUT_REF }} |
| 52 | + |
| 53 | + # See comment on temporary tag above. tldr: this is a local tag; never |
| 54 | + # gets pushed |
| 55 | + - name: Temporary tag |
| 56 | + run: git tag "$INPUT_TAG" |
| 57 | + |
| 58 | + - name: Set up Java |
| 59 | + if: matrix.os_family != 'Linux' |
| 60 | + uses: actions/setup-java@v4 |
| 61 | + with: |
| 62 | + java-version: "21" |
| 63 | + distribution: "graalvm" |
| 64 | + |
| 65 | + - name: Set up Gradle |
| 66 | + if: matrix.os_family != 'Linux' |
| 67 | + uses: gradle/actions/setup-gradle@v4 |
| 68 | + |
| 69 | + - name: Build native test server (non-Docker) |
| 70 | + if: matrix.os_family != 'Linux' |
| 71 | + run: | |
| 72 | + ./gradlew -PnativeBuild :temporal-test-server:nativeBuild |
| 73 | +
|
| 74 | + - name: Build native test server (Docker) |
| 75 | + if: matrix.os_family == 'Linux' |
| 76 | + run: | |
| 77 | + docker run \ |
| 78 | + --rm -w /github/workspace -v "$(pwd):/github/workspace" \ |
| 79 | + $(docker build -q ./docker/native-image) \ |
| 80 | + sh -c "./gradlew -PnativeBuild :temporal-test-server:nativeBuild" |
| 81 | + # path ends in a wildcard because on windows the file ends in '.exe' |
| 82 | + - name: Upload executable to workflow |
| 83 | + uses: actions/upload-artifact@v4 |
| 84 | + with: |
| 85 | + name: ${{ matrix.os_family }}_${{ matrix.arch }} |
| 86 | + path: | |
| 87 | + temporal-test-server/build/native/nativeCompile/temporal-test-server* |
| 88 | + if-no-files-found: error |
| 89 | + retention-days: 1 |
| 90 | + |
0 commit comments