1234567891011121314151617181920212223242526272829303132333435363738394041424344454647 |
- name: "Test"
- on: [push, pull_request]
- jobs:
- utest:
- name: actions-test-utest
- runs-on: ubuntu-20.04
- steps:
- - name: Checkout repository
- uses: actions/checkout@v2
- ################################################################
- # Tests
- - name: Build test image
- run: docker build --tag srs:test -f trunk/Dockerfile.test .
- # For utest
- - name: Run SRS utest
- run: docker run --rm srs:test bash -c 'make && ./objs/srs_utest'
- coverage:
- name: actions-test-coverage
- runs-on: ubuntu-20.04
- steps:
- - name: Checkout repository
- uses: actions/checkout@v2
- ################################################################
- # Tests
- - name: Build coverage image
- run: docker build --tag srs:cov -f trunk/Dockerfile.cov .
- # For coverage
- - name: Run SRS covergae
- if: ${{ startsWith(github.ref, 'refs/heads/') || startsWith(github.ref, 'refs/pull/') }}
- 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/3.0release
- 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 ref=${{ github.ref }}, sha=${{ github.sha }}, SRS_BRANCH=$SRS_BRANCH, SRS_PR=$SRS_PR, SRS_SHA=$SRS_SHA, SRS_PROJECT=$SRS_PROJECT"
- docker run --rm --env SRS_BRANCH=$SRS_BRANCH --env SRS_PR=$SRS_PR --env SRS_SHA=$SRS_SHA --env SRS_PROJECT=$SRS_PROJECT \
- srs:cov bash -c 'make && ./objs/srs_utest && bash auto/coverage.sh'
|