-
-
Notifications
You must be signed in to change notification settings - Fork 5.4k
327 lines (308 loc) · 13.5 KB
/
test.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
name: "Test"
# @see https://docs.github.com/en/actions/reference/workflow-syntax-for-github-actions#onpushpull_requestbranchestags
on: [push, pull_request]
# Declare default permissions as read only.
permissions: read-all
# The dependency graph:
# test(6m)
# multiple-arch-armv7(13m)
# multiple-arch-aarch64(7m)
# cygwin64-cache(1m)
# cygwin64(6m) - Must depends on cygwin64-cache.
# fast(0s) - To limit all fastly run jobs after slow jobs.
# build-centos7(3m)
# build-ubuntu16(3m)
# build-ubuntu18(2m)
# build-ubuntu20(2m)
# build-cross-arm(3m)
# build-cross-aarch64(3m)
# multiple-arch-amd64(2m)
# coverage(3m)
jobs:
cygwin64-cache:
name: cygwin64-cache
steps:
- name: Download Cache for Cygwin
run: |
echo "Generate convert.sh" &&
echo "for file in \$(find objs -type l); do" > convert.sh &&
echo " REAL=\$(readlink -f \$file) &&" >> convert.sh &&
echo " echo \"convert \$file to \$REAL\" &&" >> convert.sh &&
echo " rm -rf \$file &&" >> convert.sh &&
echo " cp -r \$REAL \$file" >> convert.sh &&
echo "done" >> convert.sh &&
cat convert.sh &&
docker run --rm -v $(pwd):/srs -w /usr/local/srs-cache/srs/trunk ossrs/srs:cygwin64-cache \
bash -c "bash /srs/convert.sh && tar cf /srs/objs.tar.bz2 objs" &&
pwd && du -sh *
##################################################################################################################
- uses: actions/upload-artifact@0b7f8abb1508181956e8e162db84b466c27e18ce # v3.1.2
with:
name: srs-cache
path: objs.tar.bz2
retention-days: 1
runs-on: ubuntu-20.04
cygwin64:
name: cygwin64
needs:
- cygwin64-cache
steps:
# See https://github.com/cygwin/cygwin-install-action#parameters
# Note that https://github.com/egor-tensin/setup-cygwin fails to install packages.
- name: Setup Cygwin
uses: cygwin/cygwin-install-action@006ad0b0946ca6d0a3ea2d4437677fa767392401 # master
with:
platform: x86_64
packages: bash make gcc-g++ cmake automake patch pkg-config tcl unzip
install-dir: C:\cygwin64
##################################################################################################################
- name: Checkout repository
uses: actions/checkout@ac593985615ec2ede58e132d2e21d2b1cbd6127c # v3.3.0
##################################################################################################################
# Note that we must download artifact after checkout code, because it will change the files in workspace.
- uses: actions/download-artifact@9bc31d5ccc31df68ecc42ccf4149144866c47d8a # v3.0.2
with:
name: srs-cache
- uses: geekyeggo/delete-artifact@54ab544f12cdb7b71613a16a2b5a37a9ade990af # v2.0.0
with:
name: srs-cache
##################################################################################################################
- name: Build and test SRS
env:
SHELLOPTS: igncr
SRS_WORKSPACE: ${{ github.workspace }}
shell: C:\cygwin64\bin\bash.exe --login '{0}'
run: |
WORKDIR=$(cygpath -u $SRS_WORKSPACE) && export PATH=/usr/bin:/usr/local/bin && cd ${WORKDIR} &&
pwd && rm -rf /usr/local/srs-cache && mkdir -p /usr/local/srs-cache/srs/trunk && ls -lh &&
tar xf objs.tar.bz2 -C /usr/local/srs-cache/srs/trunk/ && du -sh /usr/local/srs-cache/srs/trunk/* &&
cd ${WORKDIR}/trunk && ./configure --h265=on --gb28181=on --utest=on && ls -lh && du -sh * && du -sh objs/* &&
cd ${WORKDIR}/trunk && make utest && ./objs/srs_utest
runs-on: windows-latest
build-centos7:
name: build-centos7
needs:
- fast
steps:
- name: Checkout repository
uses: actions/checkout@ac593985615ec2ede58e132d2e21d2b1cbd6127c # v3.3.0
# Build for CentOS 7
- name: Build on CentOS7, baseline
run: DOCKER_BUILDKIT=1 docker build -f trunk/Dockerfile.builds --target centos7-baseline .
- name: Build on CentOS7, with all features
run: DOCKER_BUILDKIT=1 docker build -f trunk/Dockerfile.builds --target centos7-all .
- name: Build on CentOS7, without WebRTC
run: DOCKER_BUILDKIT=1 docker build -f trunk/Dockerfile.builds --target centos7-no-webrtc .
- name: Build on CentOS7, without ASM
run: DOCKER_BUILDKIT=1 docker build -f trunk/Dockerfile.builds --target centos7-no-asm .
- name: Build on CentOS7, C++98, no FFmpeg
run: DOCKER_BUILDKIT=1 docker build -f trunk/Dockerfile.builds --target centos7-ansi-no-ffmpeg .
runs-on: ubuntu-20.04
build-ubuntu16:
name: build-ubuntu16
needs:
- fast
steps:
- name: Checkout repository
uses: actions/checkout@ac593985615ec2ede58e132d2e21d2b1cbd6127c # v3.3.0
# Build for Ubuntu16
- name: Build on Ubuntu16, baseline
run: DOCKER_BUILDKIT=1 docker build -f trunk/Dockerfile.builds --target ubuntu16-baseline .
- name: Build on Ubuntu16, with all features
run: DOCKER_BUILDKIT=1 docker build -f trunk/Dockerfile.builds --target ubuntu16-all .
runs-on: ubuntu-20.04
build-ubuntu18:
name: build-ubuntu18
needs:
- fast
steps:
- name: Checkout repository
uses: actions/checkout@ac593985615ec2ede58e132d2e21d2b1cbd6127c # v3.3.0
# Build for Ubuntu18
- name: Build on Ubuntu18, baseline
run: DOCKER_BUILDKIT=1 docker build -f trunk/Dockerfile.builds --target ubuntu18-baseline .
- name: Build on Ubuntu18, with all features
run: DOCKER_BUILDKIT=1 docker build -f trunk/Dockerfile.builds --target ubuntu18-all .
runs-on: ubuntu-20.04
build-ubuntu20:
name: build-ubuntu20
needs:
- fast
steps:
- name: Checkout repository
uses: actions/checkout@ac593985615ec2ede58e132d2e21d2b1cbd6127c # v3.3.0
# Build for Ubuntu20
- name: Build on Ubuntu20, baseline
run: DOCKER_BUILDKIT=1 docker build -f trunk/Dockerfile.builds --target ubuntu20-baseline .
- name: Build on Ubuntu20, with all features
run: DOCKER_BUILDKIT=1 docker build -f trunk/Dockerfile.builds --target ubuntu20-all .
runs-on: ubuntu-20.04
build-cross-arm:
name: build-cross-arm
needs:
- fast
steps:
- name: Checkout repository
uses: actions/checkout@ac593985615ec2ede58e132d2e21d2b1cbd6127c # v3.3.0
- name: Cross Build for ARMv7 on Ubuntu16
run: DOCKER_BUILDKIT=1 docker build -f trunk/Dockerfile.builds --target ubuntu16-cache-cross-armv7 .
- name: Cross Build for ARMv7 on Ubuntu20
run: DOCKER_BUILDKIT=1 docker build -f trunk/Dockerfile.builds --target ubuntu20-cache-cross-armv7 .
runs-on: ubuntu-20.04
build-cross-aarch64:
name: build-cross-aarch64
needs:
- fast
steps:
- name: Checkout repository
uses: actions/checkout@ac593985615ec2ede58e132d2e21d2b1cbd6127c # v3.3.0
- name: Cross Build for AARCH64 on Ubuntu16
run: DOCKER_BUILDKIT=1 docker build -f trunk/Dockerfile.builds --target ubuntu16-cache-cross-aarch64 .
- name: Cross Build for AARCH64 on Ubuntu20
run: DOCKER_BUILDKIT=1 docker build -f trunk/Dockerfile.builds --target ubuntu20-cache-cross-aarch64 .
runs-on: ubuntu-20.04
test:
name: utest-regression-blackbox-test
steps:
- name: Checkout repository
uses: actions/checkout@ac593985615ec2ede58e132d2e21d2b1cbd6127c # v3.3.0
# Tests
- name: Build test image
run: docker build --tag srs:test --build-arg MAKEARGS='-j2' -f trunk/Dockerfile.test .
# For blackbox-test
- name: Run SRS blackbox-test
run: |
#docker run --rm -w /srs/trunk/3rdparty/srs-bench srs:test ./objs/srs_blackbox_test -test.v \
# -test.run 'TestFast_RtmpPublish_DvrFlv_Basic' -srs-log -srs-stdout srs-ffmpeg-stderr -srs-dvr-stderr \
# -srs-ffprobe-stdout
docker run --rm -w /srs/trunk/3rdparty/srs-bench srs:test \
./objs/srs_blackbox_test -test.v -test.run '^TestFast' -test.parallel 64
docker run --rm -w /srs/trunk/3rdparty/srs-bench srs:test \
./objs/srs_blackbox_test -test.v -test.run '^TestSlow' -test.parallel 1
# For utest
- name: Run SRS utest
run: docker run --rm srs:test ./objs/srs_utest
# For regression-test
- name: Run SRS regression-test
run: |
docker run --rm srs:test bash -c './objs/srs -c conf/regression-test.conf && sleep 10 && \
cd 3rdparty/srs-bench && (./objs/srs_test -test.v || (cat ../../objs/srs.log && exit 1)) && \
./objs/srs_gb28181_test -test.v'
runs-on: ubuntu-20.04
coverage:
name: coverage
needs:
- fast
steps:
- name: Checkout repository
uses: actions/checkout@ac593985615ec2ede58e132d2e21d2b1cbd6127c # v3.3.0
# Tests
- name: Build coverage image
run: docker build --tag srs:cov --build-arg MAKEARGS='-j2' -f trunk/Dockerfile.cov .
# For coverage
- name: Run SRS covergae
if: ${{ startsWith(github.ref, 'refs/heads/') || startsWith(github.ref, 'refs/pull/') }}
env:
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
run: |
# The hash of commit.
SRS_SHA=${{ github.sha }}
# Note that the root of SRS, must contains .git, for report fixing.
SRS_PROJECT=/srs
# The github.ref is, for example, refs/heads/develop
SRS_BRANCH=$(echo ${{ github.ref }}| awk -F 'refs/heads/' '{print $2}'| awk -F '/' '{print $1}')
# The github.ref is, for example, refs/pull/2536/merge
SRS_PR=$(echo ${{ github.ref }}| awk -F 'refs/pull/' '{print $2}'| awk -F '/' '{print $1}')
#
echo "For github.ref=${{ github.ref }}, github.sha=${{ github.sha }}"
echo "SRS_BRANCH=$SRS_BRANCH, SRS_PR=$SRS_PR, SRS_SHA=$SRS_SHA, SRS_PROJECT=$SRS_PROJECT"
docker run --rm --env CODECOV_TOKEN=$CODECOV_TOKEN --env SRS_BRANCH=$SRS_BRANCH \
--env SRS_PR=$SRS_PR --env SRS_SHA=$SRS_SHA --env SRS_PROJECT=$SRS_PROJECT \
srs:cov bash -c './objs/srs_utest && bash auto/codecov.sh'
#
runs-on: ubuntu-20.04
multiple-arch-armv7:
name: multiple-arch-armv7
steps:
- name: Checkout repository
uses: actions/checkout@ac593985615ec2ede58e132d2e21d2b1cbd6127c # v3.3.0
# See https://github.com/crazy-max/ghaction-docker-buildx#moved-to-docker-organization
# https://github.com/docker/setup-qemu-action
- name: Set up QEMU
uses: docker/setup-qemu-action@e81a89b1732b9c48d79cd809d8d81d79c4647a18 # v2.1.0
# https://github.com/docker/setup-buildx-action
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@8c0edbc76e98fa90f69d9a2c020dcb50019dc325 # v2.2.1
- name: Build multiple archs image
run: |
docker buildx build --platform linux/arm/v7 \
--output "type=image,push=false" \
--build-arg IMAGE=ossrs/srs:ubuntu20-cache \
--build-arg INSTALLDEPENDS="NO" \
-f Dockerfile .
runs-on: ubuntu-20.04
multiple-arch-aarch64:
name: multiple-arch-aarch64
steps:
- name: Checkout repository
uses: actions/checkout@ac593985615ec2ede58e132d2e21d2b1cbd6127c # v3.3.0
# See https://github.com/crazy-max/ghaction-docker-buildx#moved-to-docker-organization
# https://github.com/docker/setup-qemu-action
- name: Set up QEMU
uses: docker/setup-qemu-action@e81a89b1732b9c48d79cd809d8d81d79c4647a18 # v2.1.0
# https://github.com/docker/setup-buildx-action
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@8c0edbc76e98fa90f69d9a2c020dcb50019dc325 # v2.2.1
- name: Build multiple archs image
run: |
docker buildx build --platform linux/arm64/v8 \
--output "type=image,push=false" \
--build-arg IMAGE=ossrs/srs:ubuntu20-cache \
--build-arg INSTALLDEPENDS="NO" \
-f Dockerfile .
runs-on: ubuntu-20.04
multiple-arch-amd64:
name: multiple-arch-amd64
needs:
- fast
steps:
- name: Checkout repository
uses: actions/checkout@ac593985615ec2ede58e132d2e21d2b1cbd6127c # v3.3.0
# See https://github.com/crazy-max/ghaction-docker-buildx#moved-to-docker-organization
# https://github.com/docker/setup-qemu-action
- name: Set up QEMU
uses: docker/setup-qemu-action@e81a89b1732b9c48d79cd809d8d81d79c4647a18 # v2.1.0
# https://github.com/docker/setup-buildx-action
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@8c0edbc76e98fa90f69d9a2c020dcb50019dc325 # v2.2.1
- name: Build multiple archs image
run: |
docker buildx build --platform linux/amd64 \
--output "type=image,push=false" \
--build-arg IMAGE=ossrs/srs:ubuntu20-cache \
-f Dockerfile .
runs-on: ubuntu-20.04
fast:
name: fast
needs:
- cygwin64-cache
steps:
- run: echo 'Start fast jobs'
runs-on: ubuntu-20.04
test-done:
needs:
- cygwin64
- coverage
- test
- build-centos7
- build-ubuntu16
- build-ubuntu18
- build-ubuntu20
- build-cross-arm
- build-cross-aarch64
- multiple-arch-armv7
- multiple-arch-aarch64
- multiple-arch-amd64
runs-on: ubuntu-20.04
steps:
- run: echo 'All done'