-
Notifications
You must be signed in to change notification settings - Fork 6
298 lines (294 loc) · 10.2 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
name: build
on:
pull_request:
paths-ignore:
- 'doc/**'
- '**.md'
- 'THANKS'
- 'LICENSE'
- 'NOTICE'
push:
branches:
- main
- master
- develop
tags:
- 202*
paths-ignore:
- 'doc/**'
- '**.md'
- 'THANKS'
- 'LICENSE'
- 'NOTICE'
jobs:
build-linux:
strategy:
fail-fast: false
matrix:
os:
- ubuntu-20.04_x86_64
- ubuntu-20.04_arm64
- ubuntu-22.04_x86_64
- ubuntu-22.04_arm64
name: Build hisui for ${{ matrix.os }}
runs-on: ${{ contains(matrix.os, 'ubuntu-20.04') && 'ubuntu-20.04' || 'ubuntu-22.04' }}
steps:
- name: Install packages
shell: bash
run: |
sudo apt update
sudo apt install -yq yasm ccache libstdc++-10-dev-arm64-cross libc6-dev-arm64-cross binutils-aarch64-linux-gnu libva-dev libdrm-dev
sudo rm -rf /var/lib/apt/lists/*
env:
DEBIAN_FRONTEND: noninteractive
- uses: actions/checkout@v4
- name: Get vars
shell: bash
id: vars
run: |
echo "sha_short=$(git rev-parse --short HEAD)" >> "$GITHUB_OUTPUT"
- name: Get versions
shell: bash
id: versions
run: |
source VERSION
echo "libvpx_version=${LIBVPX_VERSION}" >> "$GITHUB_OUTPUT"
echo "svt_av1_version=${SVT_AV1_VERSION}" >> "$GITHUB_OUTPUT"
- name: Cache libvpx ${{ steps.versions.outputs.libvpx_version }}
id: cache-libvpx
uses: actions/cache@v3
with:
path: third_party/libvpx
key: ${{ matrix.os }}-third_party-libvpx-${{ hashFiles(format('third_party/libvpx/{0}/libvpx.a', matrix.os)) }}
restore-keys: ${{ matrix.os }}-third_party-libvpx-
- name: Clear libvpx
if: steps.cache-libvpx.outputs.cache-hit != 'true'
run: rm -rf third_party/libvpx
- name: Cache SVT-AV1 ${{ steps.versions.outputs.svt_av1_version }}
id: cache-svt-av1
uses: actions/cache@v3
with:
path: third_party/SVT-AV1
key: ${{ matrix.os }}-third_party-svt-av1-${{ hashFiles('third_party/SVT-AV1/Bin/Release/libSvtAv1Dec.a', 'third_party/SVT-AV1/Bin/Release/libSvtAv1Enc.a') }}
restore-keys: ${{ matrix.os }}-third_party-svt-av1-
- name: Clear SVT-AV1
if: steps.cache-svt-av1.outputs.cache-hit != 'true'
run: rm -rf third_party/SVT-AV1
- name: Cache release directory
id: cache-release
uses: actions/cache@v3
with:
path: release/${{ matrix.os }}/_deps
key: ${{ matrix.os }}-release-deps-${{ hashFiles(format('release/{0}/Makefile', matrix.os)) }}
restore-keys: ${{ matrix.os }}-release-deps-
- name: Clear release directory
if: steps.cache-release.outputs.cache-hit != 'true'
run: rm -rf release
- name: Prepare ccache timestamp
id: ccache_cache_timestamp
run: |
TZ=UTC echo "timestamp=$(TZ=UTC date +%Y-%m-%d-%H:%M:%S)" >> "$GITHUB_OUTPUT"
- name: Cache ~/.ccache directory
id: cache-ccache
uses: actions/cache@v3
with:
path: ~/.ccache
key: ${{ matrix.os }}-ccache-dir-${{ steps.ccache_cache_timestamp.outputs.timestamp }}
restore-keys: ${{ matrix.os }}-ccache-dir-
- name: Ccache stat
run: ccache -s
- name: Cache ~/.cache/bazel directory
uses: actions/cache@v3
with:
path: "~/.cache/bazel"
key: ${{ matrix.os }}-cache-bazel-dir
- name: Install numpy
run: pip install numpy
- name: Build hisui
run: ./build.bash ${{ matrix.os }} --package --use-ccache ${{ contains(matrix.os, '_x86_64') && '--with-test' || '' }}
timeout-minutes: 120
- name: Test hisui
if: contains(matrix.os, '_x86_64')
run: cmake --build release/${{ matrix.os }} --target test -- ARGS='-V -L hisui'
- name: Output package name
shell: bash
run: |
source VERSION
echo "PACKAGE_NAME=hisui-${HISUI_VERSION}_${{ matrix.os }}.tar.gz" >> ${{ matrix.os }}.env
echo "CONTENT_TYPE=application/gzip" >> ${{ matrix.os }}.env
echo "name=hisui-${HISUI_VERSION}_${{ matrix.os }}.tar.gz" >> "$GITHUB_OUTPUT"
id: package_name
- name: Upload hisui binary
uses: actions/upload-artifact@v3
with:
name: ${{ matrix.os }}-hisui-binary
path: release/${{ matrix.os }}/hisui
if-no-files-found: error
- name: Upload hisui binary with hash
uses: actions/upload-artifact@v3
with:
name: ${{ matrix.os }}-hisui-binary-${{ steps.vars.outputs.sha_short }}
path: release/${{ matrix.os }}/hisui
if-no-files-found: error
- name: Upload Lyra model_coeffs with hash
uses: actions/upload-artifact@v3
with:
name: ${{ matrix.os }}-lyra-model-coeffs
path: third_party/lyra/lyra/lyra/model_coeffs
if-no-files-found: error
- name: Upload tarball
uses: actions/upload-artifact@v3
with:
name: ${{ steps.package_name.outputs.name }}
path: release/${{ matrix.os }}/${{ steps.package_name.outputs.name }}
if-no-files-found: error
- name: Upload environment
uses: actions/upload-artifact@v3
with:
name: ${{ matrix.os }}.env
path: ${{ matrix.os }}.env
if-no-files-found: error
- name: Slack Notification
if: failure()
uses: rtCamp/[email protected]
env:
SLACK_CHANNEL: hisui
SLACK_COLOR: danger
SLACK_TITLE: Failure build-linux ${{ matrix.os }}
SLACK_WEBHOOK: ${{ secrets.SLACK_WEBHOOK }}
push-to-dockerhub:
name: Push to DockerHub
if: contains(github.ref, 'tags/202')
needs:
- build-linux
runs-on: ubuntu-20.04
steps:
- uses: actions/checkout@v4
- name: Mkdir release
shell: bash
run: |
mkdir -p release/ubuntu-20.04_x86_64
mkdir -p release/ubuntu-20.04_arm64
mkdir -p release/ubuntu-22.04_x86_64
mkdir -p release/ubuntu-22.04_arm64
- uses: actions/download-artifact@v3
with:
name: ubuntu-20.04_x86_64-hisui-binary
path: release/ubuntu-20.04_x86_64
- uses: actions/download-artifact@v3
with:
name: ubuntu-20.04_arm64-hisui-binary
path: release/ubuntu-20.04_arm64
- uses: actions/download-artifact@v3
with:
name: ubuntu-22.04_x86_64-hisui-binary
path: release/ubuntu-22.04_x86_64
- uses: actions/download-artifact@v3
with:
name: ubuntu-22.04_arm64-hisui-binary
path: release/ubuntu-22.04_arm64
- name: Chmod 755 hisui
shell: bash
run: |
chmod 755 release/ubuntu-20.04_x86_64/hisui
chmod 755 release/ubuntu-20.04_arm64/hisui
chmod 755 release/ubuntu-22.04_x86_64/hisui
chmod 755 release/ubuntu-22.04_arm64/hisui
- uses: actions/download-artifact@v3
with:
name: ubuntu-20.04_x86_64-lyra-model-coeffs
path: release/ubuntu-20.04_x86_64/lyra/model_coeffs
- uses: actions/download-artifact@v3
with:
name: ubuntu-20.04_arm64-lyra-model-coeffs
path: release/ubuntu-20.04_arm64/lyra/model_coeffs
- uses: actions/download-artifact@v3
with:
name: ubuntu-22.04_x86_64-lyra-model-coeffs
path: release/ubuntu-22.04_x86_64/lyra/model_coeffs
- uses: actions/download-artifact@v3
with:
name: ubuntu-22.04_arm64-lyra-model-coeffs
path: release/ubuntu-22.04_arm64/lyra/model_coeffs
- name: Get Versions
shell: bash
id: versions
run: |
source VERSION
echo "hisui_version=${HISUI_VERSION}" >> "$GITHUB_OUTPUT"
- name: Login to DockerHub
uses: docker/login-action@v2
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2
- name: Push to DockerHub
uses: docker/build-push-action@v4
with:
context: .
push: true
tags: shiguredo/hisui:${{ steps.versions.outputs.hisui_version }}-ubuntu-20.04
platforms: linux/amd64,linux/arm64
file: docker/Dockerfile
build-args: |
UBUNTU_VERSION=20.04
- name: Push to DockerHub
uses: docker/build-push-action@v4
with:
context: .
push: true
tags: shiguredo/hisui:${{ steps.versions.outputs.hisui_version }}-ubuntu-22.04
platforms: linux/amd64,linux/arm64
file: docker/Dockerfile
build-args: |
UBUNTU_VERSION=22.04
- name: Slack Notification
if: failure()
uses: rtCamp/[email protected]
env:
SLACK_CHANNEL: hisui
SLACK_COLOR: danger
SLACK_TITLE: Failure push-to-dockerhub
SLACK_WEBHOOK: ${{ secrets.SLACK_WEBHOOK }}
create-release:
name: Create release
if: contains(github.ref, 'tags/202')
needs:
- build-linux
runs-on: ubuntu-20.04
steps:
- uses: actions/checkout@v4
- uses: ./.github/actions/download
with:
platform: ubuntu-20.04_x86_64
- uses: ./.github/actions/download
with:
platform: ubuntu-20.04_arm64
- uses: ./.github/actions/download
with:
platform: ubuntu-22.04_x86_64
- uses: ./.github/actions/download
with:
platform: ubuntu-22.04_arm64
- name: Env to output
run: |
{
echo "package_paths<<EOF"
cat package_paths.env
echo "EOF"
} >> "$GITHUB_OUTPUT"
id: env
- name: Release
uses: softprops/action-gh-release@v2
with:
files:
${{ steps.env.outputs.package_paths }}
- name: Slack Notification
if: failure()
uses: rtCamp/[email protected]
env:
SLACK_CHANNEL: hisui
SLACK_COLOR: danger
SLACK_TITLE: Failure upload-assets
SLACK_WEBHOOK: ${{ secrets.SLACK_WEBHOOK }}