forked from ossrs/oryx
-
Notifications
You must be signed in to change notification settings - Fork 0
131 lines (118 loc) · 4.9 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
name: Test Dev Environment
on:
push:
branches:
- main
- release/*
jobs:
envs:
name: envs
steps:
##################################################################################################################
# Git checkout
- name: Checkout repository
uses: actions/checkout@v3
# The github.ref is, for example, refs/tags/v5.0.145 or refs/tags/v5.0-r8
# Generate variables like:
# SRS_TAG=v1.0.52
# SRS_MAJOR=1
# @see https://docs.github.com/en/actions/reference/workflow-commands-for-github-actions#setting-an-environment-variable
- name: Generate varaiables
run: |
SRS_TAG=$(bash scripts/version.sh)
echo "SRS_TAG=$SRS_TAG" >> $GITHUB_ENV
SRS_MAJOR=$(echo $SRS_TAG| awk -F '.' '{print $1}' |sed 's/v//g')
echo "SRS_MAJOR=$SRS_MAJOR" >> $GITHUB_ENV
echo "SRS_TAG:$SRS_TAG, SRS_MAJOR:$SRS_MAJOR"
# Map a step output to a job output, see https://docs.github.com/en/actions/using-jobs/defining-outputs-for-jobs
outputs:
SRS_TAG: ${{ env.SRS_TAG }}
SRS_MAJOR: ${{ env.SRS_MAJOR }}
runs-on: ubuntu-20.04
test-en-image:
name: Test EN image
needs:
- envs
steps:
- name: Checkout repository
uses: actions/checkout@v3
- name: Build image for platform
run: |
docker build -t platform:latest -f Dockerfile .
docker images
- name: Download test file
run: |
curl --location --output test/source.200kbps.768x320.flv \
https://github.com/ossrs/srs/raw/develop/trunk/doc/source.200kbps.768x320.flv
- name: Install tools
run: |
docker run --rm -v /usr/bin:/g ossrs/srs:tools \
cp /usr/local/bin/ffmpeg /usr/local/bin/ffprobe /g/
ffmpeg -version
- name: Run test for platform image
run: |
docker tag platform ossrs/oryx:5
docker run --rm -d -p 2022:2022 -p 2443:2443 -p 1935:1935 \
-p 8000:8000/udp -p 10080:10080/udp --name oryx \
-v /data:/data -e REACT_APP_LOCALE=en ossrs/oryx:5
- name: Check and Test service
env:
SRS_OPENAI_KEY: ${{ secrets.SRS_OPENAI_KEY }}
run: |
# We will handle the error by ourselves.
set +e
# Record all logs.
docker logs -f oryx >docker.log 2>&1 & pid_docker=$!
echo "Wait for service ready." &&
make -j -C test &&
bash scripts/tools/secret.sh --output test/.env &&
./test/oryx.test -test.timeout=1h -test.failfast -test.v -endpoint http://localhost:2022 \
-srs-log=true -wait-ready=true -init-password=true -init-self-signed-cert=true \
-check-api-secret=true -test.run TestSystem_Empty &&
echo "Make upload writable." &&
sudo chmod 777 /data/upload &&
echo "Test HTTP service." &&
bash scripts/tools/secret.sh --output test/.env &&
./test/oryx.test -test.timeout=1h -test.failfast -test.v -endpoint http://localhost:2022 \
-srs-log=true -wait-ready=true -init-password=false -init-self-signed-cert=false \
-check-api-secret=true -no-media-test &&
echo "Test HTTPS service." &&
bash scripts/tools/secret.sh --output test/.env &&
./test/oryx.test -test.timeout=1h -test.failfast -test.v -endpoint https://localhost:2443 \
-srs-log=true -wait-ready=true -init-password=false -init-self-signed-cert=false \
-check-api-secret=true -no-media-test &&
echo "Run media test with retry" &&
bash scripts/tools/secret.sh --output test/.env &&
./scripts/tools/failed-retry.sh 3 ./test/oryx.test -test.timeout=1h -test.failfast -test.v -endpoint http://localhost:2022 \
-srs-log=true -wait-ready=true -init-password=false -init-self-signed-cert=false \
-check-api-secret=true -test.run WithStream
ret=$?; echo "Test result: $ret"
echo "Stop service"
docker stop oryx
kill $pid_docker 2>/dev/null
echo "Log of docker.log" && cat docker.log
exit $ret
runs-on: ubuntu-20.04
check-pr-test:
steps:
- name: Wait for PR Test Workflow
uses: fountainhead/action-wait-for-check@v1.1.0
id: wait-for-test
with:
token: ${{ secrets.GITHUB_TOKEN }}
checkName: test-pr-final
ref: ${{ github.sha }}
timeoutSeconds: 3600
- name: Check Test Workflow result
if: steps.wait-for-test.outputs.conclusion != 'success'
run: |
echo "Test Workflow failed, aborting release" && exit 1
runs-on: ubuntu-20.04
test-final:
name: test-final
runs-on: ubuntu-20.04
needs:
- check-pr-test
- test-en-image
steps:
- run: echo OK