Skip to content

Commit

Permalink
Support test install script.
Browse files Browse the repository at this point in the history
  • Loading branch information
winlinvip committed Jul 29, 2023
1 parent 1b8aa76 commit c513663
Show file tree
Hide file tree
Showing 2 changed files with 65 additions and 6 deletions.
69 changes: 63 additions & 6 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,30 +5,87 @@ on:
branches: [main]

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/setup-ubuntu/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
# 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:
name: Test for commits
runs-on: ubuntu-20.04

steps:
- name: Checkout repository
uses: actions/checkout@v3

# See https://github.com/actions/setup-node
- name: Setup the npm node
uses: actions/setup-node@v2
with:
node-version: '18'
cache: 'npm'
cache-dependency-path: |
ui/package-lock.json
# See https://github.com/actions/setup-go
- name: Setup the Go
uses: actions/setup-go@v3
with:
go-version: '>=1.16.0'

- name: Test by jest and Go
run: |
make -j && make test -j
install-script:
name: Test for install by script
runs-on: ubuntu-20.04
needs:
- envs
steps:
- name: Covert output to env
run: |
echo "SRS_TAG=${{ needs.envs.outputs.SRS_TAG }}" >> $GITHUB_ENV
echo "SRS_MAJOR=${{ needs.envs.outputs.SRS_MAJOR }}" >> $GITHUB_ENV
- name: Checkout repository
uses: actions/checkout@v3
- name: Build image for platform
run: |
docker build -t platform:latest -f Dockerfile . &&
docker tag platform:latest ossrs/srs-cloud:$SRS_TAG &&
docker tag platform:latest registry.cn-hangzhou.aliyuncs.com/ossrs/srs-cloud:$SRS_TAG &&
docker images
- name: Test build install package
run: |
bash scripts/setup-ubuntu/build.sh --language zh --version $SRS_TAG \
--output build --extract
du -sh build/*
- name: Test install package
run: |
sudo bash build/srs-cloud/scripts/setup-ubuntu/install.sh --verbose &&
du -sh /usr/local/srs-cloud/*
- name: Check installed package
run: |
systemctl status srs-cloud
final:
name: Final
runs-on: ubuntu-20.04
needs:
- test
- install-script
steps:
- run: echo OK
2 changes: 2 additions & 0 deletions scripts/setup-ubuntu/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,8 @@ if [[ "$HELP" == yes ]]; then
echo " --extract Whether to extract the final install file. Default: ${EXTRACT}"
exit 0
fi

OUTPUT=$(cd ${WORK_DIR} && mkdir -p ${OUTPUT} && cd ${OUTPUT} && pwd)
echo "Install with options: LANGUAGE=${LANGUAGE}, VERSION=${VERSION}, EXTRACT=${EXTRACT}, OUTPUT=${OUTPUT}"

TMP_DIR="/tmp/srs-cloud-$(date +%s)" && TARGET_DIR="${TMP_DIR}/srs-cloud" &&
Expand Down

0 comments on commit c513663

Please sign in to comment.