Repository navigation
278 lines (252 loc) · 10.2 KB
/
Copy pathplatforms.yml
File metadata and controls
278 lines (252 loc) · 10.2 KB
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
name: Platforms
# Builds the native libraries of every supported platform, tests each of them on
# a runner of its own OS and architecture, and hands them on as artifacts:
# natives-<platform> holds the webrtc-java native jar, natives-media-<platform>
# the webrtc-java-media one. Nothing is deployed here; the callers do that once,
# from all platforms together, because Maven Central publishes a version as one
# bundle.
#
# Called by build.yml for every push and PR, and by release-publish.yml for the tag it
# releases (and release.yml for dry runs), so that both build exactly the same way.
on:
workflow_call:
inputs:
version:
description: "Optional local project version override for a release dry run."
type: string
default: ''
retention-days:
description: "How long the natives artifacts are kept."
type: number
default: 1
env:
# The default webrtc.install.dir of webrtc-jni/pom.xml, below the home directory.
WEBRTC_INSTALL_FOLDER: webrtc/build
jobs:
build:
name: build (${{ matrix.platform.name }})
strategy:
fail-fast: false
matrix:
# profile: the Maven profile that selects a cross compiled classifier;
# empty when the classifier is the runner's own. The macOS Intel
# build runs on Apple Silicon and cross compiles.
platform:
- name: windows_x86_64
runs-on: windows-2022
profile: ''
- name: windows_arm64
runs-on: windows-2022
profile: windows-aarch64
- name: linux_x86-64
runs-on: ubuntu-22.04
profile: ''
- name: linux_arm64
runs-on: ubuntu-22.04
profile: linux-aarch64
- name: linux_arm
runs-on: ubuntu-22.04
profile: linux-aarch32
- name: macos_arm64
runs-on: macos-15
profile: ''
- name: macos_x86-64
runs-on: macos-15
profile: macos-cross-x86_64
runs-on: ${{ matrix.platform.runs-on }}
steps:
- name: Checkout code
uses: actions/checkout@v7
with:
ref: ${{ github.sha }}
# The media module builds FFmpeg from its third-party submodule.
submodules: true
- name: Prepare build
if: runner.os == 'Windows'
uses: ./.github/actions/prepare-windows
- name: Prepare build
if: runner.os == 'Linux'
uses: ./.github/actions/prepare-linux
- name: Prepare build
if: runner.os == 'macOS'
uses: ./.github/actions/prepare-macos
- name: Set the release dry-run version
if: inputs.version != ''
env:
RELEASE_VERSION: ${{ inputs.version }}
run: mvn -B versions:set -DnewVersion="$RELEASE_VERSION" -DgenerateBackupPoms=false
shell: bash
- name: Maven build
uses: ./.github/actions/build
with:
platform-name: ${{ matrix.platform.name }}
profile: ${{ matrix.platform.profile }}
retention-days: ${{ inputs.retention-days }}
# Every platform is tested on a runner of its own OS and architecture,
# against the natives the build job uploaded, so that what is tested is
# exactly what gets published. Most of them are cross compiled and could not
# be loaded on the runner that built them.
test-natives:
name: test-natives (${{ matrix.platform.name }})
needs: build
timeout-minutes: 30
strategy:
fail-fast: false
matrix:
# java-architecture: the JDK architecture, when it differs from the
# runner's. linux_arm runs a 32-bit ARM JDK on an arm64 runner.
platform:
- name: windows_x86_64
runs-on: windows-2022
classifier: windows-x86_64
java-distribution: temurin
java-architecture: ''
- name: windows_arm64
runs-on: windows-11-arm
classifier: windows-aarch64
java-distribution: microsoft
java-architecture: aarch64
- name: linux_x86-64
runs-on: ubuntu-22.04
classifier: linux-x86_64
java-distribution: temurin
java-architecture: ''
- name: linux_arm64
runs-on: ubuntu-22.04-arm
classifier: linux-aarch64
java-distribution: temurin
java-architecture: ''
- name: linux_arm
runs-on: ubuntu-22.04-arm
classifier: linux-aarch32
java-distribution: liberica
java-architecture: armv7
- name: macos_arm64
runs-on: macos-15
classifier: macos-aarch64
java-distribution: temurin
java-architecture: ''
- name: macos_x86-64
runs-on: macos-15-intel
classifier: macos-x86_64
java-distribution: temurin
java-architecture: ''
runs-on: ${{ matrix.platform.runs-on }}
steps:
- name: Checkout code
uses: actions/checkout@v7
with:
ref: ${{ github.sha }}
- name: Test natives
uses: ./.github/actions/test-natives
with:
platform-name: ${{ matrix.platform.name }}
classifier: ${{ matrix.platform.classifier }}
profile: ${{ matrix.platform.classifier }}
java-distribution: ${{ matrix.platform.java-distribution }}
java-architecture: ${{ matrix.platform.java-architecture }}
version: ${{ inputs.version }}
# The tests once more under -Xcheck:jni, once per OS: the JNI glue is shared,
# but the device modules, capturers and hardware codecs that call back into
# Java are not, so each OS has JNI code of its own. One architecture each is
# enough, since that code is the same across them. It fails on any JNI error
# or warning, see the test-natives action. Disabled for now.
jni-check:
name: jni-check (${{ matrix.platform.name }})
if: false
needs: build
timeout-minutes: 30
strategy:
fail-fast: false
matrix:
platform:
- name: linux_x86-64
runs-on: ubuntu-22.04
classifier: linux-x86_64
- name: macos_arm64
runs-on: macos-15
classifier: macos-aarch64
- name: windows_x86_64
runs-on: windows-2022
classifier: windows-x86_64
runs-on: ${{ matrix.platform.runs-on }}
steps:
- name: Checkout code
uses: actions/checkout@v7
with:
ref: ${{ github.sha }}
- name: Test natives under -Xcheck:jni
uses: ./.github/actions/test-natives
with:
platform-name: ${{ matrix.platform.name }}
classifier: ${{ matrix.platform.classifier }}
profile: ${{ matrix.platform.classifier }}
java-distribution: temurin
version: ${{ inputs.version }}
jni-check: 'true'
# The native image example, built with GraalVM against the natives the build
# job uploaded, which the image carries inside itself. It connects two peers
# and exits with an error unless video, audio, channel messages, statistics
# and log messages all arrived. --exact-reachability-metadata makes anything
# the metadata of webrtc-java lacks fail at once, which would otherwise only
# fail where a lookup happens to find nothing.
native-image:
name: native-image (linux_x86-64)
needs: build
timeout-minutes: 30
runs-on: ubuntu-22.04
steps:
- name: Checkout code
uses: actions/checkout@v7
with:
ref: ${{ github.sha }}
- name: Download natives
uses: actions/download-artifact@v8
with:
name: natives-linux_x86-64
path: natives
- name: Download media natives
uses: actions/download-artifact@v8
with:
name: natives-media-linux_x86-64
path: natives
- name: Install runtime libraries
run: |
sudo apt-get update
sudo apt-get install -y libx11-6 libxext6 libxfixes3 libxdamage1 libxtst6 libxrandr2 libxcomposite1 libglib2.0-0 libgbm1 libdrm2
# Through setup-java, as this repository allows only actions of GitHub
# itself: an action it does not allow makes the whole workflow fail to
# start. Its graalvm distribution is Oracle GraalVM, native-image included.
- name: Set up GraalVM
uses: actions/setup-java@v6
with:
java-version: '25'
distribution: 'graalvm'
- name: Set the release dry-run version
if: inputs.version != ''
env:
RELEASE_VERSION: ${{ inputs.version }}
run: mvn -B versions:set -DnewVersion="$RELEASE_VERSION" -DgenerateBackupPoms=false
# The example resolves the libraries from the local repository, natives
# included, as an application does. webrtc attaches its natives from
# webrtc-jni/target and needs them installed beforehand, since it depends
# on them itself; webrtc-media packages its own from target/natives.
- name: Install the libraries with the natives
run: |
VERSION=$(sed -n 's|.*<version>\([^<]*\)</version>.*|\1|p' pom.xml | head -n 1)
WEBRTC_JAR=$(find natives -name 'webrtc-java-*-linux-x86_64.jar' ! -name 'webrtc-java-media-*' | head -n 1)
MEDIA_JAR=$(find natives -name 'webrtc-java-media-*-linux-x86_64.jar' | head -n 1)
if [ -z "$VERSION" ] || [ -z "$WEBRTC_JAR" ] || [ -z "$MEDIA_JAR" ]; then
echo "Missing the version ($VERSION) or a native jar ($WEBRTC_JAR, $MEDIA_JAR)" >&2
exit 1
fi
mvn -B -q install:install-file -Dfile="$WEBRTC_JAR" -DgroupId=dev.onvoid.webrtc \
-DartifactId=webrtc-java -Dversion="$VERSION" -Dpackaging=jar -Dclassifier=linux-x86_64
mkdir -p webrtc-jni/target webrtc-media/target/natives
cp "$WEBRTC_JAR" "webrtc-jni/target/webrtc-java-$VERSION-linux-x86_64.jar"
(cd webrtc-media/target/natives && "$JAVA_HOME/bin/jar" xf "$GITHUB_WORKSPACE/$MEDIA_JAR" && rm -rf META-INF)
mvn -B -pl .,webrtc,webrtc-media,webrtc-swing,webrtc-javafx install -DskipNativeBuild -DskipTests
- name: Build the native image
run: mvn -B -pl webrtc-examples -Pnative package
- name: Run the native image
run: timeout 120 webrtc-examples/target/webrtc-native-image-example