-
Notifications
You must be signed in to change notification settings - Fork 3
264 lines (231 loc) · 11.1 KB
/
Copy pathci.yml
File metadata and controls
264 lines (231 loc) · 11.1 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
name: CI
on:
push:
branches: [ main, develop ]
pull_request:
branches: [ main, develop ]
workflow_dispatch:
inputs:
publish:
description: 'Publish to GitHub Packages'
required: false
default: true
type: boolean
jobs:
# ═══════════════════════════════════════════════════════════════════════════
# Cross-Platform Build (Linux/Windows native libraries and JNI)
# Runs in parallel for base and full variants
# ═══════════════════════════════════════════════════════════════════════════
build-cross-platform:
name: Build Cross-Platform (${{ matrix.variant }})
runs-on: ubuntu-latest
strategy:
matrix:
variant: [base, full]
steps:
- name: Checkout
uses: actions/checkout@v5
with:
submodules: recursive
- name: Fetch git tags for version detection
run: |
echo "Fetching tags for opus submodule to enable version detection..."
git submodule foreach git fetch --tags
echo "=== Git tags in opus submodule ==="
cd third_party/opus
git tag | grep v1.6 || echo "No v1.6.x tags found"
echo "=== Git describe test ==="
git describe --tags --match 'v*' || echo "Git describe failed"
- name: Install build dependencies
run: |
sudo apt-get update && sudo apt-get install -y \
build-essential autoconf automake libtool pkg-config \
cmake mingw-w64 gcc-aarch64-linux-gnu curl unzip
- name: Run autogen
run: |
cd third_party/opus
./autogen.sh
- name: Debug package_version after autogen
run: |
echo "=== Checking Opus submodule ==="
git submodule status third_party/opus
cd third_party/opus
echo "=== Contents of package_version (after autogen) ==="
ls -la package_version || echo "package_version not found after autogen"
if [ -f package_version ]; then
echo "package_version contents:"
cat package_version
echo "=== Sourcing package_version to verify PACKAGE_VERSION ==="
. ./package_version
echo "PACKAGE_VERSION extracted: $PACKAGE_VERSION"
else
echo "ERROR: package_version file not created by autogen.sh"
fi
- name: Download Windows JDK
run: |
curl -L -o /tmp/jdk-win.zip https://github.com/adoptium/temurin17-binaries/releases/download/jdk-17.0.11+9/OpenJDK17U-jdk_x64_windows_hotspot_17.0.11_9.zip
mkdir -p /tmp/winjdk
unzip /tmp/jdk-win.zip -d /tmp/winjdk
rm /tmp/jdk-win.zip
- name: Set build configuration
id: config
run: |
if [ "${{ matrix.variant }}" == "full" ]; then
echo "extra_configure_flags=--enable-dred --enable-osce --enable-qext" >> $GITHUB_OUTPUT
echo "cmake_dred_flag=-DKOPUS_ENABLE_DRED=ON" >> $GITHUB_OUTPUT
else
echo "extra_configure_flags=" >> $GITHUB_OUTPUT
echo "cmake_dred_flag=" >> $GITHUB_OUTPUT
fi
- name: Build Linux x86_64 native library
run: |
cd third_party/opus
make distclean || true
./configure --host=x86_64-linux-gnu --disable-shared --disable-rtcd --enable-static ${{ steps.config.outputs.extra_configure_flags }} --prefix=/tmp/out/linux/x86_64 CFLAGS="-O3 -fPIC"
make -j$(nproc) && make install
- name: Build Linux arm64 native library
run: |
cd third_party/opus
make distclean || true
CC=aarch64-linux-gnu-gcc ./configure --host=aarch64-linux-gnu --disable-shared --disable-rtcd --enable-static ${{ steps.config.outputs.extra_configure_flags }} --prefix=/tmp/out/linux/arm64 CFLAGS="-O3"
make -j$(nproc) && make install
- name: Build Windows x86_64 native library
run: |
cd third_party/opus
make distclean || true
CC=x86_64-w64-mingw32-gcc ./configure --host=x86_64-w64-mingw32 --disable-shared --enable-static ${{ steps.config.outputs.extra_configure_flags }} --prefix=/tmp/out/windows/x86_64 CFLAGS="-D_FORTIFY_SOURCE=0 -O3"
make -j$(nproc) && make install
- name: Build JNI libraries
run: |
# Linux x86_64 JNI
cmake -B /tmp/jni-linux-x64 -S kopus/jni \
-DJAVA_HOME=/usr/lib/jvm/java-17-openjdk-amd64 \
-DOPUS_INCLUDE_DIR=/tmp/out/linux/x86_64/include/opus \
-DOPUS_LIB_PATH=/tmp/out/linux/x86_64/lib/libopus.a \
${{ steps.config.outputs.cmake_dred_flag }}
cmake --build /tmp/jni-linux-x64 --config Release
# Linux arm64 JNI
cmake -B /tmp/jni-linux-arm64 -S kopus/jni \
-DJAVA_HOME=/usr/lib/jvm/java-17-openjdk-amd64 \
-DOPUS_INCLUDE_DIR=/tmp/out/linux/arm64/include/opus \
-DOPUS_LIB_PATH=/tmp/out/linux/arm64/lib/libopus.a \
-DCMAKE_SYSTEM_NAME=Linux \
-DCMAKE_SYSTEM_PROCESSOR=aarch64 \
-DCMAKE_C_COMPILER=aarch64-linux-gnu-gcc \
${{ steps.config.outputs.cmake_dred_flag }}
cmake --build /tmp/jni-linux-arm64 --config Release
# Windows x86_64 JNI
cmake -B /tmp/jni-win-x64 -S kopus/jni \
-DJAVA_HOME=/tmp/winjdk/jdk-17.0.11+9 \
-DOPUS_INCLUDE_DIR=/tmp/out/windows/x86_64/include/opus \
-DOPUS_LIB_PATH=/tmp/out/windows/x86_64/lib/libopus.a \
-DCMAKE_SYSTEM_NAME=Windows \
-DCMAKE_C_COMPILER=x86_64-w64-mingw32-gcc \
${{ steps.config.outputs.cmake_dred_flag }}
cmake --build /tmp/jni-win-x64 --config Release
- name: Collect artifacts
run: |
mkdir -p desktop-native-libs/linux/x86_64
mkdir -p desktop-native-libs/linux/arm64
mkdir -p desktop-native-libs/windows/x86_64
cp /tmp/jni-linux-x64/libopus_jni.so desktop-native-libs/linux/x86_64/
cp /tmp/jni-linux-arm64/libopus_jni.so desktop-native-libs/linux/arm64/
cp /tmp/jni-win-x64/libopus_jni.dll desktop-native-libs/windows/x86_64/
- name: Upload Desktop Native Artifacts
uses: actions/upload-artifact@v6
with:
name: desktop-native-libs-${{ matrix.variant }}
path: desktop-native-libs/
retention-days: 1
# ═══════════════════════════════════════════════════════════════════════════
# macOS Build (Android, Apple platforms, iOS, JVM with all natives)
# Runs in parallel for base and full variants
# ═══════════════════════════════════════════════════════════════════════════
build-macos:
name: Build & Test (${{ matrix.variant }})
runs-on: macos-latest
needs: [build-cross-platform]
strategy:
matrix:
variant: [base, full]
steps:
- name: Checkout
uses: actions/checkout@v5
with:
submodules: recursive
- name: Setup Java
uses: actions/setup-java@v5
with:
distribution: 'temurin'
java-version: '17'
- name: Setup Gradle
uses: gradle/actions/setup-gradle@v5
- name: Fetch git tags for version detection
run: |
echo "Fetching tags for opus submodule to enable version detection..."
git submodule foreach git fetch --tags
echo "=== Git tags in opus submodule ==="
cd third_party/opus
git tag | grep v1.6 || echo "No v1.6.x tags found"
echo "=== Git describe test ==="
git describe --tags --match 'v*' || echo "Git describe failed"
- name: Download Desktop Native Libraries
uses: actions/download-artifact@v7
with:
name: desktop-native-libs-${{ matrix.variant }}
path: kopus/build/jni_docker/
- name: Install autotools dependencies
run: |
brew install autoconf automake libtool
- name: Set build configuration
id: config
run: |
if [ "${{ matrix.variant }}" == "full" ]; then
echo "script_flag=--full" >> $GITHUB_OUTPUT
echo "gradle_flag=-Pkopus.full=true" >> $GITHUB_OUTPUT
echo "artifact_suffix=-full" >> $GITHUB_OUTPUT
else
echo "script_flag=" >> $GITHUB_OUTPUT
echo "gradle_flag=" >> $GITHUB_OUTPUT
echo "artifact_suffix=" >> $GITHUB_OUTPUT
fi
- name: Build Opus for Apple Platforms
run: ./scripts/build_opus_apple.sh ${{ steps.config.outputs.script_flag }}
- name: Build macOS JNI Libraries
run: ./scripts/build_opus_jni.sh ${{ steps.config.outputs.script_flag }}
- name: Run JVM Tests
run: ./gradlew :kopus:jvmTest -Pci.skip.native.build ${{ steps.config.outputs.gradle_flag }} --no-configuration-cache
- name: Upload Test Results
if: always()
uses: actions/upload-artifact@v6
with:
name: jvm-test-results-${{ matrix.variant }}
path: |
kopus/build/reports/tests/jvmTest/
kopus/build/test-results/jvmTest/
retention-days: 7
- name: Publish to Maven Local
run: ./gradlew publishToMavenLocal -Pci.skip.native.build ${{ steps.config.outputs.gradle_flag }} --no-configuration-cache
env:
ORG_GRADLE_PROJECT_signingInMemoryKey: ${{ secrets.SIGNING_KEY }}
ORG_GRADLE_PROJECT_signingInMemoryKeyId: ${{ secrets.SIGNING_KEY_ID }}
ORG_GRADLE_PROJECT_signingInMemoryKeyPassword: ${{ secrets.SIGNING_KEY_PASSWORD }}
- name: Publish to Maven Central
if: github.event_name == 'workflow_dispatch' && github.event.inputs.publish == 'true'
run: ./gradlew publishToMavenCentral -Pci.skip.native.build ${{ steps.config.outputs.gradle_flag }} --no-configuration-cache
env:
ORG_GRADLE_PROJECT_mavenCentralUsername: ${{ secrets.MAVEN_CENTRAL_USERNAME }}
ORG_GRADLE_PROJECT_mavenCentralPassword: ${{ secrets.MAVEN_CENTRAL_PASSWORD }}
ORG_GRADLE_PROJECT_signingInMemoryKey: ${{ secrets.SIGNING_KEY }}
ORG_GRADLE_PROJECT_signingInMemoryKeyId: ${{ secrets.SIGNING_KEY_ID }}
ORG_GRADLE_PROJECT_signingInMemoryKeyPassword: ${{ secrets.SIGNING_KEY_PASSWORD }}
- name: Pack Maven Artifacts
run: |
cd ~/.m2/repository
tar -czf /tmp/kopus-maven-artifacts${{ steps.config.outputs.artifact_suffix }}.tar.gz eu/buney/
- name: Upload Maven Artifacts
uses: actions/upload-artifact@v6
with:
name: kopus-maven-artifacts-${{ matrix.variant }}
path: /tmp/kopus-maven-artifacts${{ steps.config.outputs.artifact_suffix }}.tar.gz
retention-days: 7