-
Notifications
You must be signed in to change notification settings - Fork 210
114 lines (107 loc) · 3.64 KB
/
build-native-image.yml
File metadata and controls
114 lines (107 loc) · 3.64 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
name: Build native image
permissions:
contents: read
defaults:
run:
shell: bash -euo pipefail -O nullglob {0}
on:
workflow_dispatch:
inputs:
ref:
type: string
description: "Git ref from which to release"
required: true
default: "master"
upload_artifact:
type: boolean
description: "Upload the native test server executable as an artifact"
required: false
default: false
workflow_call:
inputs:
ref:
type: string
description: "Git ref from which to release"
required: true
default: "master"
upload_artifact:
type: boolean
description: "Upload the native test server executable as an artifact"
required: false
default: false
env:
INPUT_REF: ${{ inputs.ref }}
jobs:
build_native_images:
name: Build native test server
strategy:
fail-fast: false
matrix:
include:
- runner: ubuntu-latest
os_family: linux
arch: amd64
musl: true
- runner: ubuntu-latest
os_family: linux
arch: amd64
musl: false
- runner: macos-15-intel
os_family: macOS
arch: amd64
- runner: macos-latest
os_family: macOS
arch: arm64
- runner: ubuntu-24.04-arm
os_family: linux
arch: arm64
- runner: windows-latest
os_family: windows
arch: amd64
runs-on: ${{ matrix.runner }}
steps:
- name: Checkout repo
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6
with:
fetch-depth: 0
submodules: recursive
ref: ${{ env.INPUT_REF }}
- name: Set up Java
if: matrix.os_family != 'linux'
uses: actions/setup-java@be666c2fcd27ec809703dec50e508c2fdc7f6654 # v5
with:
java-version: 23
distribution: "graalvm"
- name: Set up Gradle
if: matrix.os_family != 'linux'
uses: gradle/actions/setup-gradle@ac396bf1a80af16236baf54bd7330ae21dc6ece5 # v6
- name: Build native test server (non-Docker)
if: matrix.os_family != 'linux'
run: |
./gradlew -PnativeBuild :temporal-test-server:nativeCompile
- name: Build native test server (Docker non-musl)
if: matrix.os_family == 'linux' && matrix.musl == false
run: |
IMAGE_ID=$(docker build -q ./docker/native-image)
docker run \
--rm -w /github/workspace -v "$(pwd):/github/workspace" \
"$IMAGE_ID" \
sh -c "./gradlew -PnativeBuild :temporal-test-server:nativeCompile"
- name: Build native test server (Docker musl)
if: matrix.os_family == 'linux' && matrix.musl == true
run: |
IMAGE_ID=$(docker build -q ./docker/native-image-musl)
docker run \
--rm -w /github/workspace -v "$(pwd):/github/workspace" \
"$IMAGE_ID" \
sh -c "./gradlew -PnativeBuild -PnativeBuildMusl :temporal-test-server:nativeCompile"
# path ends in a wildcard because on windows the file ends in '.exe'
- name: Upload executable to workflow
if: ${{ inputs.upload_artifact }}
uses: actions/upload-artifact@bbbca2ddaa5d8feaa63e36b76fdaad77386f024f # v7
with:
name: ${{ matrix.musl && format('{0}_{1}_musl', matrix.os_family, matrix.arch) || format('{0}_{1}', matrix.os_family, matrix.arch)}}
path: |
temporal-test-server/build/native/nativeCompile/temporal-test-server*
if-no-files-found: error
retention-days: 1