Skip to content

Commit 1037ee2

Browse files
committed
Add kopus-full variant to CI build and publish
- Build native libraries for both base and full variants on Linux/Windows - Build Apple libraries for both variants on macOS - Run JVM tests with full variant (includes DRED tests) - Publish both kopus and kopus-full to Maven Central
1 parent cae73cf commit 1037ee2

1 file changed

Lines changed: 82 additions & 49 deletions

File tree

.github/workflows/ci.yml

Lines changed: 82 additions & 49 deletions
Original file line numberDiff line numberDiff line change
@@ -16,17 +16,21 @@ on:
1616
jobs:
1717
# ═══════════════════════════════════════════════════════════════════════════
1818
# Cross-Platform Build (Linux/Windows native libraries and JNI)
19+
# Runs in parallel for base and full variants
1920
# ═══════════════════════════════════════════════════════════════════════════
20-
21+
2122
build-cross-platform:
22-
name: Build Cross-Platform Libraries (Linux/Windows)
23+
name: Build Cross-Platform (${{ matrix.variant }})
2324
runs-on: ubuntu-latest
25+
strategy:
26+
matrix:
27+
variant: [base, full]
2428
steps:
2529
- name: Checkout
2630
uses: actions/checkout@v4
2731
with:
2832
submodules: recursive
29-
33+
3034
- name: Fetch git tags for version detection
3135
run: |
3236
echo "Fetching tags for opus submodule to enable version detection..."
@@ -42,12 +46,12 @@ jobs:
4246
sudo apt-get update && sudo apt-get install -y \
4347
build-essential autoconf automake libtool pkg-config \
4448
cmake mingw-w64 gcc-aarch64-linux-gnu curl unzip
45-
49+
4650
- name: Run autogen
4751
run: |
4852
cd third_party/opus
4953
./autogen.sh
50-
54+
5155
- name: Debug package_version after autogen
5256
run: |
5357
echo "=== Checking Opus submodule ==="
@@ -64,103 +68,120 @@ jobs:
6468
else
6569
echo "ERROR: package_version file not created by autogen.sh"
6670
fi
67-
71+
6872
- name: Download Windows JDK
6973
run: |
7074
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
7175
mkdir -p /tmp/winjdk
7276
unzip /tmp/jdk-win.zip -d /tmp/winjdk
7377
rm /tmp/jdk-win.zip
74-
78+
79+
- name: Set build configuration
80+
id: config
81+
run: |
82+
if [ "${{ matrix.variant }}" == "full" ]; then
83+
echo "extra_configure_flags=--enable-dred --enable-osce --enable-qext" >> $GITHUB_OUTPUT
84+
echo "cmake_dred_flag=-DKOPUS_ENABLE_DRED=ON" >> $GITHUB_OUTPUT
85+
else
86+
echo "extra_configure_flags=" >> $GITHUB_OUTPUT
87+
echo "cmake_dred_flag=" >> $GITHUB_OUTPUT
88+
fi
89+
7590
- name: Build Linux x86_64 native library
7691
run: |
7792
cd third_party/opus
7893
make distclean || true
79-
./configure --host=x86_64-linux-gnu --disable-shared --disable-rtcd --enable-static --prefix=/tmp/out/linux/x86_64 CFLAGS="-O3 -fPIC"
94+
./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"
8095
make -j$(nproc) && make install
81-
96+
8297
- name: Build Linux arm64 native library
8398
run: |
8499
cd third_party/opus
85100
make distclean || true
86-
CC=aarch64-linux-gnu-gcc ./configure --host=aarch64-linux-gnu --disable-shared --disable-rtcd --enable-static --prefix=/tmp/out/linux/arm64 CFLAGS="-O3"
101+
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"
87102
make -j$(nproc) && make install
88-
103+
89104
- name: Build Windows x86_64 native library
90105
run: |
91106
cd third_party/opus
92107
make distclean || true
93-
CC=x86_64-w64-mingw32-gcc ./configure --host=x86_64-w64-mingw32 --disable-shared --enable-static --prefix=/tmp/out/windows/x86_64 CFLAGS="-D_FORTIFY_SOURCE=0 -O3"
108+
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"
94109
make -j$(nproc) && make install
95-
110+
96111
- name: Build JNI libraries
97112
run: |
98113
# Linux x86_64 JNI
99114
cmake -B /tmp/jni-linux-x64 -S kopus/jni \
100115
-DJAVA_HOME=/usr/lib/jvm/java-17-openjdk-amd64 \
101116
-DOPUS_INCLUDE_DIR=/tmp/out/linux/x86_64/include/opus \
102-
-DOPUS_LIB_PATH=/tmp/out/linux/x86_64/lib/libopus.a
117+
-DOPUS_LIB_PATH=/tmp/out/linux/x86_64/lib/libopus.a \
118+
${{ steps.config.outputs.cmake_dred_flag }}
103119
cmake --build /tmp/jni-linux-x64 --config Release
104-
105-
# Linux arm64 JNI
120+
121+
# Linux arm64 JNI
106122
cmake -B /tmp/jni-linux-arm64 -S kopus/jni \
107123
-DJAVA_HOME=/usr/lib/jvm/java-17-openjdk-amd64 \
108124
-DOPUS_INCLUDE_DIR=/tmp/out/linux/arm64/include/opus \
109125
-DOPUS_LIB_PATH=/tmp/out/linux/arm64/lib/libopus.a \
110126
-DCMAKE_SYSTEM_NAME=Linux \
111127
-DCMAKE_SYSTEM_PROCESSOR=aarch64 \
112-
-DCMAKE_C_COMPILER=aarch64-linux-gnu-gcc
128+
-DCMAKE_C_COMPILER=aarch64-linux-gnu-gcc \
129+
${{ steps.config.outputs.cmake_dred_flag }}
113130
cmake --build /tmp/jni-linux-arm64 --config Release
114-
131+
115132
# Windows x86_64 JNI
116133
cmake -B /tmp/jni-win-x64 -S kopus/jni \
117134
-DJAVA_HOME=/tmp/winjdk/jdk-17.0.11+9 \
118135
-DOPUS_INCLUDE_DIR=/tmp/out/windows/x86_64/include/opus \
119136
-DOPUS_LIB_PATH=/tmp/out/windows/x86_64/lib/libopus.a \
120137
-DCMAKE_SYSTEM_NAME=Windows \
121-
-DCMAKE_C_COMPILER=x86_64-w64-mingw32-gcc
138+
-DCMAKE_C_COMPILER=x86_64-w64-mingw32-gcc \
139+
${{ steps.config.outputs.cmake_dred_flag }}
122140
cmake --build /tmp/jni-win-x64 --config Release
123-
141+
124142
- name: Collect artifacts
125143
run: |
126144
mkdir -p desktop-native-libs/linux/x86_64
127-
mkdir -p desktop-native-libs/linux/arm64
145+
mkdir -p desktop-native-libs/linux/arm64
128146
mkdir -p desktop-native-libs/windows/x86_64
129-
130147
cp /tmp/jni-linux-x64/libopus_jni.so desktop-native-libs/linux/x86_64/
131148
cp /tmp/jni-linux-arm64/libopus_jni.so desktop-native-libs/linux/arm64/
132149
cp /tmp/jni-win-x64/libopus_jni.dll desktop-native-libs/windows/x86_64/
133-
150+
134151
- name: Upload Desktop Native Artifacts
135152
uses: actions/upload-artifact@v4
136153
with:
137-
name: desktop-native-libs
154+
name: desktop-native-libs-${{ matrix.variant }}
138155
path: desktop-native-libs/
139156
retention-days: 1
140157

141158
# ═══════════════════════════════════════════════════════════════════════════
142-
# Comprehensive macOS Build (Android, Apple platforms, iOS, JVM with all natives)
159+
# macOS Build (Android, Apple platforms, iOS, JVM with all natives)
160+
# Runs in parallel for base and full variants
143161
# ═══════════════════════════════════════════════════════════════════════════
144-
145-
build-macos-comprehensive:
146-
name: Build All Platforms (macOS runner)
162+
163+
build-macos:
164+
name: Build & Test (${{ matrix.variant }})
147165
runs-on: macos-latest
148166
needs: [build-cross-platform]
167+
strategy:
168+
matrix:
169+
variant: [base, full]
149170
steps:
150171
- name: Checkout
151172
uses: actions/checkout@v4
152173
with:
153174
submodules: recursive
154-
175+
155176
- name: Setup Java
156177
uses: actions/setup-java@v4
157178
with:
158179
distribution: 'temurin'
159180
java-version: '17'
160-
181+
161182
- name: Setup Gradle
162183
uses: gradle/actions/setup-gradle@v3
163-
184+
164185
- name: Fetch git tags for version detection
165186
run: |
166187
echo "Fetching tags for opus submodule to enable version detection..."
@@ -174,58 +195,70 @@ jobs:
174195
- name: Download Desktop Native Libraries
175196
uses: actions/download-artifact@v4
176197
with:
177-
name: desktop-native-libs
198+
name: desktop-native-libs-${{ matrix.variant }}
178199
path: kopus/build/jni_docker/
179200

180201
- name: Install autotools dependencies
181202
run: |
182203
brew install autoconf automake libtool
183-
204+
205+
- name: Set build configuration
206+
id: config
207+
run: |
208+
if [ "${{ matrix.variant }}" == "full" ]; then
209+
echo "script_flag=--full" >> $GITHUB_OUTPUT
210+
echo "gradle_flag=-Pkopus.full=true" >> $GITHUB_OUTPUT
211+
echo "artifact_suffix=-full" >> $GITHUB_OUTPUT
212+
else
213+
echo "script_flag=" >> $GITHUB_OUTPUT
214+
echo "gradle_flag=" >> $GITHUB_OUTPUT
215+
echo "artifact_suffix=" >> $GITHUB_OUTPUT
216+
fi
217+
184218
- name: Build Opus for Apple Platforms
185-
run: ./scripts/build_opus_apple.sh
219+
run: ./scripts/build_opus_apple.sh ${{ steps.config.outputs.script_flag }}
186220

187221
- name: Build macOS JNI Libraries
188-
run: ./scripts/build_opus_jni.sh
222+
run: ./scripts/build_opus_jni.sh ${{ steps.config.outputs.script_flag }}
189223

190224
- name: Run JVM Tests
191-
run: ./gradlew :kopus:jvmTest --no-configuration-cache
225+
run: ./gradlew :kopus:jvmTest ${{ steps.config.outputs.gradle_flag }} --no-configuration-cache
192226

193227
- name: Upload Test Results
194228
if: always()
195229
uses: actions/upload-artifact@v4
196230
with:
197-
name: jvm-test-results
231+
name: jvm-test-results-${{ matrix.variant }}
198232
path: |
199233
kopus/build/reports/tests/jvmTest/
200234
kopus/build/test-results/jvmTest/
201235
retention-days: 7
202236

203-
- name: Publish All Platforms to Maven Local
204-
run: ./gradlew publishToMavenLocal -Pci.skip.native.build --no-configuration-cache
237+
- name: Publish to Maven Local
238+
run: ./gradlew publishToMavenLocal -Pci.skip.native.build ${{ steps.config.outputs.gradle_flag }} --no-configuration-cache
205239
env:
206240
ORG_GRADLE_PROJECT_signingInMemoryKey: ${{ secrets.SIGNING_KEY }}
207241
ORG_GRADLE_PROJECT_signingInMemoryKeyId: ${{ secrets.SIGNING_KEY_ID }}
208242
ORG_GRADLE_PROJECT_signingInMemoryKeyPassword: ${{ secrets.SIGNING_KEY_PASSWORD }}
209243

210-
- name: Publish All Platforms to Maven Central
244+
- name: Publish to Maven Central
211245
if: github.event_name == 'workflow_dispatch' && github.event.inputs.publish == 'true'
212-
run: ./gradlew publishToMavenCentral -Pci.skip.native.build --no-configuration-cache
246+
run: ./gradlew publishToMavenCentral -Pci.skip.native.build ${{ steps.config.outputs.gradle_flag }} --no-configuration-cache
213247
env:
214248
ORG_GRADLE_PROJECT_mavenCentralUsername: ${{ secrets.MAVEN_CENTRAL_USERNAME }}
215249
ORG_GRADLE_PROJECT_mavenCentralPassword: ${{ secrets.MAVEN_CENTRAL_PASSWORD }}
216250
ORG_GRADLE_PROJECT_signingInMemoryKey: ${{ secrets.SIGNING_KEY }}
217251
ORG_GRADLE_PROJECT_signingInMemoryKeyId: ${{ secrets.SIGNING_KEY_ID }}
218252
ORG_GRADLE_PROJECT_signingInMemoryKeyPassword: ${{ secrets.SIGNING_KEY_PASSWORD }}
219-
220-
- name: Pack Kopus Maven Artifacts
253+
254+
- name: Pack Maven Artifacts
221255
run: |
222256
cd ~/.m2/repository
223-
tar -czf /tmp/kopus-maven-artifacts.tar.gz eu/buney/
224-
225-
- name: Upload Kopus Maven Artifacts
257+
tar -czf /tmp/kopus-maven-artifacts${{ steps.config.outputs.artifact_suffix }}.tar.gz eu/buney/
258+
259+
- name: Upload Maven Artifacts
226260
uses: actions/upload-artifact@v4
227261
with:
228-
name: kopus-maven-artifacts
229-
path: /tmp/kopus-maven-artifacts.tar.gz
262+
name: kopus-maven-artifacts-${{ matrix.variant }}
263+
path: /tmp/kopus-maven-artifacts${{ steps.config.outputs.artifact_suffix }}.tar.gz
230264
retention-days: 7
231-

0 commit comments

Comments
 (0)