-
Notifications
You must be signed in to change notification settings - Fork 3
131 lines (124 loc) · 4.64 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
# This workflow will build a Java project with Gradle
# For more information see: https://help.github.com/actions/language-and-framework-guides/building-and-testing-java-with-gradle
name: Java CI with Gradle
on:
push:
branches: [ main ]
pull_request:
branches: [ main ]
jobs:
build:
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-latest, windows-latest, macos-latest]
architecture: [x86, x86_64, aarch32, aarch64]
exclude:
- os: macos-latest
architecture: x86
- os: macos-latest
architecture: aarch32
- os: macos-latest
architecture: aarch64
steps:
- name: Get latest CMake
# Using 'latest' branch, the latest CMake is installed.
uses: lukka/get-cmake@latest
- uses: actions/checkout@v3
with:
submodules: 'recursive'
- name: Set up x86 JDK 1.8
if: matrix.architecture == 'x86'
uses: actions/setup-java@v1
with:
java-version: 1.8
architecture: x86
- name: Set up x64 JDK 1.8
if: matrix.architecture != 'x86'
uses: actions/setup-java@v1
with:
java-version: 1.8
architecture: x64
- name: Build with Gradle
env:
ARCHITECTURE: ${{ matrix.architecture }}
OS: ${{ matrix.os }}
shell: bash
run: |
armJdkPath=""
if [ $OS = "ubuntu-latest" ]; then
sudo apt update
if [ $ARCHITECTURE = "aarch32" ]; then
sudo apt install qemu-user qemu-user-static gcc-arm-linux-gnueabihf binutils-arm-linux-gnueabihf binutils-arm-linux-gnueabihf-dbg g++-arm-linux-gnueabihf
wget https://github.com/AdoptOpenJDK/openjdk8-binaries/releases/download/jdk8u292-b10/OpenJDK8U-jdk_arm_linux_hotspot_8u292b10.tar.gz
tar -xvzf OpenJDK8U-jdk_arm_linux_hotspot_8u292b10.tar.gz && mv jdk8u292-b10-aarch32-20210423 aarch32JDK
armJdkPath="./aarch32JDK"
elif [ $ARCHITECTURE = "aarch64" ]; then
sudo apt install qemu-user qemu-user-static gcc-aarch64-linux-gnu binutils-aarch64-linux-gnu binutils-aarch64-linux-gnu-dbg build-essential g++-aarch64-linux-gnu
wget https://github.com/AdoptOpenJDK/openjdk8-binaries/releases/download/jdk8u292-b10/OpenJDK8U-jdk_aarch64_linux_hotspot_8u292b10.tar.gz
tar -xvzf OpenJDK8U-jdk_aarch64_linux_hotspot_8u292b10.tar.gz && mv jdk8u292-b10 aarch64JDK
armJdkPath="./aarch64JDK"
elif [ $ARCHITECTURE == "x86" ]; then
sudo apt-get install gcc-multilib g++-multilib
fi
fi
if [ $OS = "windows-latest" ] && ([ $ARCHITECTURE = "aarch32" ] || [ $ARCHITECTURE = "aarch64" ]); then
./gradlew build -P${ARCHITECTURE}Build -ParmJdkPath=${armJdkPath} -Pj=2 -x test
else
./gradlew build -P${ARCHITECTURE}Build -ParmJdkPath=${armJdkPath} -Pj=2
fi
- name: Upload artifact
if: matrix.os == 'ubuntu-latest' || matrix.os == 'macOS-latest'
uses: actions/upload-artifact@v3
with:
name: Package-${{ matrix.os }}-${{ matrix.architecture }}
path: build/natives/lib/Release
- name: Upload Windows artifact
if: matrix.os == 'windows-latest'
uses: actions/upload-artifact@v3
with:
name: Package-${{ matrix.os }}-${{ matrix.architecture }}
path: build/natives/bin/Release
combine:
name: Download platform-specific binaries and combine into single JAR
needs: [build]
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
submodules: 'recursive'
- name: Set up JDK 1.8
uses: actions/setup-java@v1
with:
java-version: 1.8
- name: Create directory
shell: bash
run: |
mkdir -p ./build/natives/downloads
- name: Download binaries
uses: actions/download-artifact@v3
with:
path: ./build/natives/downloads/
- name: Extract binaries from subdirectories
shell: bash
run: |
dirArray=(./build/natives/downloads/*/);
for dir in "${dirArray[@]}"; do
cp -a ${dir}. ./build/natives/downloads/;
rm -r ${dir};
done
- name: Repackage JAR with all binaries
shell: bash
run: ./gradlew build -x compileJNI -x test
- name: Create pom file for maven
run: ./gradlew createPom
- name: Upload pom file
uses: actions/upload-artifact@v3
with:
name: PomFile
path: ./build/pom/
- name: Upload final JAR
uses: actions/upload-artifact@v3
with:
name: FinalJAR
path: build/libs