forked from Fazecast/jSerialComm
-
Notifications
You must be signed in to change notification settings - Fork 1
393 lines (368 loc) · 14.4 KB
/
gradle.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
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
# This workflow uses actions that are not certified by GitHub.
# They are provided by a third-party and are governed by
# separate terms of service, privacy policy, and support
# documentation.
# This workflow will build a Java project with Gradle and cache/restore any dependencies to improve the workflow execution time
# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-java-with-gradle
name: Java CI with Gradle
on:
push:
branches: [ "master" ]
pull_request:
branches: [ "master" ]
permissions:
contents: read
jobs:
linux:
strategy:
matrix:
arch: ["32", "32HF", "64", "PPC64LE", "x86", "x86_64"]
runs-on: ubuntu-latest
steps:
- name: Install apt dependencies
run: |
sudo apt-get install -y lld help2man libtool-bin libtool-doc libncurses5-dev libmpfr-dev libmpc-dev
wget http://fazecast.github.io/jSerialComm/external/CrosstoolNgConfigFiles.tgz
- uses: actions/cache/restore@v3
id: crosstool-cache
with:
path: '~/x-tools/'
key: ${{ runner.os }}-crosstool-${{ matrix.arch }}-${{ hashFiles('CrosstoolNgConfigFiles.tgz') }}
- name: Install crosstool-ng
if: steps.crosstool-cache.outputs.cache-hit != 'true'
run: |
wget http://crosstool-ng.org/download/crosstool-ng/crosstool-ng-1.25.0.tar.bz2
tar xjf crosstool-ng-1.25.0.tar.bz2
cd crosstool-ng-1.25.0
./configure --prefix=/usr
make
sudo make install
cd ..
rm -rf crosstool-ng-1.25.0 crosstool-ng-1.25.0.tar.bz2
- name: Build linux compilers
if: steps.crosstool-cache.outputs.cache-hit != 'true'
run: |
wget http://fazecast.github.io/jSerialComm/external/CrosstoolNgConfigFiles.tgz
mkdir CrosstoolNgConfigFiles
tar -xvhf CrosstoolNgConfigFiles.tgz -C ./CrosstoolNgConfigFiles
rm -rf CrosstoolNgConfigFiles.tgz
export CONFIG_SUBDIR="$( pwd )/CrosstoolNgConfigFiles"
mkdir build
cd build
cp -f "${CONFIG_SUBDIR}/jSerialComm${{ matrix.arch }}.config" .config
ct-ng upgradeconfig
sed -i 's/CT_ZLIB_VERSION="1.2.12"/CT_ZLIB_VERSION="1.2.13"/' .config
sed -i 's/CT_LOG_PROGRESS_BAR=y/CT_LOG_PROGRESS_BAR=n/' .config
ct-ng build
cd ..
rm -rf build CrosstoolNgConfigFiles
- uses: actions/cache/save@v3
if: steps.crosstool-cache.outputs.cache-hit != 'true'
with:
path: '~/x-tools/'
key: ${{ steps.crosstool-cache.outputs.cache-primary-key }}
solaris:
runs-on: ubuntu-latest
steps:
- name: Install apt dependencies
run: 'sudo apt-get install -y lld help2man libtool-bin libtool-doc libncurses5-dev libmpfr-dev libmpc-dev'
- name: Prepare Solaris compilers
run: |
mkdir ~/buildcc
mkdir -p ~/x-tools && cd ~/x-tools
wget http://fazecast.github.io/jSerialComm/external/SolarisSystemHeaders.tgz
tar xvhf SolarisSystemHeaders.tgz
mv SolarisSystemHeaders.tgz $GITHUB_WORKSPACE/
cd ~/buildcc
wget https://ftp.gnu.org/gnu/gcc/gcc-7.3.0/gcc-7.3.0.tar.gz
wget https://ftp.gnu.org/gnu/binutils/binutils-2.30.tar.gz
tar xvhf gcc-7.3.0.tar.gz
tar xvhf binutils-2.30.tar.gz
rm -rf gcc-7.3.0.tar.gz binutils-2.30.tar.gz
- uses: actions/cache/restore@v3
id: solaris-cache
with:
path: '~/x-tools/*-sun-solaris2.10'
key: ${{ runner.os }}-solaris-${{ hashFiles('SolarisSystemHeaders.tgz') }}
- name: Build x86 Solaris
if: steps.solaris-cache.outputs.cache-hit != 'true'
run: |
cd ~/buildcc
export TARGET=x86_64-sun-solaris2.10
export PREFIX="$HOME/x-tools/$TARGET"
export SYSROOT="$PREFIX/sysroot"
export PATH="$PREFIX/bin:$PATH"
mkdir -p build-binutils && cd build-binutils
../binutils-2.30/configure --prefix="$PREFIX" --target="$TARGET" --with-sysroot="$SYSROOT" --disable-nls --disable-werror
make && make install
cd .. && rm -rf build-binutils
mkdir -p build-gcc && cd build-gcc
../gcc-7.3.0/configure --prefix="$PREFIX" --target="$TARGET" --with-sysroot="$SYSROOT" --disable-nls --enable-languages=c --with-gnu-as --with-gnu-ld
make all-gcc all-target-libgcc
make install-gcc install-target-libgcc
cd .. && rm -rf build-gcc
- name: Build SPARC Solaris
if: steps.solaris-cache.outputs.cache-hit != 'true'
run: |
cd ~/buildcc
export TARGET=sparc-sun-solaris2.10
export PREFIX="$HOME/x-tools/$TARGET"
export SYSROOT="$PREFIX/sysroot"
export PATH="$PREFIX/bin:$PATH"
mkdir -p build-binutils && cd build-binutils
../binutils-2.30/configure --prefix="$PREFIX" --target="$TARGET" --with-sysroot="$SYSROOT" --disable-nls --disable-werror
make && make install
cd .. && rm -rf build-binutils
mkdir -p build-gcc && cd build-gcc
../gcc-7.3.0/configure --prefix="$PREFIX" --target="$TARGET" --with-sysroot="$SYSROOT" --disable-nls --enable-languages=c --with-gnu-as --with-gnu-ld
make all-gcc all-target-libgcc
make install-gcc install-target-libgcc
cd .. && rm -rf build-gcc
- uses: actions/cache/save@v3
if: steps.solaris-cache.outputs.cache-hit != 'true'
with:
path: '~/x-tools/*-sun-solaris2.10'
key: ${{ steps.solaris-cache.outputs.cache-primary-key }}
macos32:
runs-on: ubuntu-latest
steps:
- name: Prepare MacOS compilers
run: |
mkdir -p ~/mac-headers && cd ~/mac-headers
wget http://fazecast.github.io/jSerialComm/external/MacOSX10.13.sdk.tar.xz
cp *.tar.xz $GITHUB_WORKSPACE/
- uses: actions/cache/restore@v3
id: mac32-cache
with:
path: '~/x-tools/osx32/'
key: ${{ runner.os }}-mac32-${{ hashFiles('MacOSX10.13.sdk.tar.xz') }}
- name: Install MacOS 32-bit compiler
if: steps.mac32-cache.outputs.cache-hit != 'true'
run: |
git clone https://github.com/tpoechtrager/osxcross.git
cd osxcross
sudo tools/get_dependencies.sh
cp -f ~/mac-headers/MacOSX10.13.sdk.tar.xz tarballs/
UNATTENDED=y TARGET_DIR=$HOME/x-tools/osx32 OSX_VERSION_MIN=10.6 ./build.sh
rm -rf $HOME/x-tools/osx32/bin/o64*
cd .. && rm -rf osxcross
- uses: actions/cache/save@v3
if: steps.mac32-cache.outputs.cache-hit != 'true'
with:
path: '~/x-tools/osx32/'
key: ${{ steps.mac32-cache.outputs.cache-primary-key }}
macos64:
runs-on: ubuntu-latest
steps:
- name: Prepare MacOS compilers
run: |
mkdir -p ~/mac-headers && cd ~/mac-headers
wget http://fazecast.github.io/jSerialComm/external/MacOSX12.0.sdk.tar.xz
cp *.tar.xz $GITHUB_WORKSPACE/
- uses: actions/cache/restore@v3
id: mac64-cache
with:
path: '~/x-tools/osxcross/'
key: ${{ runner.os }}-mac64-${{ hashFiles('MacOSX12.0.sdk.tar.xz') }}
- name: Install MacOS 64-bit compiler
if: steps.mac64-cache.outputs.cache-hit != 'true'
run: |
git clone https://github.com/tpoechtrager/osxcross.git
cd osxcross
sudo tools/get_dependencies.sh
cp -f ~/mac-headers/MacOSX12.0.sdk.tar.xz tarballs/
UNATTENDED=y TARGET_DIR=$HOME/x-tools/osxcross OSX_VERSION_MIN=10.9 ./build.sh
cd .. && rm -rf osxcross
- uses: actions/cache/save@v3
if: steps.mac64-cache.outputs.cache-hit != 'true'
with:
path: '~/x-tools/osxcross/'
key: ${{ steps.mac64-cache.outputs.cache-primary-key }}
windows:
runs-on: windows-latest
steps:
- uses: actions/checkout@v3
- name: Set up JDK 6
uses: actions/setup-java@v3
with:
java-version: '6'
distribution: 'zulu'
- name: Set up JDK 9
uses: oracle-actions/[email protected]
with:
install-as-version: '9'
uri: 'https://download.java.net/java/GA/jdk9/9.0.4/binaries/openjdk-9.0.4_windows-x64_bin.tar.gz'
- name: Build Windows lib
shell: cmd
run: |
set JDK_HOME=%JAVA_HOME%
cd src\main\c\Windows
call "%ProgramFiles%\Microsoft Visual Studio\2022\Enterprise\VC\Auxiliary\Build\vcvarsall.bat" amd64
nmake.exe -f Makefile.native win64
call "%ProgramFiles%\Microsoft Visual Studio\2022\Enterprise\VC\Auxiliary\Build\vcvarsall.bat" amd64_x86
nmake.exe -f Makefile.native win32
call "%ProgramFiles%\Microsoft Visual Studio\2022\Enterprise\VC\Auxiliary\Build\vcvarsall.bat" amd64_arm
nmake.exe -f Makefile.native winarm
- name: Second Build Windows lib
shell: cmd
run: |
set JDK_HOME=%JAVA_HOME%
cd src\main\c\Windows
call "%ProgramFiles%\Microsoft Visual Studio\2022\Enterprise\VC\Auxiliary\Build\vcvarsall.bat" x86_arm64
nmake.exe -f Makefile.native winarm64
- name: Upload Windows lib
uses: actions/[email protected]
with:
name: jSerialComm-Windows
path: src/main/resources/Windows/*
build:
needs: [linux, solaris, macos32, macos64, windows]
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: nttld/setup-ndk@v1
with:
ndk-version: r25c
- name: Set up JDK 6
uses: actions/setup-java@v3
with:
java-version: '6'
distribution: 'zulu'
- name: Set up JDK 9
uses: oracle-actions/[email protected]
with:
install-as-version: '9'
uri: 'https://download.java.net/java/GA/jdk9/9.0.4/binaries/openjdk-9.0.4_linux-x64_bin.tar.gz'
- name: Install apt dependencies
run: 'sudo apt-get install -y lld help2man libtool-bin libtool-doc libncurses5-dev libmpfr-dev libmpc-dev'
## Restore Linux
- uses: actions/cache/restore@v3
with:
fail-on-cache-miss: true
path: '~/x-tools/'
key: ${{ runner.os }}-crosstool-32-
restore-keys: "${{ runner.os }}-crosstool-32-"
- uses: actions/cache/restore@v3
with:
fail-on-cache-miss: true
path: '~/x-tools/'
key: ${{ runner.os }}-crosstool-32HF-
restore-keys: "${{ runner.os }}-crosstool-32HF-"
- uses: actions/cache/restore@v3
with:
fail-on-cache-miss: true
path: '~/x-tools/'
key: ${{ runner.os }}-crosstool-64-
restore-keys: "${{ runner.os }}-crosstool-64-"
- uses: actions/cache/restore@v3
with:
fail-on-cache-miss: true
path: '~/x-tools/'
key: ${{ runner.os }}-crosstool-PPC64LE-
restore-keys: "${{ runner.os }}-crosstool-PPC64LE-"
- uses: actions/cache/restore@v3
with:
fail-on-cache-miss: true
path: '~/x-tools/'
key: ${{ runner.os }}-crosstool-x86-
restore-keys: "${{ runner.os }}-crosstool-x86-"
- uses: actions/cache/restore@v3
with:
fail-on-cache-miss: true
path: '~/x-tools/'
key: ${{ runner.os }}-crosstool-x86_64-
restore-keys: "${{ runner.os }}-crosstool-x86_64-"
- name: Add linux compilers to PATH${{ runner.os }}-crosstool
run: |
echo "$HOME/x-tools/i486-unknown-linux-gnu/bin" >> $GITHUB_PATH
echo "$HOME/x-tools/x86_64-unknown-linux-gnu/bin" >> $GITHUB_PATH
echo "$HOME/x-tools/arm-unknown-linux-gnueabi/bin" >> $GITHUB_PATH
echo "$HOME/x-tools/arm-unknown-linux-gnueabihf/bin" >> $GITHUB_PATH
echo "$HOME/x-tools/aarch64-unknown-linux-gnu/bin" >> $GITHUB_PATH
echo "$HOME/x-tools/powerpc64le-unknown-linux-gnu/bin" >> $GITHUB_PATH
## Restore Solaris
- uses: actions/cache/restore@v3
with:
fail-on-cache-miss: true
path: '~/x-tools/*-sun-solaris2.10'
key: ${{ runner.os }}-solaris-
restore-keys: "${{ runner.os }}-solaris-"
- name: Add Solaris tools to PATH
run: |
echo $HOME/x-tools/x86_64-sun-solaris2.10/bin >> $GITHUB_PATH
echo $HOME/x-tools/sparc-sun-solaris2.10/bin >> $GITHUB_PATH
## Download BSD
- name: Install FreeBSD build tools
run: |
do_wget() {
mkdir -p "$HOME/x-tools/${1}-unknown-freebsd12.4" && cd "$HOME/x-tools/${1}-unknown-freebsd12.4"
wget "http://ftp.plusline.de/FreeBSD/releases/${1}/12.4-RELEASE/base.txz"
tar -xf base.txz ./lib/ ./usr/lib/ ./usr/include/
rm base.txz
echo "$HOME/x-tools/${1}-unknown-freebsd12.4" >> $GITHUB_PATH
}
export ARCHS=("amd64" "arm64" "i386")
for arch in ${ARCHS[@]}; do
do_wget $arch &
done
wait
- name: Install OpenBSD build tools
run: |
do_wget() {
mkdir -p "$HOME/x-tools/${1}-unknown-openbsd7.3" && cd "$HOME/x-tools/${1}-unknown-openbsd7.3"
wget "https://ftp.nluug.nl/pub/OpenBSD/7.3/${1}/base73.tgz"
wget https://ftp.nluug.nl/pub/OpenBSD/7.3/${1}/comp73.tgz
tar -xf base73.tgz ./usr/lib/ ./usr/include/
tar -xf comp73.tgz ./usr/lib/ ./usr/include/
rm base73.tgz comp73.tgz
echo "$HOME/x-tools/${1}-unknown-openbsd7.3" >> $GITHUB_PATH
}
export ARCHS=("amd64" "i386")
for arch in ${ARCHS[@]}; do
do_wget $arch &
done
wait
## Restore macOS
- uses: actions/cache/restore@v3
with:
fail-on-cache-miss: true
path: '~/x-tools/osx32/'
key: ${{ runner.os }}-mac32-
restore-keys: "${{ runner.os }}-mac32-"
- uses: actions/cache/restore@v3
with:
fail-on-cache-miss: true
path: '~/x-tools/osxcross/'
key: ${{ runner.os }}-mac64-
restore-keys: "${{ runner.os }}-mac64-"
- name: Add macOS tools to PATH
run: |
echo "$HOME/x-tools/osx32/bin" >> $GITHUB_PATH
echo "$HOME/x-tools/osxcross/bin" >> $GITHUB_PATH
## Restore Windows
- name: Download a Build Artifact
uses: actions/[email protected]
with:
name: jSerialComm-Windows
path: src/main/resources/Windows
- name: Build libraries
run: |
export JDK_HOME=${JAVA_HOME}
cd src/main/c/Posix
make linux
make arm
make powerpc
make solaris
make freebsd
make openbsd
make osx
make android
- name: Build with Gradle
uses: gradle/[email protected]
with:
arguments: build
- name: Upload a Build Artifact
uses: actions/[email protected]
with:
name: jSerialComm
path: build/libs/*