-
Notifications
You must be signed in to change notification settings - Fork 7
376 lines (367 loc) · 13.8 KB
/
build.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
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
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
name: build-workflow
on:
push:
paths-ignore:
- "doc/**"
- "**.md"
- "LICENSE"
- "NOTICE"
jobs:
build-windows:
strategy:
fail-fast: false
matrix:
name:
- windows_x86_64
name: Build sora-cpp-sdk for ${{ matrix.name }}
runs-on: windows-2022
env:
TEST_SIGNALING_URL: ${{ secrets.TEST_SIGNALING_URL }}
TEST_CHANNEL_ID_PREFIX: ${{ secrets.TEST_CHANNEL_ID_PREFIX }}
TEST_SECRET_KEY: ${{ secrets.TEST_SECRET_KEY }}
TEST_MATRIX_NAME: ${{ matrix.name }}
steps:
- uses: actions/checkout@v4
- uses: microsoft/setup-msbuild@v2
- name: Env to output
run: |
echo "userprofile=${Env:USERPROFILE}" >> ${Env:GITHUB_OUTPUT}
echo "username=${Env:USERNAME}" >> ${Env:GITHUB_OUTPUT}
id: env
- name: Get Versions
run: |
Get-Content "VERSION" | Foreach-Object {
if (!$_) { continue }
$var = $_.Split('=')
New-Variable -Name $var[0] -Value $var[1] -Force
}
echo "cuda_version=${CUDA_VERSION}" >> ${Env:GITHUB_OUTPUT}
id: versions
# CUDA のインストールバイナリのダウンロードは 3GB ぐらいあって、
# ビルドの度に取得するのはつらいのでキャッシュする
# (インストールする nvcc は解凍後で 100MB 程度なのでキャッシュ可能)
- name: Cache CUDA ${{ steps.versions.outputs.cuda_version }}
id: cache-cuda
uses: actions/cache@v4
with:
path: _install\windows_x86_64\release\cuda
key: windows-cuda-${{ steps.versions.outputs.cuda_version }}.v1
- run: echo "${CUDA_VERSION}" > _install\windows_x86_64\release\cuda.version
if: steps.cache-cuda.outputs.cache-hit == 'true'
- run: python3 run.py --test --run-e2e-test --package ${{ matrix.name }}
env:
SORA_CPP_SDK_TEMP_DIR: C:\
- name: Get package name
run: |
Get-Content "_package\${{ matrix.name }}\release\sora.env" | Foreach-Object {
if (!$_) { continue }
$var = $_.Split('=')
New-Variable -Name $var[0] -Value $var[1] -Force
}
echo "name=${PACKAGE_NAME}" >> ${Env:GITHUB_OUTPUT}
echo "boost_name=${BOOST_PACKAGE_NAME}" >> ${Env:GITHUB_OUTPUT}
id: package_name
- name: Upload Artifact
uses: actions/upload-artifact@v4
with:
name: ${{ steps.package_name.outputs.name }}
path: _package/${{ matrix.name }}/release/${{ steps.package_name.outputs.name }}
- name: Upload Boost Artifact
uses: actions/upload-artifact@v4
with:
name: ${{ steps.package_name.outputs.boost_name }}
path: _package/${{ matrix.name }}/release/${{ steps.package_name.outputs.boost_name }}
- name: Upload Environment
uses: actions/upload-artifact@v4
with:
name: ${{ matrix.name }}.env
path: _package/${{ matrix.name }}/release/sora.env
# Examples のビルド
- name: Build Examples
run: |
cd examples
mkdir examples_${{ matrix.name }}
foreach ($app in @('sdl_sample', 'sumomo', 'messaging_recvonly_sample')) {
python3 "$app\${{ matrix.name }}\run.py" --local-sora-cpp-sdk-dir ..
cp "_build\${{ matrix.name }}\release\$app\Release\$app.exe" "examples_${{ matrix.name }}"
}
- name: Upload Examples Artifact
uses: actions/upload-artifact@v4
with:
name: examples_${{ matrix.name }}
path: examples/examples_${{ matrix.name }}
build-macos:
strategy:
fail-fast: false
matrix:
name:
- macos_arm64
- ios
name: Build sora-cpp-sdk for ${{ matrix.name }}
runs-on: macos-14
env:
TEST_SIGNALING_URL: ${{ secrets.TEST_SIGNALING_URL }}
TEST_CHANNEL_ID_PREFIX: ${{ secrets.TEST_CHANNEL_ID_PREFIX }}
TEST_SECRET_KEY: ${{ secrets.TEST_SECRET_KEY }}
TEST_MATRIX_NAME: ${{ matrix.name }}
steps:
- uses: actions/checkout@v4
- name: Select Xcode 15.4
run: sudo xcode-select --switch /Applications/Xcode_15.4.app/Contents/Developer
- name: Env to output
run: |
echo "user=`users`" >> $GITHUB_OUTPUT
id: env
- run: python3 run.py --test --run-e2e-test --package ${{ matrix.name }}
- name: Get package name
run: |
source _package/${{ matrix.name }}/release/sora.env
echo "name=${PACKAGE_NAME}" >> $GITHUB_OUTPUT
echo "boost_name=${BOOST_PACKAGE_NAME}" >> $GITHUB_OUTPUT
id: package_name
- name: Upload Artifact
uses: actions/upload-artifact@v4
with:
name: ${{ steps.package_name.outputs.name }}
path: _package/${{ matrix.name }}/release/${{ steps.package_name.outputs.name }}
- name: Upload Boost Artifact
uses: actions/upload-artifact@v4
with:
name: ${{ steps.package_name.outputs.boost_name }}
path: _package/${{ matrix.name }}/release/${{ steps.package_name.outputs.boost_name }}
- name: Upload Environment
uses: actions/upload-artifact@v4
with:
name: ${{ matrix.name }}.env
path: _package/${{ matrix.name }}/release/sora.env
# Examples のビルド
- name: Build Examples
run: |
cd examples
mkdir examples_${{ matrix.name }}
for app in sdl_sample sumomo messaging_recvonly_sample; do
python3 $app/${{ matrix.name }}/run.py --local-sora-cpp-sdk-dir ..
cp _build/${{ matrix.name }}/release/$app/$app examples_${{ matrix.name }}
done
if: matrix.name == 'macos_arm64'
- name: Upload Examples Artifact
uses: actions/upload-artifact@v4
with:
name: examples_${{ matrix.name }}
path: examples/examples_${{ matrix.name }}
if: matrix.name == 'macos_arm64'
build-ubuntu:
strategy:
fail-fast: false
matrix:
platform:
- name: ubuntu-20.04_x86_64
runs-on: ubuntu-20.04
os: ubuntu
arch: x86_64
- name: ubuntu-22.04_x86_64
runs-on: ubuntu-22.04
os: ubuntu
arch: x86_64
- name: ubuntu-24.04_x86_64
runs-on: ubuntu-24.04
os: ubuntu
arch: x86_64
- name: ubuntu-24.04_armv8
runs-on: ubuntu-24.04
os: ubuntu
arch: armv8
- name: android
runs-on: ubuntu-22.04
os: android
name: Build sora-cpp-sdk for ${{ matrix.platform.name }}
runs-on: ${{ matrix.platform.runs-on }}
env:
TEST_SIGNALING_URL: ${{ secrets.TEST_SIGNALING_URL }}
TEST_CHANNEL_ID_PREFIX: ${{ secrets.TEST_CHANNEL_ID_PREFIX }}
TEST_SECRET_KEY: ${{ secrets.TEST_SECRET_KEY }}
TEST_MATRIX_NAME: ${{ matrix.platform.name }}
steps:
- uses: actions/checkout@v4
- name: Disk cleanup
run: |
set -x
df -h
sudo du -h -d1 /usr/local
sudo du -h -d1 /usr/local/share
sudo du -h -d1 /usr/local/lib
sudo du -h -d1 /usr/share
RMI=`docker images -q -a`
if [ -n "$RMI" ]; then
docker rmi $RMI
fi
# 4.6G
sudo rm -rf /usr/local/.ghcup
# 1.7G
sudo rm -rf /usr/share/swift
# 1.4G
sudo rm -rf /usr/share/dotnet
df -h
# Ubuntu 24.04 だと libtinfo5 が見つからない問題があるので、その修正
# ref: https://qiita.com/gengen16k/items/88cf3c18a40a94205fab
- name: Fix CUDA issues for Ubuntu 24.04
if: matrix.platform.name == 'ubuntu-24.04_x86_64'
run: |
sudo tee /etc/apt/sources.list.d/jammy.list << EOF
deb http://archive.ubuntu.com/ubuntu/ jammy universe
EOF
sudo tee /etc/apt/preferences.d/pin-jammy <<EOF
Package: *
Pin: release n=jammy
Pin-Priority: -10
Package: libtinfo5
Pin: release n=jammy
Pin-Priority: 990
EOF
- name: Install deps for ${{ matrix.platform.name }}
if: matrix.platform.os == 'ubuntu' && matrix.platform.arch == 'x86_64'
run: |
source VERSION
sudo apt-get update
sudo apt-get install -y software-properties-common
# X11
sudo apt-get install libx11-dev libxext-dev
# CUDA
source /etc/os-release
# 20.04 は自前の libssl1.1 があるので不要
if [ $VERSION_ID != "20.04" ]; then
wget http://archive.ubuntu.com/ubuntu/pool/main/o/openssl/libssl1.1_1.1.0g-2ubuntu4_amd64.deb
sudo dpkg -i libssl1.1_1.1.0g-2ubuntu4_amd64.deb
fi
wget https://developer.download.nvidia.com/compute/cuda/repos/ubuntu2004/x86_64/cuda-keyring_1.0-1_all.deb
sudo dpkg -i cuda-keyring_*all.deb
sudo apt-get update
DEBIAN_FRONTEND=noninteractive sudo apt-get -y install cuda=$CUDA_VERSION
# clang-18
wget https://apt.llvm.org/llvm.sh
chmod a+x llvm.sh
sudo ./llvm.sh 18
- name: Install deps for ${{ matrix.platform.name }}
if: matrix.platform.os == 'ubuntu' && matrix.platform.arch == 'armv8'
run: |
sudo apt-get -y install multistrap binutils-aarch64-linux-gnu
# multistrap に insecure なリポジトリからの取得を許可する設定を入れる
sudo sed -e 's/Apt::Get::AllowUnauthenticated=true/Apt::Get::AllowUnauthenticated=true";\n$config_str .= " -o Acquire::AllowInsecureRepositories=true/' -i /usr/sbin/multistrap
- name: Install deps for Android
if: matrix.platform.os == 'android'
run: |
sudo apt-get -y install ninja-build
# JDK を指定しないとデフォルトの JDK 11 で動作するため指定する
- name: Setup JDK 17
uses: actions/setup-java@v4
with:
java-version: '17'
distribution: 'temurin'
if: matrix.platform.os == 'android'
- name: Setup Android SDK
uses: android-actions/setup-android@v3
if: matrix.platform.os == 'android'
- run: python3 run.py --test --run-e2e-test --package ${{ matrix.platform.name }}
- name: Get package name
run: |
source _package/${{ matrix.platform.name }}/release/sora.env
echo "name=${PACKAGE_NAME}" >> $GITHUB_OUTPUT
echo "boost_name=${BOOST_PACKAGE_NAME}" >> $GITHUB_OUTPUT
id: package_name
- name: Upload Artifact
uses: actions/upload-artifact@v4
with:
name: ${{ steps.package_name.outputs.name }}
path: _package/${{ matrix.platform.name }}/release/${{ steps.package_name.outputs.name }}
- name: Upload Boost Artifact
uses: actions/upload-artifact@v4
with:
name: ${{ steps.package_name.outputs.boost_name }}
path: _package/${{ matrix.platform.name }}/release/${{ steps.package_name.outputs.boost_name }}
- name: Upload Environment
uses: actions/upload-artifact@v4
with:
name: ${{ matrix.platform.name }}.env
path: _package/${{ matrix.platform.name }}/release/sora.env
# Examples のビルド
- name: Build Examples
run: |
cd examples
mkdir examples_${{ matrix.platform.name }}
for app in sdl_sample sumomo messaging_recvonly_sample; do
python3 $app/${{ matrix.platform.name }}/run.py --local-sora-cpp-sdk-dir ..
cp _build/${{ matrix.platform.name }}/release/$app/$app examples_${{ matrix.platform.name }}
done
if: matrix.platform.os == 'ubuntu'
- name: Upload Examples Artifact
uses: actions/upload-artifact@v4
with:
name: examples_${{ matrix.platform.name }}
path: examples/examples_${{ matrix.platform.name }}
if: matrix.platform.os == 'ubuntu'
create-release:
name: Create Release
if: contains(github.ref, 'tags/202')
needs:
- build-windows
- build-macos
- build-ubuntu
runs-on: ubuntu-24.04
steps:
- uses: actions/checkout@v4
- uses: ./.github/actions/download
with:
platform: windows_x86_64
- uses: ./.github/actions/download
with:
platform: macos_arm64
- uses: ./.github/actions/download
with:
platform: ios
- uses: ./.github/actions/download
with:
platform: ubuntu-20.04_x86_64
- uses: ./.github/actions/download
with:
platform: ubuntu-22.04_x86_64
- uses: ./.github/actions/download
with:
platform: ubuntu-24.04_x86_64
- uses: ./.github/actions/download
with:
platform: ubuntu-24.04_armv8
- uses: ./.github/actions/download
with:
platform: android
- name: Env to output
run: |
echo "package_paths<<EOF" >> $GITHUB_OUTPUT
cat package_paths.env >> $GITHUB_OUTPUT
echo "EOF" >> $GITHUB_OUTPUT
id: env
- name: Release
uses: softprops/action-gh-release@v2
with:
files: ${{ steps.env.outputs.package_paths }}
prerelease: ${{ contains(github.ref, 'canary') }}
notification:
name: Slack Notification
runs-on: ubuntu-24.04
needs:
- build-windows
- build-macos
- build-ubuntu
- create-release
if: always()
steps:
- uses: rtCamp/action-slack-notify@v2
if: |
needs.build-windows.result == 'failure' ||
needs.build-macos.result == 'failure' ||
needs.build-ubuntu.result == 'failure' ||
needs.create-release.result == 'failure'
env:
SLACK_CHANNEL: sora-cpp-sdk
SLACK_COLOR: danger
SLACK_TITLE: Build failed
SLACK_WEBHOOK: ${{ secrets.SLACK_WEBHOOK }}