-
Notifications
You must be signed in to change notification settings - Fork 7
267 lines (263 loc) · 10.6 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
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-2019
steps:
- uses: actions/checkout@v4
- uses: microsoft/[email protected]
- name: Env to output
run: |
echo "userprofile=${Env:USERPROFILE}" >> ${Env:GITHUB_OUTPUT}
echo "username=${Env:USERNAME}" >> ${Env:GITHUB_OUTPUT}
id: env
- name: Bazel cache (cache)
uses: actions/cache@v3
with:
path: "${{ steps.env.outputs.userprofile }}/_bazel_${{ steps.env.outputs.username }}/cache"
key: bazel-cache-${{ matrix.name }}-v1
- name: Bazel cache (install)
uses: actions/cache@v3
with:
path: "${{ steps.env.outputs.userprofile }}/_bazel_${{ steps.env.outputs.username }}/install"
key: bazel-install-${{ matrix.name }}-v1
- 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 NVCC ${{ steps.versions.outputs.cuda_version }}
id: cache-cuda
uses: actions/cache@v3
with:
path: _install\windows_x86_64\release\cuda\nvcc
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: pip install numpy
- run: python3 run.py --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}
echo "lyra_name=${LYRA_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 Lyra Artifact
uses: actions/upload-artifact@v4
with:
name: ${{ steps.package_name.outputs.lyra_name }}
path: _package/${{ matrix.name }}/release/${{ steps.package_name.outputs.lyra_name }}
- name: Upload Environment
uses: actions/upload-artifact@v4
with:
name: ${{ matrix.name }}.env
path: _package/${{ matrix.name }}/release/sora.env
build-macos:
strategy:
fail-fast: false
matrix:
name:
- macos_arm64
- ios
name: Build sora-cpp-sdk for ${{ matrix.name }}
runs-on: macos-13
steps:
- uses: actions/checkout@v4
- name: Select Xcode 14.3.1
run: sudo xcode-select --switch /Applications/Xcode_14.3.1.app/Contents/Developer
- name: Env to output
run: |
echo "user=`users`" >> $GITHUB_OUTPUT
id: env
- name: Bazel cache
uses: actions/cache@v3
with:
path: "/private/var/tmp/_bazel_${{ steps.env.outputs.user }}"
key: bazel-${{ matrix.name }}-v2
- run: pip3 install numpy setuptools
- run: python3 run.py --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
echo "lyra_name=${LYRA_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 Lyra Artifact
uses: actions/upload-artifact@v4
with:
name: ${{ steps.package_name.outputs.lyra_name }}
path: _package/${{ matrix.name }}/release/${{ steps.package_name.outputs.lyra_name }}
- name: Upload Environment
uses: actions/upload-artifact@v4
with:
name: ${{ matrix.name }}.env
path: _package/${{ matrix.name }}/release/sora.env
build-ubuntu:
strategy:
fail-fast: false
matrix:
name:
- ubuntu-20.04_x86_64
- ubuntu-22.04_x86_64
- ubuntu-20.04_armv8_jetson
- android
name: Build sora-cpp-sdk for ${{ matrix.name }}
runs-on: ${{ matrix.name == 'ubuntu-22.04_x86_64' && 'ubuntu-22.04' || 'ubuntu-20.04' }}
steps:
- uses: actions/checkout@v4
- name: Bazel cache
uses: actions/cache@v3
with:
path: "~/.cache/bazel"
key: bazel-${{ matrix.name }}-v1
- name: Install deps for ${{ matrix.name }}
if: matrix.name == 'ubuntu-20.04_x86_64' || matrix.name == 'ubuntu-22.04_x86_64'
run: |
source VERSION
# clang-15 と CUDA を入れる
sudo apt-get update
sudo apt-get install -y software-properties-common
# CUDA 10 なので ubuntu1804 で正しい
wget https://developer.download.nvidia.com/compute/cuda/repos/ubuntu1804/x86_64/cuda-ubuntu1804.pin
sudo mv cuda-ubuntu1804.pin /etc/apt/preferences.d/cuda-repository-pin-600
sudo apt-key adv --fetch-keys https://developer.download.nvidia.com/compute/cuda/repos/ubuntu1804/x86_64/3bf863cc.pub
sudo add-apt-repository "deb https://developer.download.nvidia.com/compute/cuda/repos/ubuntu1804/x86_64/ /"
DEBIAN_FRONTEND=noninteractive sudo apt-get -y install cuda=$CUDA_VERSION
wget https://apt.llvm.org/llvm.sh
chmod a+x llvm.sh
sudo ./llvm.sh 15
# Intel Media SDK のために libva-dev, libdrm-dev を入れる
DEBIAN_FRONTEND=noninteractive sudo apt-get -y install libva-dev libdrm-dev
- name: Install deps for Jetson series
if: matrix.name == 'ubuntu-20.04_armv8_jetson'
run: |
sudo apt-get update
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
# Lyra ビルドのためにクロスコンパイル環境一式を入れる
sudo apt-get -y install libstdc++-9-dev-arm64-cross gcc-aarch64-linux-gnu g++-aarch64-linux-gnu
- name: Install deps for Android
if: matrix.name == 'android'
run: |
sudo apt-get -y install ninja-build
- name: Setup Android SDK
uses: android-actions/[email protected]
if: matrix.name == 'android'
- run: pip3 install numpy
- run: python3 run.py --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
echo "lyra_name=${LYRA_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 Lyra Artifact
uses: actions/upload-artifact@v4
with:
name: ${{ steps.package_name.outputs.lyra_name }}
path: _package/${{ matrix.name }}/release/${{ steps.package_name.outputs.lyra_name }}
- name: Upload Environment
uses: actions/upload-artifact@v4
with:
name: ${{ matrix.name }}.env
path: _package/${{ matrix.name }}/release/sora.env
create-release:
name: Create Release
if: contains(github.ref, 'tags/202')
needs:
- build-windows
- build-macos
- build-ubuntu
runs-on: ubuntu-latest
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_armv8_jetson
- 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: 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@v1
with:
files: ${{ steps.env.outputs.package_paths }}