-
Notifications
You must be signed in to change notification settings - Fork 213
308 lines (270 loc) · 11.2 KB
/
release.yaml
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
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
#
# Copyright (c) 2017 Angelo Zerr and other contributors as
# indicated by the @author tags.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
name: Release
on:
# manual trigger
workflow_dispatch:
# build on new tags
push:
tags:
- '*'
env:
JAVA_VERSION: '22'
jobs:
build:
name: 'Build with GraalVM on ${{ matrix.os }}'
strategy:
fail-fast: true
matrix:
# binaries wanted: linux amd64, mac intel, mac M1, windows x86
os: [ ubuntu-latest, macos-13, macos-14, windows-latest ]
runs-on: ${{ matrix.os }}
steps:
- name: 'Check out repository'
uses: actions/checkout@v4
- name: 'Set vars'
shell: bash
run: |
ARCH=$(echo '${{ runner.arch }}' | awk '{print tolower($0)}')
if [[ $ARCH == 'x64' ]]
then
echo "ARCH=amd64" >> $GITHUB_ENV
elif [[ $ARCH == 'arm64' ]]
then
echo "ARCH=aarch64" >> $GITHUB_ENV
else
echo "ARCH=$ARCH" >> $GITHUB_ENV
fi
OS=$(echo '${{ runner.os }}' | awk '{print tolower($0)}')
if [[ $OS == 'macos' ]]
then
echo "OS=darwin" >> $GITHUB_ENV
else
echo "OS=$OS" >> $GITHUB_ENV
fi
echo "VERSION=$(./mvnw help:evaluate -Dexpression=project.version -q -DforceStdout)" >> $GITHUB_ENV
- name: 'Set up GraalVM'
uses: graalvm/setup-graalvm@v1
with:
java-version: ${{ env.JAVA_VERSION }}
distribution: 'graalvm'
github-token: ${{ secrets.GITHUB_TOKEN }}
- name: 'Maven clean'
run: ./mvnw clean -Dmrm=false -B -ntp -e
- name: 'Patch GraalVM libs for only requiring glibc 2.12'
if: ${{ env.OS == 'linux' }}
shell: bash
run: |
mkdir -p client/target/graalvm-libs-for-glibc-2.12
: patch common libraries
( find "$GRAALVM_HOME/lib/static/linux-amd64/glibc" -name '*.a'
ls -1 /lib/x86_64-linux-gnu/libz.a
ls -1 "$GRAALVM_HOME/lib/svm/clibraries/linux-amd64/libjvm.a"
ls -1 "$GRAALVM_HOME/lib/svm/clibraries/linux-amd64/liblibchelper.a"
) | while IFS= read -r input; do
output="client/target/graalvm-libs-for-glibc-2.12/$(basename -- "$input")"
objcopy --redefine-syms=client/src/main/resources/glibc/glibc.redef -- "$input" "$output" 2>/dev/null
done
: patch gcc startfile
gcc -O3 -Os -Wall -Wextra -Werror -Wconversion -Wsign-conversion -Wcast-qual -pedantic -c -o client/target/dynamic-libc-start.o client/src/main/resources/glibc/dynamic-libc-start.c
ld -r /lib/x86_64-linux-gnu/Scrt1.o client/target/dynamic-libc-start.o -o client/target/graalvm-libs-for-glibc-2.12/Scrt1.o
objcopy --redefine-syms=client/src/main/resources/glibc/glibc.redef client/target/graalvm-libs-for-glibc-2.12/Scrt1.o 2>/dev/null
- name: 'Build native distribution'
run: ./mvnw verify -Pnative -Dmrm=false -B -ntp -e -DskipTests -s .mvn/release-settings.xml
- name: 'Verify native binary for only requiring glibc 2.12'
if: ${{ env.OS == 'linux' }}
shell: bash
run: |
(( 4 == "$(ldd client/target/mvnd | awk '{print $1}' | sort -u | grep -c 'lib\(c\|dl\|rt\|pthread\)\.so\.[0-9]')" )) || ( ldd client/target/mvnd && false )
err=0
objdump -T client/target/mvnd | grep GLIBC_ | grep -v 'GLIBC_\([01]\|2\.[0-9]\|2\.1[012]\)[^0-9]' || err=$?
(( err == 1 ))
- name: 'Upload artifact'
uses: actions/upload-artifact@v4
with:
name: mvnd-${{ env.OS }}-${{ env.ARCH }}
path: |
dist/target/maven-mvnd-*.zip
dist/target/maven-mvnd-*.tar.gz
source:
name: 'Build source distributions'
runs-on: ubuntu-latest
steps:
- name: 'Check out repository'
uses: actions/checkout@v4
- name: 'Set vars'
shell: bash
run: |
ARCH=$(echo '${{ runner.arch }}' | awk '{print tolower($0)}')
if [[ $ARCH == 'x64' ]]
then
echo "ARCH=amd64" >> $GITHUB_ENV
elif [[ $ARCH == 'arm64' ]]
then
echo "ARCH=aarch64" >> $GITHUB_ENV
else
echo "ARCH=$ARCH" >> $GITHUB_ENV
fi
OS=$(echo '${{ runner.os }}' | awk '{print tolower($0)}')
if [[ $OS == 'macos' ]]
then
echo "OS=darwin" >> $GITHUB_ENV
else
echo "OS=$OS" >> $GITHUB_ENV
fi
echo "VERSION=$(./mvnw help:evaluate -Dexpression=project.version -q -DforceStdout)" >> $GITHUB_ENV
- name: 'Set up GraalVM'
uses: graalvm/setup-graalvm@v1
with:
version: ${{ env.GRAALVM_VERSION }}
java-version: ${{ env.JAVA_VERSION }}
github-token: ${{ secrets.GITHUB_TOKEN }}
- name: 'Build source distribution'
run: ./mvnw clean verify -Psource-distribution -N -B -ntp -e -s .mvn/release-settings.xml
- name: 'Upload artifact'
uses: actions/upload-artifact@v4
with:
name: mvnd-sources
path: |
target/maven-mvnd-*.zip
target/maven-mvnd-*.tar.gz
release:
runs-on: ubuntu-latest
needs: [build, source]
steps:
- name: 'Check out repository'
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: 'Download all build artifacts'
uses: actions/download-artifact@v4
- name: 'Set up Java'
uses: actions/setup-java@v4
with:
java-version: ${{ env.JAVA_VERSION }}
distribution: 'zulu'
- name: 'Cache Maven packages'
uses: actions/cache@v4
with:
path: ~/.m2
key: ${{ runner.os }}-${{ runner.arch }}-m2-${{ hashFiles('**/pom.xml') }}
restore-keys: ${{ runner.os }}-${{ runner.arch }}-m2
- name: ls -R
run: ls -R
- name: Set environment
run: |
echo "VERSION=$(./mvnw help:evaluate -Dexpression=project.version -q -DforceStdout)" >> $GITHUB_ENV
- name: Create Release
id: create_release
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: ${{ env.VERSION }}
release_name: ${{ env.VERSION }}
draft: true
prerelease: false
- name: Deploy maven-mvnd-src.zip
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: mvnd-sources/maven-mvnd-${{ env.VERSION }}-src.zip
asset_name: maven-mvnd-${{ env.VERSION }}-src.zip
asset_content_type: application/zip
- name: Deploy maven-mvnd-src.tar.gz
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: mvnd-sources/maven-mvnd-${{ env.VERSION }}-src.tar.gz
asset_name: maven-mvnd-${{ env.VERSION }}-src.tar.gz
asset_content_type: application/tar.gz
- name: Deploy maven-mvnd-linux-amd64.zip
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: mvnd-linux-amd64/maven-mvnd-${{ env.VERSION }}-linux-amd64.zip
asset_name: maven-mvnd-${{ env.VERSION }}-linux-amd64.zip
asset_content_type: application/zip
- name: Deploy maven-mvnd-linux-amd64.tar.gz
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: mvnd-linux-amd64/maven-mvnd-${{ env.VERSION }}-linux-amd64.tar.gz
asset_name: maven-mvnd-${{ env.VERSION }}-linux-amd64.tar.gz
asset_content_type: application/x-gzip
- name: Deploy maven-mvnd-darwin-amd64.zip
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: mvnd-darwin-amd64/maven-mvnd-${{ env.VERSION }}-darwin-amd64.zip
asset_name: maven-mvnd-${{ env.VERSION }}-darwin-amd64.zip
asset_content_type: application/zip
- name: Deploy maven-mvnd-darwin-amd64.tar.gz
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: mvnd-darwin-amd64/maven-mvnd-${{ env.VERSION }}-darwin-amd64.tar.gz
asset_name: maven-mvnd-${{ env.VERSION }}-darwin-amd64.tar.gz
asset_content_type: application/x-gzip
- name: Deploy maven-mvnd-darwin-aarch64.zip
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: mvnd-darwin-aarch64/maven-mvnd-${{ env.VERSION }}-darwin-aarch64.zip
asset_name: maven-mvnd-${{ env.VERSION }}-darwin-aarch64.zip
asset_content_type: application/zip
- name: Deploy maven-mvnd-darwin-aarch64.tar.gz
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: mvnd-darwin-aarch64/maven-mvnd-${{ env.VERSION }}-darwin-aarch64.tar.gz
asset_name: maven-mvnd-${{ env.VERSION }}-darwin-aarch64.tar.gz
asset_content_type: application/x-gzip
- name: Deploy maven-mvnd-windows-amd64.zip
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: mvnd-windows-amd64/maven-mvnd-${{ env.VERSION }}-windows-amd64.zip
asset_name: maven-mvnd-${{ env.VERSION }}-windows-amd64.zip
asset_content_type: application/zip
- name: Deploy maven-mvnd-windows-amd64.tar.gz
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: mvnd-windows-amd64/maven-mvnd-${{ env.VERSION }}-windows-amd64.tar.gz
asset_name: maven-mvnd-${{ env.VERSION }}-windows-amd64.tar.gz
asset_content_type: application/x-gzip