Update README.md #2029
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |