forked from apache/netbeans
-
Notifications
You must be signed in to change notification settings - Fork 0
346 lines (298 loc) · 12 KB
/
native-binary-build-lib.profiler.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
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you 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.
# ----------------------
#
# This workflow builds the native binaries for lib.profiler, meaning it
# builds the so-called 'profilerinterface' library from the C source code
# hosted in profiler/lib.profiler/native.
#
# The following builds are made:
# - On a Linux X64 host (Ubuntu):
# - Linux X86 binary
# - Linux X64 binary
# - On a MacOS X64 host:
# - MacOS X64 binary
# - (for the future: we can consider an Apple Sillicon build here
# as well, aka 'arm64', but currently this is not implemented)
# - On a Windows Server X64 host:
# - Windows X86 binary
# - Windows X64 binary
#
# ..meaning we build 32-bit binaries on 64-bit hosts.
#
# The result of the build is file 'profiler-external-binaries-ASF.zip'
# which can be downloaded from the GitHub Actions UI and prepared for release
# to be used by the Ant build scripts for the NetBeans distribution.
#
# Historically there has been native builds made of this code for other
# platforms, e.g Solaris SPARC, HP-UX and so on. We no longer care about
# such platforms, however build scripts for such platforms still exists in
# the repo in the 'legacy' folder.
#
# ----------------------
name: NetBeans Profiler Libraries
on:
# Triggers the workflow on push or pull request events but only for
# relevant paths
push:
paths:
- .github/workflows/native-binary-build-lib.profiler.y*
- profiler/lib.profiler/**
pull_request:
paths:
- .github/workflows/native-binary-build-lib.profiler.y*
- profiler/lib.profiler/**
# Allows you to run this workflow manually from the Actions tab in GitHub UI
workflow_dispatch:
# cancel other PR workflow run in the same head-base group if it exists (e.g. during PR syncs)
# if this is not a PR run (no github.head_ref and github.base_ref defined), use an UID as group
concurrency:
group: profiler-${{ github.head_ref || github.run_id }}-${{ github.base_ref }}
cancel-in-progress: true
jobs:
source:
name: Build source zip
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
with:
persist-credentials: false
submodules: false
show-progress: false
- name: Caching dependencies
uses: actions/cache@v3
with:
path: ~/.hgexternalcache
key: profiler-${{ runner.os }}-${{ hashFiles('*/external/binaries-list', '*/*/external/binaries-list') }}
restore-keys: profiler-${{ runner.os }}-
# Ant build NetBeans lib.profiler module. The sole reason for doing this - in the
# context of the native binaries for the Profiler - is to have JNI header files
- name: Generate JNI header files
run: |
export JDK_HOME=${JAVA_HOME_8_X64}
echo "Building NbBuild bootstrap (needed for next step)"
ant bootstrap
echo "Building lib.profiler module"
cd profiler/lib.profiler && ant compile
- name: Generate source bundle
run: |
SOURCES="profiler/lib.profiler/build/sources"
mkdir -p ${SOURCES}/profiler/lib.profiler
cp -r profiler/lib.profiler/native/ ${SOURCES}/profiler/lib.profiler/
cp LICENSE ${SOURCES}/LICENSE
cp NOTICE ${SOURCES}/NOTICE
ls -l -R ${SOURCES}
- name: Upload native sources
uses: actions/upload-artifact@v3
with:
name: profiler-external-sources-ASF
path: profiler/lib.profiler/build/sources/
if-no-files-found: error
build-linux:
name: Build on Linux
runs-on: ubuntu-latest
needs: source
steps:
- name: Download sources
uses: actions/download-artifact@v3
with:
name: profiler-external-sources-ASF
#
# Step 3
# Build the native binary from C source code
#
- name: Build native lib
run: |
export JDK_HOME=${JAVA_HOME_8_X64}
#
#
echo "Building 64-bit binary"
rm -f ../../release/lib/deployed/jdk16/linux-amd64/*
bash -e -x ./buildnative-linux64.sh
ls -l -R ../../release/lib/deployed/jdk16/linux-amd64
#
#
echo "Building 32-bit binary"
# Since we are on 64-bit system it means we do not by default have support
# for creating 32-bit binaries, however this support comes if we install
# the 'gcc-multilib' package for GNU C/C++.
sudo apt-get update
sudo apt-get install gcc-multilib
rm -f ../../release/lib/deployed/jdk16/linux/*
bash -e -x ./buildnative-linux.sh
ls -l -R ../../release/lib/deployed/jdk16/linux
#
#
echo "done"
working-directory: profiler/lib.profiler/native/scripts
#
# Step 4
# Upload interim build artifacts to GitHub
#
- name: Upload artifact Linux 64 bit
uses: actions/upload-artifact@v3
with:
name: linux-amd64
path: profiler/lib.profiler/release/lib/deployed/jdk16/linux-amd64/
if-no-files-found: error
- name: Upload artifact Linux 32 bit
uses: actions/upload-artifact@v3
with:
name: linux
path: profiler/lib.profiler/release/lib/deployed/jdk16/linux/
if-no-files-found: error
build-windows:
name: Build on Windows
runs-on: windows-latest
needs: source
steps:
- name: Download sources
uses: actions/download-artifact@v3
with:
name: profiler-external-sources-ASF
# Build the native binary from C source code
#
# Use Windows 10 SDK 10.0.20348.0 since build fails with Windows 11 SDK 10.0.22000.0
# https://docs.microsoft.com/en-us/cpp/build/building-on-the-command-line?view=msvc-170#vcvarsall-syntax
# https://bugs.python.org/issue45220
#
- name: Build native lib (64-bit)
run: |
echo on
set JDK_HOME=%JAVA_HOME_8_X64%
echo "Building 64-bit binary"
set OUTPUTDIR=../../release/lib/deployed/jdk16/windows-amd64
del /q /s "%OUTPUTDIR%"
rem set up a Visual Studio command prompt for 64-bit development
call "C:\Program Files\Microsoft Visual Studio\2022\Enterprise\VC\Auxiliary\Build\vcvars64.bat" 10.0.20348.0
rem
rem
call buildnative-windows64-16.bat
if exist "%OUTPUTDIR%\profilerinterface.lib" del "%OUTPUTDIR%\profilerinterface.lib"
if exist "%OUTPUTDIR%\profilerinterface.exp" del "%OUTPUTDIR%\profilerinterface.exp"
ls -l -R "%OUTPUTDIR%"
echo "done"
shell: cmd
working-directory: profiler/lib.profiler/native/scripts
- name: Build native lib (32-bit)
run: |
echo on
set JDK_HOME=%JAVA_HOME_8_X64%
echo "Building 32-bit binary"
set OUTPUTDIR=../../release/lib/deployed/jdk16/windows
del /q /s "%OUTPUTDIR%"
rem set up a Visual Studio command prompt for 32-bit development
call "C:\Program Files\Microsoft Visual Studio\2022\Enterprise\VC\Auxiliary\Build\vcvars32.bat" 10.0.20348.0
rem
rem
call buildnative-windows-16.bat
if exist "%OUTPUTDIR%\profilerinterface.lib" del "%OUTPUTDIR%\profilerinterface.lib"
if exist "%OUTPUTDIR%\profilerinterface.exp" del "%OUTPUTDIR%\profilerinterface.exp"
ls -l -R "%OUTPUTDIR%"
echo "done"
shell: cmd
working-directory: profiler/lib.profiler/native/scripts
#
# Step 4
# Upload interim build artifacts to GitHub
#
- name: Upload artifact Windows 64 bit
uses: actions/upload-artifact@v3
with:
name: windows-amd64
path: profiler/lib.profiler/release/lib/deployed/jdk16/windows-amd64/
if-no-files-found: error
- name: Upload artifact Windows 32 bit
uses: actions/upload-artifact@v3
with:
name: windows
path: profiler/lib.profiler/release/lib/deployed/jdk16/windows/
if-no-files-found: error
build-macos:
name: Build on MacOS
runs-on: macos-latest
needs: source
steps:
- name: Download sources
uses: actions/download-artifact@v3
with:
name: profiler-external-sources-ASF
# Build the native binary from C source code
#
- name: Build native lib
run: |
export JDK_HOME=${JAVA_HOME_8_X64}
#
#
echo "Building macOS binary"
rm -f ../../release/lib/deployed/jdk16/mac/*
bash -e -x ./buildnative-mac.sh
ls -l -R ../../release/lib/deployed/jdk16/mac
#
#
echo "done"
working-directory: profiler/lib.profiler/native/scripts
#
# Step 4
# Upload interim build artifacts to GitHub
#
- name: Upload artifact MacOS 64 bit
uses: actions/upload-artifact@v3
with:
name: mac
path: profiler/lib.profiler/release/lib/deployed/jdk16/mac/
if-no-files-found: error
build-zip-with-build-artifacts:
name: Package Profiler Libraries
runs-on: ubuntu-latest
# Only run when the platform specific builds are finished
needs: [build-linux, build-windows, build-macos]
steps:
- name: Create dir structure
run: mkdir -p myfiles/lib/deployed/jdk16
- name: Download artifacts from predecessor jobs
uses: actions/download-artifact@v3
with:
path: myfiles/lib/deployed/jdk16
- name: Tidy up and display artifacts
run: |
cp myfiles/lib/deployed/jdk16/profiler-external-sources-ASF/LICENSE myfiles/LICENSE
cp myfiles/lib/deployed/jdk16/profiler-external-sources-ASF/NOTICE myfiles/NOTICE
rm -rf myfiles/lib/deployed/jdk16/*sources*
ls -l -R
- name: Create BUILDINFO
run: |
BUILDINFO="myfiles/BUILDINFO.txt"
touch "$BUILDINFO"
echo "Apache NetBeans" >> "$BUILDINFO"
echo "" >> "$BUILDINFO"
echo "Binaries in this ZIP are..." >> "$BUILDINFO"
echo "Build by GitHub Actions Workflow: ${GITHUB_WORKFLOW}" >> "$BUILDINFO"
echo "" >> "$BUILDINFO"
echo "Build from:" >> "$BUILDINFO"
echo " Git repo : ${GITHUB_SERVER_URL}/${GITHUB_REPOSITORY}" >> "$BUILDINFO"
echo " Git commit SHA : ${GITHUB_SHA}" >> "$BUILDINFO"
echo " Git ref : ${GITHUB_REF}" >> "$BUILDINFO"
echo "" >> "$BUILDINFO"
echo "Build time UTC : $(date --rfc-3339=seconds --utc)" >> "$BUILDINFO"
echo "" >> "$BUILDINFO"
- name: Upload bundle
uses: actions/upload-artifact@v3
with:
name: profiler-external-binaries-ASF
path: myfiles/
if-no-files-found: error