forked from babric/lwjgl
-
Notifications
You must be signed in to change notification settings - Fork 1
250 lines (230 loc) · 9.58 KB
/
build_or_publish.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
name: Build or Publish
on: [ push, workflow_dispatch ]
jobs:
natives:
strategy:
matrix:
include:
# Win x86
- os: windows-2022
arch: x86
java_arch: x86
msvc_arch: amd64_x86
args: -DtargetArch=x86
# Win x64
- os: windows-2022
arch: x64
msvc_arch: amd64
# Win Arm64
- os: windows-2022
arch: arm64
java_arch: x64
msvc_arch: amd64_arm64
extra_java: 17
vendor: zulu
args: -DtargetArch=arm64 -DtargetJavaHomeVar=JAVA_HOME_17_ARM64
# Mac Intel (x64)
- os: macos-13
arch: x64
args: -DtargetJavaHome="$JAVA_HOME_8_X64"
# Mac Silicon (arm64)
- os: macos-14
arch: arm64
java_arch: arm64
# Linux i386
- os: ubuntu-20.04
arch: i386
java_arch: x64
linux_arch: i386
packages: gcc-multilib
extra_java: 11
vendor: zulu
args: -DtargetJavaHome="$JAVA_HOME_11_I386" -DtargetArch=i386
# Linux amd64 Java 8
- os: ubuntu-20.04
arch: amd64
java_arch: x64
# Linux amd64 Java 11+
- os: ubuntu-20.04
arch: amd64
runs-on: ${{ matrix.os }}
continue-on-error: true
steps:
- uses: actions/checkout@v4
# Setup build dependencies
- if: matrix.linux_arch
run: |
sudo dpkg --add-architecture ${{ matrix.linux_arch }} && sudo apt-get clean && sudo apt-get update
sudo apt-get -yq -f --allow-unauthenticated --no-install-suggests --no-install-recommends install ${{ matrix.packages }} libx11-dev:${{ matrix.linux_arch }} libxrandr-dev:${{ matrix.linux_arch }} libxext-dev:${{ matrix.linux_arch }} libxcursor-dev:${{ matrix.linux_arch }} libxxf86vm-dev:${{ matrix.linux_arch }}
- if: (matrix.os == 'ubuntu-20.04' || matrix.os == 'ubuntu-22.04') && matrix.arch == 'amd64'
run: sudo apt install libx11-dev libxrandr-dev libxext-dev libxcursor-dev libxxf86vm-dev
- if: matrix.os == 'windows-latest' || matrix.os == 'windows-2022'
uses: ilammy/msvc-dev-cmd@v1
with:
arch: ${{ matrix.msvc_arch }}
# Setup target java
- if: matrix.extra_java
name: Set up ${{ matrix.arch }} ${{ matrix.vendor }} JDK ${{ matrix.extra_java }}
uses: actions/setup-java@v4
with:
java-version: ${{ matrix.extra_java }}
distribution: ${{ matrix.vendor }}
architecture: ${{ matrix.arch }}
# Setup runtime java
- if: matrix.java_arch
name: Set up ${{ matrix.java_arch }} zulu JDK 8
uses: actions/setup-java@v4
with:
java-version: 8
distribution: zulu
architecture: ${{ matrix.java_arch }}
# Build natives
- name: Build natives
run: ./gradlew compile_native ${{ matrix.args }} --stacktrace
# Upload result
- uses: actions/upload-artifact@v4
with:
name: natives-${{ matrix.os }}-${{ matrix.arch }}-${{ matrix.extra_java }}-${{ matrix.java_arch }}
path: |
lwjgl-platform/build/natives/lwjgl*.dll
lwjgl-platform/build/natives/liblwjgl*.so
lwjgl-platform/build/natives/liblwjgl*.dylib
natives-cross:
runs-on: ubuntu-latest
container:
image: ${{matrix.os}}
strategy:
matrix:
include:
# Linux aarch64
- os: ubuntu:20.04
arch: aarch64
linux_arch: arm64
packages: gcc-aarch64-linux-gnu libc6-dev-arm64-cross g++-aarch64-linux-gnu
extra_java: 11
vendor: zulu
args: -DtargetJavaHome="$JAVA_HOME_11_AARCH64" -DtargetArch=aarch64
# Linux ppc64le
- os: ubuntu:20.04
arch: ppc64le
linux_arch: ppc64el
packages: gcc-powerpc64le-linux-gnu libc6-dev-ppc64el-cross g++-powerpc64le-linux-gnu
extra_java: 11
vendor: temurin
args: -DtargetJavaHome="$JAVA_HOME_11_PPC64LE" -DtargetArch=ppc64le
# Linux riscv64
- os: ubuntu:20.04
arch: riscv64
linux_arch: riscv64
packages: gcc-riscv64-linux-gnu libc6-dev-riscv64-cross g++-riscv64-linux-gnu
args: -DtargetJavaHome="/usr/lib/jvm/java-11-openjdk-riscv64" -DtargetArch=riscv64
continue-on-error: true
steps:
- uses: actions/checkout@v4
# Setup build dependencies
- run: |
sed -i 's/deb http/deb [arch=amd64,i386] http/' /etc/apt/sources.list
grep "ubuntu.com/ubuntu" /etc/apt/sources.list | tee /etc/apt/sources.list.d/ports.list
sed -i 's/amd64,i386/${{matrix.linux_arch}}/' /etc/apt/sources.list.d/ports.list
sed -i 's#http://.*/ubuntu#http://ports.ubuntu.com/ubuntu-ports#' /etc/apt/sources.list.d/ports.list
dpkg --add-architecture ${{ matrix.linux_arch }} && apt-get clean && apt-get update
apt-get -yq -f --allow-unauthenticated --no-install-suggests --no-install-recommends install ${{ matrix.packages }} libx11-dev:${{ matrix.linux_arch }} libxrandr-dev:${{ matrix.linux_arch }} libxext-dev:${{ matrix.linux_arch }} libxcursor-dev:${{ matrix.linux_arch }} libxxf86vm-dev:${{ matrix.linux_arch }}
# Setup target java
- if: matrix.arch == 'riscv64'
run: apt-get -yq -f --allow-unauthenticated --no-install-suggests install openjdk-11-jdk:${{ matrix.linux_arch }}
- if: matrix.extra_java
name: Set up ${{ matrix.arch }} ${{ matrix.vendor }} JDK ${{ matrix.extra_java }}
uses: actions/setup-java@v4
with:
java-version: ${{ matrix.extra_java }}
distribution: ${{ matrix.vendor }}
architecture: ${{ matrix.arch }}
# Setup runtime java
- if: matrix.extra_java
name: Set up x64 zulu JDK 8
uses: actions/setup-java@v4
with:
java-version: 8
distribution: zulu
- name: Build natives
run: ./gradlew compile_native ${{ matrix.args }} --stacktrace
# Upload result
- uses: actions/upload-artifact@v4
with:
name: natives-linux-${{ matrix.arch }}
path: |
lwjgl-platform/build/natives/liblwjgl*.so
natives-debian:
strategy:
matrix:
include:
# Linux armhf
- arch: armhf
image: bullseye-backports
packages: gcc-arm-linux-gnueabihf libc6-dev-armhf-cross g++-arm-linux-gnueabihf
args: -DtargetJavaHome="/usr/lib/jvm/java-11-openjdk-armhf" -DtargetArch=armhf
# Linux armel
- arch: armel
image: bookworm-backports
packages: gcc-arm-linux-gnueabi libc6-dev-armel-cross g++-arm-linux-gnueabi
args: -DtargetJavaHome="/usr/lib/jvm/java-11-openjdk-armel" -DtargetArch=armel
# - arch: powerpc
# image: sid
# packages: gcc-powerpc-linux-gnu libc6-dev-powerpc-cross g++-powerpc-linux-gnu
# - arch: ppc64
# image: sid
# packages: gcc-powerpc64-linux-gnu libc6-dev-ppc64-cross g++-powerpc64-linux-gnu
runs-on: ubuntu-latest
continue-on-error: true
container:
image: debian:${{ matrix.image }}
steps:
- uses: actions/checkout@v4
# Setup build dependencies
- if: matrix.image == 'sid'
run: |
apt-get clean && apt-get update && apt-get -yq -f --allow-unauthenticated --no-install-suggests --no-install-recommends install debian-ports-archive-keyring
echo "deb http://ftp.ports.debian.org/debian-ports unstable main" > /etc/apt/sources.list
echo "deb http://ftp.ports.debian.org/debian-ports unreleased main" > /etc/apt/sources.list
echo "deb http://ftp.ports.debian.org/debian-ports experimental main" > /etc/apt/sources.list
- run: dpkg --add-architecture ${{ matrix.arch }} && apt-get clean && apt-get update
- run: apt-get -yq -f --allow-unauthenticated --no-install-suggests --no-install-recommends install ${{ matrix.packages }}
- run: apt-get -yq -f --allow-unauthenticated --no-install-suggests --no-install-recommends install libx11-dev:${{ matrix.arch }} libxrandr-dev:${{ matrix.arch }} libxext-dev:${{ matrix.arch }} libxcursor-dev:${{ matrix.arch }} libxxf86vm-dev:${{ matrix.arch }}
# Setup target java
- run: apt-get -yq -f --allow-unauthenticated --no-install-suggests --no-install-recommends install openjdk-11-jdk:${{ matrix.arch }}
# Build natives
- name: Build natives
run: ./gradlew compile_native ${{ matrix.args }} --stacktrace
# Upload result
- uses: actions/upload-artifact@v4
with:
name: natives-linux-${{ matrix.arch }}
path: |
lwjgl-platform/build/natives/liblwjgl*.so
build:
runs-on: ubuntu-latest
needs: [natives, natives-debian, natives-cross]
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Set up JDK 8
uses: actions/setup-java@v4
with:
java-version: 8
distribution: zulu
- uses: actions/download-artifact@v4
with:
path: lwjgl-platform/build/natives
pattern: natives-*
merge-multiple: true
- name: Build
run: ./gradlew publishToMavenLocal --stacktrace
- uses: actions/upload-artifact@v4
with:
name: maven
path: ~/.m2/repository
- if: ${{ github.event_name == 'workflow_dispatch' }}
name: Publish to Maven
run: ./gradlew publish --stacktrace
env:
MAVEN_PUBLISH_CREDENTIALS: ${{ secrets.MAVEN_PUBLISH_CREDENTIALS }}