-
Notifications
You must be signed in to change notification settings - Fork 171
385 lines (333 loc) · 13.6 KB
/
build.yaml
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
377
378
379
380
381
382
383
384
385
name: Build binaries
on:
pull_request:
push:
branches:
- master
tags:
- "v*"
concurrency:
group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }}
cancel-in-progress: true
jobs:
linux-build:
name: Build binaries for ${{ matrix.platform.name }}-${{ matrix.arch }}
runs-on: ${{ matrix.platform.runner }}
container:
image: ubuntu:18.04
strategy:
fail-fast: false
matrix:
arch:
- arm64
- amd64
platform:
- name: linux
runner: ubuntu-latest
- name: windows
runner: ubuntu-latest
exclude:
- platform:
name: windows
arch: arm64
steps:
- name: Setup ubuntu container
run: |
apt update
apt install -yqq build-essential make software-properties-common
add-apt-repository -y ppa:git-core/ppa
apt update && apt install -yqq git zip unzip zlib1g-dev zlib1g
- name: Check out code
uses: actions/[email protected]
with:
fetch-depth: 0
# Check https://github.com/livepeer/go-livepeer/pull/1891
# for ref value discussion
ref: ${{ github.event.pull_request.head.sha }}
- name: Set up go
id: go
uses: actions/setup-go@v4
with:
go-version: 1.20.4
cache: true
cache-dependency-path: go.sum
- name: Cache ffmpeg
id: cache-ffmpeg
uses: actions/cache@v3
with:
path: /github/home/compiled
key: ${{ runner.os }}-${{ matrix.platform.name }}-${{ matrix.arch }}-ffmpeg-${{ hashFiles('**/install_ffmpeg.sh') }}
restore-keys: |
${{ runner.os }}-${{ matrix.platform.name }}-${{ matrix.arch }}-ffmpeg-
- name: Cache binaries
uses: actions/cache@v3
with:
path: ~/build
key: ${{ runner.os }}-${{ matrix.platform.name }}-${{ matrix.arch }}-binaries-${{ github.sha }}
- name: Set build environment
run: |
echo "GOARCH=${{ matrix.arch }}" >> $GITHUB_ENV
echo "GOOS=${{ matrix.platform.name }}" >> $GITHUB_ENV
echo "GO_BUILD_DIR=lp-builds/" >> $GITHUB_ENV
- name: Install dependencies
run: |
apt-get update \
&& apt-get install -y software-properties-common curl apt-transport-https \
&& curl -fsSl https://apt.llvm.org/llvm-snapshot.gpg.key | apt-key add - \
&& add-apt-repository "deb [arch=amd64] http://apt.llvm.org/xenial/ llvm-toolchain-xenial-12 main" \
&& apt-get update \
&& apt-get -y install clang-12 clang-tools-12 lld-12 build-essential pkg-config autoconf git python gcc-multilib libgcc-8-dev-arm64-cross mingw-w64-tools gcc-mingw-w64-x86-64
update-alternatives --install /usr/bin/clang++ clang++ /usr/bin/clang++-12 30 \
&& update-alternatives --install /usr/bin/clang clang /usr/bin/clang-12 30 \
&& update-alternatives --install /usr/bin/ld ld /usr/bin/lld-12 30
- name: Install go modules
if: steps.go.outputs.cache-hit != 'true'
run: go mod download
- name: Install ffmpeg
if: steps.cache-ffmpeg.outputs.cache-hit != 'true'
run: ./install_ffmpeg.sh
- name: Build binaries
env:
GHA_REF: ${{ github.event_name == 'pull_request' && github.event.pull_request.head.ref || github.ref }}
run: |
git config --global --add safe.directory '*'
export PKG_CONFIG_PATH=/github/home/compiled/lib/pkgconfig
./ci_env.sh make
- name: Upload build
if: github.event_name == 'push' || github.event.pull_request.head.repo.full_name == github.repository
env:
GHA_REF: ${{ github.event_name == 'pull_request' && github.event.pull_request.head.ref || github.ref }}
GCLOUD_KEY: ${{ secrets.GCLOUD_KEY }}
GCLOUD_SECRET: ${{ secrets.GCLOUD_SECRET }}
DISCORD_URL: ${{ secrets.DISCORD_URL }}
run: ./upload_build.sh
- name: Upload artifacts for cutting release
uses: actions/upload-artifact@master
with:
name: release-artifacts
path: releases/
- name: Notify new build upload
run: curl -X POST https://holy-bread-207a.livepeer.workers.dev
macos-build:
name: Build binaries for ${{ matrix.platform.name }}-${{ matrix.arch }}
runs-on: ${{ matrix.platform.runner }}
strategy:
fail-fast: false
matrix:
arch:
- arm64
- amd64
platform:
- name: darwin
runner: macos-latest
steps:
- name: Check out code
uses: actions/[email protected]
with:
fetch-depth: 0
# Check https://github.com/livepeer/go-livepeer/pull/1891
# for ref value discussion
ref: ${{ github.event.pull_request.head.sha }}
- name: Set up go
id: go
uses: actions/setup-go@v4
with:
go-version: 1.20.4
cache: true
cache-dependency-path: go.sum
- name: Set build environment
run: |
echo "GOARCH=${{ matrix.arch }}" >> $GITHUB_ENV
echo "GOOS=${{ matrix.platform.name }}" >> $GITHUB_ENV
echo "GO_BUILD_DIR=lp-builds/" >> $GITHUB_ENV
- name: Cache ffmpeg
id: cache-ffmpeg
uses: actions/cache@v3
with:
path: ~/compiled
key: ${{ runner.os }}-${{ matrix.platform.name }}-${{ matrix.arch }}-ffmpeg-${{ hashFiles('**/install_ffmpeg.sh') }}
restore-keys: |
${{ runner.os }}-${{ matrix.platform.name }}-${{ matrix.arch }}-ffmpeg-
- name: Cache binaries
uses: actions/cache@v3
with:
path: ~/build
key: ${{ runner.os }}-${{ matrix.platform.name }}-${{ matrix.arch }}-binaries-${{ github.sha }}
- name: Install dependencies
run: brew install coreutils pkg-config
- name: Install go modules
# if: steps.go.outputs.cache-hit != 'true'
run: go mod download
- name: Install ffmpeg
if: steps.cache-ffmpeg.outputs.cache-hit != 'true'
run: ./install_ffmpeg.sh
- name: Build binaries
env:
GHA_REF: ${{ github.event_name == 'pull_request' && github.event.pull_request.head.ref || github.ref }}
run: |
git config --global --add safe.directory '*'
export PKG_CONFIG_PATH=~/compiled/lib/pkgconfig
./ci_env.sh make
- uses: actions-ecosystem/action-regex-match@v2
id: match-tag
with:
text: ${{ github.ref_name }}
regex: '^(master|main|v[0-9]+\.\d+\.\d+)$'
- name: Codesign and notarize binaries
if: steps.match-tag.outputs.match != '' && matrix.platform.name == 'darwin'
uses: livepeer/action-gh-codesign-apple@latest
with:
developer-certificate-id: ${{ secrets.CI_MACOS_CERTIFICATE_ID }}
developer-certificate-base64: ${{ secrets.CI_MACOS_CERTIFICATE_BASE64 }}
developer-certificate-password: ${{ secrets.CI_MACOS_CERTIFICATE_PASSWORD }}
app-notarization-email: ${{ secrets.CI_MACOS_NOTARIZATION_USER }}
app-notarization-password: ${{ secrets.CI_MACOS_NOTARIZATION_PASSWORD }}
app-notarization-team-id: ${{ secrets.CI_MACOS_NOTARIZATION_TEAM_ID }}
binary-path: "lp-builds/"
- name: Upload build
if: github.event_name == 'push' || github.event.pull_request.head.repo.full_name == github.repository
env:
GHA_REF: ${{ github.event_name == 'pull_request' && github.event.pull_request.head.ref || github.ref }}
GCLOUD_KEY: ${{ secrets.GCLOUD_KEY }}
GCLOUD_SECRET: ${{ secrets.GCLOUD_SECRET }}
DISCORD_URL: ${{ secrets.DISCORD_URL }}
run: ./upload_build.sh
- name: Upload artifacts for cutting release
uses: actions/upload-artifact@master
with:
name: release-artifacts
path: releases/
- name: Notify new build upload
run: curl -X POST https://holy-bread-207a.livepeer.workers.dev
linux-tensorflow:
name: Build binaries for linux using tensorflow
runs-on: ubuntu-latest
container:
image: ubuntu:18.04
steps:
- name: Setup ubuntu container
run: |
apt update
apt install -yqq build-essential make software-properties-common
add-apt-repository -y ppa:git-core/ppa
apt update && apt install -yqq git zip unzip zlib1g-dev zlib1g coreutils binutils libc++-dev libc++abi-dev libtool p7zip-full mediainfo xz-utils
- name: Check out code
uses: actions/[email protected]
with:
fetch-depth: 0
# Check https://github.com/livepeer/go-livepeer/pull/1891
# for ref value discussion
ref: ${{ github.event.pull_request.head.sha }}
- name: Set up go
id: go
uses: actions/setup-go@v4
with:
go-version: 1.20.4
cache: true
cache-dependency-path: go.sum
- name: Cache ffmpeg
id: cache-ffmpeg
uses: actions/cache@v3
with:
path: /github/home/compiled
key: ${{ runner.os }}-ffmpeg-tf-${{ hashFiles('**/install_ffmpeg.sh') }}
restore-keys: |
${{ runner.os }}-ffmpeg-tf-
- name: Cache binaries
uses: actions/cache@v3
with:
path: ~/build
key: ${{ runner.os }}-binaries-tf-${{ github.sha }}
- name: Install dependencies
run: |
apt-get update \
&& apt-get install -y software-properties-common curl apt-transport-https \
&& curl -fsSl https://apt.llvm.org/llvm-snapshot.gpg.key | apt-key add - \
&& add-apt-repository "deb [arch=amd64] http://apt.llvm.org/xenial/ llvm-toolchain-xenial-8 main" \
&& apt-get update \
&& apt-get -y install clang-8 clang-tools-8 build-essential pkg-config autoconf gnutls-dev git python
update-alternatives --install /usr/bin/clang++ clang++ /usr/bin/clang++-8 30 \
&& update-alternatives --install /usr/bin/clang clang /usr/bin/clang-8 30
LIBTENSORFLOW_VERSION=2.12.1 \
&& curl -LO https://storage.googleapis.com/tensorflow/libtensorflow/libtensorflow-gpu-linux-x86_64-${LIBTENSORFLOW_VERSION}.tar.gz \
&& tar -C /usr/local -xzf libtensorflow-gpu-linux-x86_64-${LIBTENSORFLOW_VERSION}.tar.gz \
&& ldconfig
- name: Install go modules
# if: steps.go.outputs.cache-hit != 'true'
run: go mod download
- name: Install ffmpeg
if: steps.cache-ffmpeg.outputs.cache-hit != 'true'
run: ./install_ffmpeg.sh
- name: Build binaries
env:
GHA_REF: ${{ github.event_name == 'pull_request' && github.event.pull_request.head.ref || github.ref }}
run: |
git config --global --add safe.directory '*'
export PKG_CONFIG_PATH=/github/home/compiled/lib/pkgconfig
./ci_env.sh make cgo_cflags="-lz" all
rm -rf ~/build && mkdir ~/build && mv livepeer* ~/build/
- name: Upload build
run: cp ~/build/* . && ./upload_build.sh
env:
GHA_REF: ${{ github.event_name == 'pull_request' && github.event.pull_request.head.ref || github.ref }}
GCLOUD_KEY: ${{ secrets.GCLOUD_KEY }}
GCLOUD_SECRET: ${{ secrets.GCLOUD_SECRET }}
DISCORD_URL: ${{ secrets.DISCORD_URL }}
RELEASE_TAG: "tensorflow"
- name: Upload artifacts for cutting release
uses: actions/upload-artifact@master
with:
name: release-artifacts
path: releases/
- name: Notify new build upload
run: curl -X POST https://holy-bread-207a.livepeer.workers.dev
upload:
name: Upload artifacts to google bucket
permissions:
contents: "read"
id-token: "write"
runs-on: ubuntu-latest
needs:
- macos-build
- linux-build
- linux-tensorflow
steps:
- name: Download artifacts
uses: actions/download-artifact@v3
with:
name: release-artifacts
path: releases/
- name: Generate sha256 checksum and gpg signatures for release artifacts
uses: livepeer/action-gh-checksum-and-gpg-sign@latest
with:
artifacts-dir: releases
release-name: ${{ (github.ref_type == 'tag' && github.ref_name) || github.sha }}
gpg-key: ${{ secrets.CI_GPG_SIGNING_KEY }}
gpg-key-passphrase: ${{ secrets.CI_GPG_SIGNING_PASSPHRASE }}
- name: Generate branch manifest
id: branch-manifest
uses: livepeer/branch-manifest-action@latest
with:
project-name: livepeer
bucket-key: ${{ github.event.repository.name }}
use-prefix: false
- name: Authenticate to Google Cloud
id: auth
uses: google-github-actions/auth@v1
with:
workload_identity_provider: ${{ secrets.CI_GOOGLE_WORKLOAD_IDENTITY_PROVIDER }}
service_account: ${{ secrets.CI_GOOGLE_SERVICE_ACCOUNT }}
- name: Upload release archives to Google Cloud
id: upload-archives
uses: google-github-actions/upload-cloud-storage@v1
with:
path: "releases"
destination: "build.livepeer.live/${{ github.event.repository.name }}/${{ (github.ref_type == 'tag' && github.ref_name) || github.sha }}"
parent: false
- name: Upload branch manifest file
id: upload-manifest
uses: google-github-actions/upload-cloud-storage@v1
with:
path: ${{ steps.branch-manifest.outputs.manifest-file }}
destination: "build.livepeer.live/${{ github.event.repository.name }}/"
parent: false