-
Notifications
You must be signed in to change notification settings - Fork 3
218 lines (187 loc) · 9.17 KB
/
Copy pathci.yml
File metadata and controls
218 lines (187 loc) · 9.17 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
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)
# ═══════════════════════════════════════════════════════════════════════════
build-cross-platform:
name: Build Cross-Platform Libraries (Linux/Windows)
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
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: 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 --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 --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 --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
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
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
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@v4
with:
name: desktop-native-libs
path: desktop-native-libs/
retention-days: 1
# ═══════════════════════════════════════════════════════════════════════════
# Comprehensive macOS Build (Android, Apple platforms, iOS, JVM with all natives)
# ═══════════════════════════════════════════════════════════════════════════
build-macos-comprehensive:
name: Build All Platforms (macOS runner)
runs-on: macos-latest
needs: [build-cross-platform]
steps:
- name: Checkout
uses: actions/checkout@v4
with:
submodules: recursive
- name: Setup Java
uses: actions/setup-java@v4
with:
distribution: 'temurin'
java-version: '17'
- name: Setup Gradle
uses: gradle/actions/setup-gradle@v3
- 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@v4
with:
name: desktop-native-libs
path: kopus/build/jni_docker/
- name: Install autotools dependencies
run: |
brew install autoconf automake libtool
- name: Build Opus for Apple Platforms
run: ./scripts/build_opus_apple.sh
- name: Build macOS JNI Libraries
run: ./scripts/build_opus_jni.sh
- name: Publish All Platforms to Maven Local
run: ./gradlew publishToMavenLocal -Pci.skip.native.build --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 All Platforms to Maven Central
if: github.event_name == 'workflow_dispatch' && github.event.inputs.publish == 'true'
run: ./gradlew publishToMavenCentral -Pci.skip.native.build --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 Kopus Maven Artifacts
run: |
cd ~/.m2/repository
tar -czf /tmp/kopus-maven-artifacts.tar.gz eu/buney/
- name: Upload Kopus Maven Artifacts
uses: actions/upload-artifact@v4
with:
name: kopus-maven-artifacts
path: /tmp/kopus-maven-artifacts.tar.gz
retention-days: 7