Skip to content

Remove linux/arm/v7 support. v5.15.15 #137

Remove linux/arm/v7 support. v5.15.15

Remove linux/arm/v7 support. v5.15.15 #137

Workflow file for this run

name: Test Online Environment
on:
push:
tags:
- v*
# See https://docs.github.com/en/actions/managing-workflow-runs/manually-running-a-workflow
workflow_dispatch:
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
SRS_DOMAIN=lego-$(date +%s)-$RANDOM
echo "SRS_DOMAIN=$SRS_DOMAIN" >> $GITHUB_ENV
echo "SRS_TAG:$SRS_TAG, SRS_MAJOR:$SRS_MAJOR, SRS_DOMAIN:$SRS_DOMAIN"
# 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 }}
SRS_DOMAIN: ${{ env.SRS_DOMAIN }}
runs-on: ubuntu-20.04
build-image:
name: Build 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
docker save -o platform.tar platform:latest
- uses: actions/upload-artifact@v3
with:
name: platform-cache
path: platform.tar
retention-days: 1
runs-on: ubuntu-20.04
create-vm-domain:
name: Create VM Domain
needs:
- envs
steps:
- name: Covert output to env
run: |
echo "SRS_TAG=${{ needs.envs.outputs.SRS_TAG }}" >> $GITHUB_ENV
echo "SRS_DOMAIN=${{ needs.envs.outputs.SRS_DOMAIN }}" >> $GITHUB_ENV
- name: Install doctl
uses: digitalocean/action-doctl@v2
with:
token: ${{ secrets.DIGITALOCEAN_ACCESS_TOKEN }}
# Note that s-1vcpu-512mb-10gb is too small for test, because it leads to overload and failure due
# to the process kswapd. It is recommendded to use either s-1vcpu-1gb or s-2vcpu-2gb size instead.
- name: Create test machine
run: |
sshkey=$(doctl compute ssh-key list --no-header |grep srs |awk '{print $1}')
doctl compute droplet create $SRS_DOMAIN \
--image ubuntu-20-04-x64 --region sgp1 --size s-1vcpu-1gb \
--ssh-keys $sshkey --wait
- name: Query IP of Server
run: |
SRS_DROPLET_EIP=$(doctl compute droplet get $SRS_DOMAIN --format PublicIPv4 --no-header)
echo "SRS_DROPLET_EIP=$SRS_DROPLET_EIP" >> $GITHUB_ENV
echo "SRS_DROPLET_EIP:$SRS_DROPLET_EIP"
- name: Create domain name
run: |
doctl compute domain records create ossrs.io \
--record-type A --record-name $SRS_DOMAIN --record-data $SRS_DROPLET_EIP \
--record-ttl 3600
# Note that should never list all records.
doctl compute domain records ls ossrs.io |grep lego |wc -l
- name: Tips for Debugging
run: |
echo "Please use the following command to login the server:"
echo " ssh root@$SRS_DROPLET_EIP"
echo "Or check by web console:"
echo " http://$SRS_DOMAIN.ossrs.io"
echo "To terminate immediately:"
echo " ssh root@$SRS_DROPLET_EIP touch ctrl-abort"
echo "To reset the timer:"
echo " ssh root@$SRS_DROPLET_EIP touch ctrl-reset"
echo "To always wait for debugging:"
echo " ssh root@$SRS_DROPLET_EIP touch ctrl-debugging"
echo "Never dispose:"
echo " for((;;)); do ssh root@$SRS_DROPLET_EIP touch ctrl-debugging ctrl-reset; sleep 3; done"
- name: Checkout repository
uses: actions/checkout@v3
- 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: Build package
run: |
# Build files for test, should run in ubuntu20.
bash scripts/setup-ubuntu/build.sh --language en --version $SRS_TAG --output $(pwd)/build
make -j -C test
# All files in provision will be uploaded to server.
mkdir -p provision provision/test
cp test/oryx.test test/source.200kbps.768x320.flv provision/test/
cp scripts/tools/failed-retry.sh provision/
cp build/linux-oryx-en.tar.gz platform/containers/conf/nginx.conf \
scripts/tools/secret.sh provision/
- name: Copy file via ssh key
uses: appleboy/scp-action@v0.1.4
with:
host: ${{ env.SRS_DROPLET_EIP }}
username: root
port: 22
key: ${{ secrets.DIGITALOCEAN_SSHKEY }}
timeout: 600s
source: provision/*
target: /root
- name: Provision server
uses: appleboy/ssh-action@master
with:
host: ${{ env.SRS_DROPLET_EIP }}
username: root
key: ${{ secrets.DIGITALOCEAN_SSHKEY }}
port: 22
timeout: 600s
script: |
for ((i=0; i<10; i++)); do
apt-get update -y &&
apt-get install -y docker.io nginx unzip net-tools tree &&
echo "Install OK" && break
echo "Install failed, retry" &&
sleep 3
done
docker run --rm -v /usr/bin:/g ossrs/srs:tools \
cp /usr/local/bin/ffmpeg /usr/local/bin/ffprobe /g/
ffmpeg -version
# Move files from provision.
mv -f provision/* .
/etc/init.d/nginx stop
cp nginx.conf /etc/nginx/nginx.conf
sed -i "s/user nginx;/user www-data;/g" /etc/nginx/nginx.conf
mkdir -p /data/config && touch /data/config/nginx.http.conf /data/config/nginx.server.conf
/etc/init.d/nginx start
- name: Wait for domain ready
run: |
for ((i=0; i<100; i++)); do
IP=$(dig +short $SRS_DOMAIN.ossrs.io 2>/dev/null)
if [[ ! -z $IP ]]; then
echo "Domain $SRS_DOMAIN.ossrs.io is ready, IP=$IP"
exit 0
fi
done
echo "Domain $SRS_DOMAIN.ossrs.io is not ready"
exit 1
# Map a step output to a job output, see https://docs.github.com/en/actions/using-jobs/defining-outputs-for-jobs
outputs:
SRS_DROPLET_EIP: ${{ env.SRS_DROPLET_EIP }}
runs-on: ubuntu-20.04
run-test:
name: Run Test
needs:
- envs
- build-image
- create-vm-domain
steps:
- name: Remove unnecessary files
run: |
df -h
echo ""
echo "After removed some unused files."
echo ""
sudo rm -rf /usr/share/dotnet /usr/local/lib/android /opt/ghc \
/usr/local/share/powershell /usr/share/swift /usr/lib/jvm
df -h
- name: Covert output to env
run: |
echo "SRS_TAG=${{ needs.envs.outputs.SRS_TAG }}" >> $GITHUB_ENV
echo "SRS_DOMAIN=${{ needs.envs.outputs.SRS_DOMAIN }}" >> $GITHUB_ENV
echo "SRS_DROPLET_EIP=${{ needs.create-vm-domain.outputs.SRS_DROPLET_EIP }}" >> $GITHUB_ENV
- name: Install doctl
uses: digitalocean/action-doctl@v2
with:
token: ${{ secrets.DIGITALOCEAN_ACCESS_TOKEN }}
- name: Checkout repository
uses: actions/checkout@v3
- uses: actions/download-artifact@v3
with:
name: platform-cache
- name: Setup the Go
uses: actions/setup-go@v3
with:
go-version: '>=1.16.0'
- name: Build package
run: |
# Build files for test, should run in ubuntu20.
rm -f platform.tar.gz && tar zcf platform.tar.gz platform.tar
# All files in provision will be uploaded to server.
mkdir -p provision
cp platform.tar.gz provision
- name: Copy file via ssh key
uses: appleboy/scp-action@v0.1.4
with:
host: ${{ env.SRS_DROPLET_EIP }}
username: root
port: 22
key: ${{ secrets.DIGITALOCEAN_SSHKEY }}
timeout: 600s
source: provision/*
target: /root
- name: Provision server
env:
SRS_TAG: ${{ env.SRS_TAG }}
SRS_DOMAIN: ${{ env.SRS_DOMAIN }}
uses: appleboy/ssh-action@master
with:
host: ${{ env.SRS_DROPLET_EIP }}
username: root
key: ${{ secrets.DIGITALOCEAN_SSHKEY }}
port: 22
envs: SRS_TAG,SRS_DOMAIN
timeout: 600s
script: |
# Move files from provision.
mv -f provision/* .
# For manually debugging.
echo "" >> /etc/profile
echo "export SRS_TAG=${SRS_TAG}" >> /etc/profile
echo "export SRS_DOMAIN=${SRS_DOMAIN}" >> /etc/profile
if [[ $(docker images |grep platform |grep -q latest || echo no) == no ]]; then
tar xf platform.tar.gz
docker load -i platform.tar
fi
docker tag platform:latest ossrs/oryx:$SRS_TAG
docker tag platform:latest registry.cn-hangzhou.aliyuncs.com/ossrs/oryx:$SRS_TAG
docker image prune -f
docker images
tar xf linux-oryx-en.tar.gz
bash oryx/scripts/setup-ubuntu/install.sh
# Setup journald to write logs.
sed -i 's/#Storage=auto/Storage=volatile/g' /etc/systemd/journald.conf
systemctl restart systemd-journald
- name: Run All tests
env:
SRS_TAG: ${{ env.SRS_TAG }}
SRS_DOMAIN: ${{ env.SRS_DOMAIN }}
uses: appleboy/ssh-action@master
with:
host: ${{ env.SRS_DROPLET_EIP }}
username: root
key: ${{ secrets.DIGITALOCEAN_SSHKEY }}
port: 22
envs: SRS_TAG,SRS_DOMAIN
timeout: 7200s
command_timeout: 7200s
script: |
# We will handle the error by ourselves.
set +e
# Record all logs.
journalctl -u oryx -f >srs.log 2>&1 & pid_srs=$!
journalctl -u nginx -f >nginx.log 2>&1 & pid_nginx=$!
# Restart the service, might fail because journald restarted.
systemctl restart oryx nginx
systemctl status oryx nginx
echo "Wait for service ready." &&
bash secret.sh >./test/.env &&
./test/oryx.test -test.timeout=1h -test.v -endpoint http://$SRS_DOMAIN.ossrs.io \
-srs-log=true -wait-ready=true -init-password=true -check-api-secret=true -init-self-signed-cert=true \
-test.run TestSystem_Empty -no-bilibili-test=true &&
echo "Make upload writable." &&
sudo chmod 777 /data/upload &&
echo "Test HTTP API with self-signed cert." &&
bash secret.sh >./test/.env &&
./test/oryx.test -test.timeout=1h -test.v -wait-ready -endpoint http://$SRS_DOMAIN.ossrs.io \
-srs-log=true -wait-ready=true -init-password=false -check-api-secret=true -no-media-test \
-no-bilibili-test=true &&
echo "Test HTTPS API with self-signed cert." &&
bash secret.sh >./test/.env &&
./test/oryx.test -test.timeout=1h -test.v -wait-ready -endpoint https://$SRS_DOMAIN.ossrs.io \
-srs-log=true -wait-ready=true -init-password=false -check-api-secret=true -no-media-test \
-no-bilibili-test=true &&
echo "Request CERT from letsencrypt." &&
bash secret.sh >./test/.env &&
./test/oryx.test -test.timeout=1h -test.v -endpoint http://$SRS_DOMAIN.ossrs.io \
-srs-log=true -wait-ready=true -init-password=false -check-api-secret=true -domain-lets-encrypt=$SRS_DOMAIN.ossrs.io \
-test.run TestApi_LetsEncryptUpdateCert -no-media-test \
-no-bilibili-test=true &&
echo "Test HTTPS API with letsencrypt cert." &&
bash secret.sh >./test/.env &&
./test/oryx.test -test.timeout=1h -test.v -wait-ready -endpoint https://$SRS_DOMAIN.ossrs.io \
-srs-log=true -wait-ready=true -init-password=false -check-api-secret=true -https-insecure-verify \
-no-media-test -no-bilibili-test=true &&
echo "Run media test with retry" &&
bash secret.sh >./test/.env &&
./failed-retry.sh 5 ./test/oryx.test -test.timeout=1h -test.v -wait-ready -endpoint http://$SRS_DOMAIN.ossrs.io \
-srs-log=true -wait-ready=true -init-password=false -check-api-secret=true -test.run WithStream \
-no-bilibili-test=true
ret=$?; echo "Test result: $ret"
echo "Stop service"
sudo systemctl stop oryx
kill $pid_srs 2>/dev/null
kill $pid_nginx 2>/dev/null
echo "Log of srs.log" && cat srs.log
echo "Log of nginx.log" && cat nginx.log
exit $ret
- name: Write signal file
uses: appleboy/ssh-action@master
with:
host: ${{ env.SRS_DROPLET_EIP }}
username: root
key: ${{ secrets.DIGITALOCEAN_SSHKEY }}
port: 22
timeout: 600s
script: |
touch ctrl-test-done
# Map a step output to a job output, see https://docs.github.com/en/actions/using-jobs/defining-outputs-for-jobs
outputs:
SRS_DROPLET_EIP: ${{ env.SRS_DROPLET_EIP }}
runs-on: ubuntu-20.04
dispose-waiting:
name: Dispose Waiting
if: always()
needs:
- envs
- run-test
steps:
- name: Covert output to env
run: |
echo "SRS_DOMAIN=${{ needs.envs.outputs.SRS_DOMAIN }}" >> $GITHUB_ENV
echo "SRS_DROPLET_EIP=${{ needs.run-test.outputs.SRS_DROPLET_EIP }}" >> $GITHUB_ENV
- name: Tips for Debugging
run: |
# We will handle the error by ourselves.
set +e
echo "Please use the following command to login the server:"
echo " ssh root@$SRS_DROPLET_EIP"
echo "Or check by web console:"
echo " http://$SRS_DOMAIN.ossrs.io"
echo "To terminate immediately:"
echo " ssh root@$SRS_DROPLET_EIP touch ctrl-abort"
echo "To reset the timer:"
echo " ssh root@$SRS_DROPLET_EIP touch ctrl-reset"
echo "To always wait for debugging:"
echo " ssh root@$SRS_DROPLET_EIP touch ctrl-debugging"
echo "Never dispose:"
echo " for((;;)); do ssh root@$SRS_DROPLET_EIP touch ctrl-debugging ctrl-reset; sleep 3; done"
if [[ -f test/.env ]]; then
echo "Environment variables:"
cat test/.env
fi
- name: Waiting for error debugging
uses: appleboy/ssh-action@master
with:
host: ${{ env.SRS_DROPLET_EIP }}
username: root
key: ${{ secrets.DIGITALOCEAN_SSHKEY }}
port: 22
timeout: 3600s
command_timeout: 3600s
script: |
# We will handle the error by ourselves.
set +e
if [[ -f ctrl-test-done && ! -f ctrl-debugging ]]; then
echo "Test done normally."
else
echo "Start service for debugging"
sudo systemctl start oryx
echo "Dispose in 60s..."
for ((i=60; i>0; i--)); do
echo "Dispose in ${i}s..."; sleep 3
if [[ -f ctrl-abort ]]; then echo "Abort by user."; break; fi
if [[ -f ctrl-reset ]]; then echo "Reset by user."; rm -f ctrl-reset; let i=i+600; fi
done
fi
- run: echo OK
# Map a step output to a job output, see https://docs.github.com/en/actions/using-jobs/defining-outputs-for-jobs
outputs:
SRS_DROPLET_EIP: ${{ env.SRS_DROPLET_EIP }}
runs-on: ubuntu-20.04
dispose-final:
name: Dispose Final
if: always()
needs:
- envs
- dispose-waiting
steps:
- name: Covert output to env
run: |
echo "SRS_DOMAIN=${{ needs.envs.outputs.SRS_DOMAIN }}" >> $GITHUB_ENV
echo "SRS_DROPLET_EIP=${{ needs.dispose-waiting.outputs.SRS_DROPLET_EIP }}" >> $GITHUB_ENV
- name: Install doctl
uses: digitalocean/action-doctl@v2
with:
token: ${{ secrets.DIGITALOCEAN_ACCESS_TOKEN }}
- name: Remove temporary VM
run: |
# We will handle the error by ourselves.
set +e
if [[ ! -z $SRS_DOMAIN ]]; then
echo "Remove machine $SRS_DOMAIN" &&
doctl compute droplet delete $SRS_DOMAIN -f
fi
- name: Remove temporary domain
run: |
# We will handle the error by ourselves.
set +e
DOMAIN_ID=$(doctl compute domain records ls ossrs.io --no-header |grep lego |grep $SRS_DOMAIN |awk '{print $1}')
if [[ ! -z $DOMAIN_ID ]]; then
echo "Remove $DOMAIN_ID" &&
doctl compute domain records delete ossrs.io $DOMAIN_ID -f
fi
- run: echo OK
runs-on: ubuntu-20.04
# Final test result, fail if any jobs failed.
test-online-final:
name: test-online-final
needs:
- envs
- run-test
- dispose-final
steps:
- run: echo OK
runs-on: ubuntu-20.04