Skip to content

Commit 8bceaa0

Browse files
Add native build to CI
1 parent 0f9813c commit 8bceaa0

2 files changed

Lines changed: 95 additions & 0 deletions

File tree

Lines changed: 90 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,90 @@
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+

.github/workflows/ci.yml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -188,3 +188,8 @@ jobs:
188188

189189
- name: Run copyright and code format checks
190190
run: ./gradlew --no-daemon checkLicenseMain checkLicenses spotlessCheck
191+
192+
build_native_images:
193+
uses: ./.github/workflows/build-native-image.yml
194+
with:
195+
ref: ${{ github.event.pull_request.head.sha }}

0 commit comments

Comments
 (0)