-
Notifications
You must be signed in to change notification settings - Fork 8
331 lines (326 loc) · 13.9 KB
/
buildJDK.yml
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
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
on:
push:
paths:
- 'build.java'
- '.github/workflows/buildJDK.yml'
- 'resources/truffle-api-removal.patch'
- 'resources/mandrel-packaging-wrapper.patch'
pull_request:
types: [opened, synchronize, reopened, ready_for_review]
paths:
- 'build.java'
- '.github/workflows/buildJDK.yml'
- 'resources/truffle-api-removal.patch'
- 'resources/mandrel-packaging-wrapper.patch'
env:
MX_GIT_CACHE: refcache
JAVA_HOME: /opt/jdk
MANDREL_REPO: ${{ github.workspace }}/mandrel
MX_HOME: ${{ github.workspace }}/mx
MANDREL_VERSION: 10.9.8.7 test-build
# The following aims to reduce CI CPU cycles by:
# 1. Cancelling any previous builds of this PR when pushing new changes to it
# 2. Cancelling any previous builds of a branch when pushing new changes to it in a fork
# 3. Cancelling any pending builds, but not active ones, when pushing to a branch in the main
# repository. This prevents us from constantly cancelling CI runs, while being able to skip
# intermediate builds. E.g., if we perform two pushes the first one will start a CI job and
# the second one will add another one to the queue; if we perform a third push while the
# first CI job is still running the previously queued CI job (for the second push) will be
# cancelled and a new CI job will be queued for the latest (third) push.
concurrency:
group: "workflow = ${{ github.workflow }}, ref = ${{ github.event.ref }}, pr = ${{ github.event.pull_request.id }}"
cancel-in-progress: ${{ github.event_name == 'pull_request' || github.repository != 'graalvm/mandrel-packaging' }}
jobs:
build-and-test:
name: Linux Build and test ${{ matrix.mandrel-ref }} branch/tag
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
mandrel-ref: [mandrel/22.3]
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v2
with:
repository: graalvm/mandrel.git
fetch-depth: 1
ref: ${{ matrix.mandrel-ref }}
path: ${{ github.workspace }}/mandrel
- uses: actions/checkout@v2
with:
repository: graalvm/mx.git
fetch-depth: 1
ref: master
path: ${{ github.workspace }}/mx
- uses: actions/cache@v2.1.5
with:
path: ~/.mx
key: ${{ runner.os }}-mx-${{ hashFiles('**/suite.py') }}
restore-keys: |
${{ runner.os }}-mx-
- uses: actions/cache@v2.1.5
with:
path: ~/.m2/repository
key: ${{ runner.os }}-mx-${{ hashFiles('**/suite.py') }}
restore-keys: |
${{ runner.os }}-${{ matrix.quarkus-name }}-maven-
- name: Get latest openJDK17 with static libs
run: |
curl -sL https://api.adoptium.net/v3/binary/latest/17/ea/linux/x64/jdk/hotspot/normal/eclipse -o jdk.tar.gz
curl -sL https://api.adoptium.net/v3/binary/latest/17/ea/linux/x64/staticlibs/hotspot/normal/eclipse -o jdk-static-libs.tar.gz
mkdir -p ${JAVA_HOME}
tar xf jdk.tar.gz -C ${JAVA_HOME} --strip-components=1
tar xf jdk-static-libs.tar.gz -C ${JAVA_HOME} --strip-components=1
echo ${JAVA_HOME}
${JAVA_HOME}/bin/java --version
- name: Build Mandrel JDK
run: |
${JAVA_HOME}/bin/java -ea build.java --verbose --mx-home ${MX_HOME} --mandrel-repo ${MANDREL_REPO} --mandrel-version "${MANDREL_VERSION}" --archive-suffix tar.gz
export MANDREL_VERSION_UNTIL_SPACE="$( echo ${MANDREL_VERSION} | sed -e 's/\([^ ]*\).*/\1/;t' )"
export ARCHIVE_NAME="mandrel-java17-linux-amd64-${MANDREL_VERSION_UNTIL_SPACE}.tar.gz"
mv ${ARCHIVE_NAME} mandrel-java17-linux-amd64.tar.gz
- name: Smoke tests
run: |
export MANDREL_VERSION_UNTIL_SPACE="$( echo ${MANDREL_VERSION} | sed -e 's/\([^ ]*\).*/\1/;t' )"
export MANDREL_HOME=${PWD}/mandrel-java17-${MANDREL_VERSION_UNTIL_SPACE}
${MANDREL_HOME}/bin/native-image --version
${MANDREL_HOME}/bin/native-image --version | grep "${MANDREL_VERSION}"
echo "
public class HelloStrict {
public static void main(String[] args) {
System.out.printf(
\"Hello %1$,.12f %2$,.12f %3$,.12f %n\"
, StrictMath.cos(0.0)
, StrictMath.IEEEremainder(3.0, 5.0)
, StrictMath.IEEEremainder(-16.3, 4.1)
);
}
}
" > HelloStrict.java
${MANDREL_HOME}/bin/javac HelloStrict.java
${MANDREL_HOME}/bin/java HelloStrict | tee java.txt
${MANDREL_HOME}/bin/native-image HelloStrict
./hellostrict | tee native.txt
diff java.txt native.txt
${MANDREL_HOME}/bin/native-image --macro:native-image-launcher
- name: Upload Mandrel build
uses: actions/upload-artifact@v1
with:
name: mandrel-java17-linux-amd64-test-build
path: mandrel-java17-linux-amd64.tar.gz
- name: Build Mandrel JDK with tarxz suffix
run: |
git -C ${MANDREL_REPO} checkout .
${JAVA_HOME}/bin/java -ea build.java --mx-home ${MX_HOME} --mandrel-repo ${MANDREL_REPO} --mandrel-version "${MANDREL_VERSION}" --archive-suffix tarxz --skip-clean --skip-java --skip-native
export MANDREL_VERSION_UNTIL_SPACE="$( echo ${MANDREL_VERSION} | sed -e 's/\([^ ]*\).*/\1/;t' )"
export ARCHIVE_NAME="mandrel-java17-linux-amd64-${MANDREL_VERSION_UNTIL_SPACE}.tarxz"
mv ${ARCHIVE_NAME} mandrel-java17-linux-amd64.tarxz
- name: Upload tarxz Mandrel build
uses: actions/upload-artifact@v1
with:
name: mandrel-java17-linux-amd64-test-build-tarxz
path: mandrel-java17-linux-amd64.tarxz
build-and-test-on-windows:
name: Windows Build and test ${{ matrix.mandrel-ref }} branch/tag
runs-on: windows-2019
strategy:
fail-fast: false
matrix:
mandrel-ref: [mandrel/22.3]
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v2
with:
repository: graalvm/mandrel.git
fetch-depth: 1
ref: ${{ matrix.mandrel-ref }}
path: ${{ github.workspace }}/mandrel
- uses: actions/checkout@v2
with:
repository: graalvm/mx.git
fetch-depth: 1
ref: master
path: ${{ github.workspace }}/mx
- uses: actions/cache@v2.1.5
with:
path: ~/.mx
key: ${{ runner.os }}-mx-${{ hashFiles('**/suite.py') }}
restore-keys: |
${{ runner.os }}-mx-
- uses: actions/cache@v2.1.5
with:
path: ~/.m2/repository
key: ${{ runner.os }}-mx-${{ hashFiles('**/suite.py') }}
restore-keys: |
${{ runner.os }}-${{ matrix.quarkus-name }}-maven-
- name: Get latest openJDK17 with static libs
run: |
$wc = New-Object System.Net.WebClient
$wc.DownloadFile("https://api.adoptium.net/v3/binary/latest/17/ea/windows/x64/jdk/hotspot/normal/eclipse", "$Env:temp\jdk.zip")
Expand-Archive "$Env:temp\jdk.zip" -DestinationPath "$Env:temp"
Move-Item -Path "$Env:temp\jdk-*" -Destination $Env:JAVA_HOME
$wc.DownloadFile("https://api.adoptium.net/v3/binary/latest/17/ea/windows/x64/staticlibs/hotspot/normal/eclipse", "$Env:temp\jdk-staticlibs.zip")
Expand-Archive "$Env:temp\jdk-staticlibs.zip" -DestinationPath "$Env:temp"
Move-Item -Path "$Env:temp\jdk-*\lib\static" -Destination $Env:JAVA_HOME\lib\
Remove-Item -Recurse "$Env:temp\jdk-*"
& $Env:JAVA_HOME\bin\java -version
- name: Build Mandrel
run: |
cmd.exe /c "call `"C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\VC\Auxiliary\Build\vcvars64.bat`" && set > %temp%\vcvars64.txt"
Get-Content "$Env:temp\vcvars64.txt" | Foreach-Object {
if ($_ -match "^(.*?)=(.*)$") {
Set-Content "Env:\$($matches[1])" $matches[2]
}
}
& $Env:JAVA_HOME\bin\java -ea build.java `
--verbose `
--mx-home $Env:MX_HOME `
--mandrel-version $Env:MANDREL_VERSION `
--mandrel-repo $Env:MANDREL_REPO `
--archive-suffix zip
- name: Smoke tests
run: |
cmd.exe /c "call `"C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\VC\Auxiliary\Build\vcvars64.bat`" && set > %temp%\vcvars64.txt"
Get-Content "$Env:temp\vcvars64.txt" | Foreach-Object {
if ($_ -match "^(.*?)=(.*)$") {
Set-Content "Env:\$($matches[1])" $matches[2]
}
}
$MANDREL_VERSION_UNTIL_SPACE=$Env:MANDREL_VERSION -replace "^(.*?) .*$","`$1"
$MANDREL_HOME=".\mandrel-java17-$MANDREL_VERSION_UNTIL_SPACE"
$VERSION=(& $MANDREL_HOME\bin\native-image.cmd --version)
Write-Host $VERSION
if ("$VERSION" -NotMatch "$Env:MANDREL_VERSION") {
exit 1
}
Set-Content -Path 'HelloStrict.java' -Value "
public class HelloStrict {
public static void main(String[] args) {
System.out.printf(
`"Hello %1$,.12f %2$,.12f %3$,.12f %n`"
, StrictMath.cos(0.0)
, StrictMath.IEEEremainder(3.0, 5.0)
, StrictMath.IEEEremainder(-16.3, 4.1)
);
}
}
"
& $MANDREL_HOME\bin\javac HelloStrict.java
& $MANDREL_HOME\bin\java HelloStrict | Set-Content java.txt
& $MANDREL_HOME\bin\native-image.cmd HelloStrict
& ./hellostrict | Set-Content native.txt
$DIFF=(Compare-Object -CaseSensitive (Get-Content java.txt) (Get-Content native.txt))
if ($DIFF -ne $null) {
Write-Host $DIFF
exit 1
}
# $PREFIX && ${MANDREL_HOME}/bin/native-image.cmd --macro:native-image-launcher
- name: Rename mandrel archive
shell: bash
run: |
export MANDREL_VERSION_UNTIL_SPACE="$( echo ${MANDREL_VERSION} | sed -e 's/\([^ ]*\).*/\1/;t' )"
export ARCHIVE_NAME="mandrel-java17-windows-amd64-${MANDREL_VERSION_UNTIL_SPACE}.zip"
mv ${ARCHIVE_NAME} mandrel-java17-windows-amd64.zip
- name: Upload Mandrel build
uses: actions/upload-artifact@v1
with:
name: mandrel-java17-windows-amd64-test-build
path: mandrel-java17-windows-amd64.zip
build-and-test-2-step:
name: 2-step Linux Build and test ${{ matrix.mandrel-ref }} branch/tag
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
mandrel-ref: [mandrel/22.3]
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v2
with:
repository: graalvm/mandrel.git
fetch-depth: 1
ref: ${{ matrix.mandrel-ref }}
path: ${{ github.workspace }}/mandrel
- uses: actions/checkout@v2
with:
repository: graalvm/mx.git
fetch-depth: 1
ref: master
path: ${{ github.workspace }}/mx
- uses: actions/cache@v2.1.5
with:
path: ~/.mx
key: ${{ runner.os }}-mx-${{ hashFiles('**/suite.py') }}
restore-keys: |
${{ runner.os }}-mx-
- uses: actions/cache@v2.1.5
with:
path: ~/.m2/repository
key: ${{ runner.os }}-mx-${{ hashFiles('**/suite.py') }}
restore-keys: |
${{ runner.os }}-${{ matrix.quarkus-name }}-maven-
- name: Get latest openJDK17 with static libs
run: |
curl -sL https://api.adoptium.net/v3/binary/latest/17/ea/linux/x64/jdk/hotspot/normal/eclipse -o jdk.tar.gz
curl -sL https://api.adoptium.net/v3/binary/latest/17/ea/linux/x64/staticlibs/hotspot/normal/eclipse -o jdk-static-libs.tar.gz
mkdir -p ${JAVA_HOME}
tar xf jdk.tar.gz -C ${JAVA_HOME} --strip-components=1
tar xf jdk-static-libs.tar.gz -C ${JAVA_HOME} --strip-components=1
echo ${JAVA_HOME}
${JAVA_HOME}/bin/java --version
- name: Build Mandrel JDK
run: |
# Build the Java bits
${JAVA_HOME}/bin/java -ea build.java \
--verbose \
--mx-home ${MX_HOME} \
--mandrel-repo ${MANDREL_REPO} \
--mandrel-version "${MANDREL_VERSION}" \
--skip-native \
--maven-install \
--maven-deploy \
--maven-version "${MANDREL_VERSION}-mysuffix0001" \
--maven-repo-id myRepo \
--maven-url "file:///tmp/myRepo" \
--mandrel-home temp-build
git -C ${MANDREL_REPO} checkout .
# Build the native bits
./temp-build/bin/java -ea build.java \
--verbose \
--mx-home ${MX_HOME} \
--mandrel-repo ${MANDREL_REPO} \
--mandrel-version "${MANDREL_VERSION}" \
--skip-java \
--archive-suffix tar.gz
export MANDREL_VERSION_UNTIL_SPACE="$( echo ${MANDREL_VERSION} | sed -e 's/\([^ ]*\).*/\1/;t' )"
export ARCHIVE_NAME="mandrel-java17-linux-amd64-${MANDREL_VERSION_UNTIL_SPACE}.tar.gz"
mv ${ARCHIVE_NAME} mandrel-java17-linux-amd64.tar.gz
- name: Smoke tests
run: |
export MANDREL_VERSION_UNTIL_SPACE="$( echo ${MANDREL_VERSION} | sed -e 's/\([^ ]*\).*/\1/;t' )"
export MANDREL_HOME=${PWD}/mandrel-java17-${MANDREL_VERSION_UNTIL_SPACE}
${MANDREL_HOME}/bin/native-image --version
${MANDREL_HOME}/bin/native-image --version | grep "${MANDREL_VERSION}"
echo "
public class HelloStrict {
public static void main(String[] args) {
System.out.printf(
\"Hello %1$,.12f %2$,.12f %3$,.12f %n\"
, StrictMath.cos(0.0)
, StrictMath.IEEEremainder(3.0, 5.0)
, StrictMath.IEEEremainder(-16.3, 4.1)
);
}
}
" > HelloStrict.java
${MANDREL_HOME}/bin/javac HelloStrict.java
${MANDREL_HOME}/bin/java HelloStrict | tee java.txt
${MANDREL_HOME}/bin/native-image HelloStrict
./hellostrict | tee native.txt
diff java.txt native.txt
${MANDREL_HOME}/bin/native-image --macro:native-image-launcher
- name: Upload Mandrel build
uses: actions/upload-artifact@v1
with:
name: mandrel-java17-linux-amd64-2step-test-build
path: mandrel-java17-linux-amd64.tar.gz