1
0
Fork 0
mirror of https://github.com/ossrs/srs.git synced 2025-02-13 20:01:56 +00:00
srs/.github/workflows/test.yml

242 lines
8.6 KiB
YAML
Raw Normal View History

2021-08-15 11:01:55 +00:00
name: "Test"
# @see https://docs.github.com/en/actions/reference/workflow-syntax-for-github-actions#onpushpull_requestbranchestags
on: [push, pull_request]
jobs:
2022-08-13 00:18:06 +00:00
build-centos7:
2022-08-13 02:27:14 +00:00
name: build-centos7
2021-08-15 11:01:55 +00:00
runs-on: ubuntu-20.04
2022-08-13 02:27:14 +00:00
needs:
- utest
2021-08-15 11:01:55 +00:00
steps:
- name: Checkout repository
uses: actions/checkout@v2
# Build for CentOS 7
2021-08-15 11:01:55 +00:00
- name: Build on CentOS7, baseline
run: DOCKER_BUILDKIT=1 docker build -f trunk/Dockerfile.builds --target centos7-baseline .
2021-08-15 11:01:55 +00:00
- name: Build on CentOS7, with SRT
run: DOCKER_BUILDKIT=1 docker build -f trunk/Dockerfile.builds --target centos7-srt .
2021-08-15 11:01:55 +00:00
- name: Build on CentOS7, without WebRTC
run: DOCKER_BUILDKIT=1 docker build -f trunk/Dockerfile.builds --target centos7-no-webrtc .
2021-08-15 11:01:55 +00:00
- name: Build on CentOS7, without ASM
run: DOCKER_BUILDKIT=1 docker build -f trunk/Dockerfile.builds --target centos7-no-asm .
2021-08-15 11:01:55 +00:00
- name: Build on CentOS7, C++98, no FFmpeg
run: DOCKER_BUILDKIT=1 docker build -f trunk/Dockerfile.builds --target centos7-ansi-no-ffmpeg .
2022-08-13 00:18:06 +00:00
build-centos6:
2022-08-13 02:27:14 +00:00
name: build-centos6
2022-08-13 00:18:06 +00:00
runs-on: ubuntu-20.04
2022-08-13 02:27:14 +00:00
needs:
- utest
2022-08-13 00:18:06 +00:00
steps:
- name: Checkout repository
uses: actions/checkout@v2
# Build for CentOS 6
- name: Build on CentOS6, baseline
run: DOCKER_BUILDKIT=1 docker build -f trunk/Dockerfile.builds --target centos6-baseline .
- name: Build on CentOS6, with SRT
run: DOCKER_BUILDKIT=1 docker build -f trunk/Dockerfile.builds --target centos6-srt .
2022-08-13 00:18:06 +00:00
build-ubuntu16:
2022-08-13 02:27:14 +00:00
name: build-ubuntu16
2021-08-15 11:01:55 +00:00
runs-on: ubuntu-20.04
2022-08-13 02:27:14 +00:00
needs:
- utest
2021-08-15 11:01:55 +00:00
steps:
- name: Checkout repository
uses: actions/checkout@v2
# Build for Ubuntu16
- name: Build on Ubuntu16, baseline
run: DOCKER_BUILDKIT=1 docker build -f trunk/Dockerfile.builds --target ubuntu16-baseline .
2021-08-15 11:01:55 +00:00
- name: Build on Ubuntu16, with SRT
run: DOCKER_BUILDKIT=1 docker build -f trunk/Dockerfile.builds --target ubuntu16-srt .
2022-08-13 00:18:06 +00:00
build-ubuntu18:
2022-08-13 02:27:14 +00:00
name: build-ubuntu18
2022-08-13 00:18:06 +00:00
runs-on: ubuntu-20.04
2022-08-13 02:27:14 +00:00
needs:
- utest
2022-08-13 00:18:06 +00:00
steps:
- name: Checkout repository
uses: actions/checkout@v2
2021-08-15 11:01:55 +00:00
# Build for Ubuntu18
- name: Build on Ubuntu18, baseline
run: DOCKER_BUILDKIT=1 docker build -f trunk/Dockerfile.builds --target ubuntu18-baseline .
2021-08-15 11:01:55 +00:00
- name: Build on Ubuntu18, with SRT
run: DOCKER_BUILDKIT=1 docker build -f trunk/Dockerfile.builds --target ubuntu18-srt .
2022-08-13 00:18:06 +00:00
build-ubuntu20:
2022-08-13 02:27:14 +00:00
name: build-ubuntu20
2022-08-13 00:18:06 +00:00
runs-on: ubuntu-20.04
2022-08-13 02:27:14 +00:00
needs:
- utest
2022-08-13 00:18:06 +00:00
steps:
- name: Checkout repository
uses: actions/checkout@v2
2021-08-15 11:01:55 +00:00
# Build for Ubuntu20
- name: Build on Ubuntu20, baseline
run: DOCKER_BUILDKIT=1 docker build -f trunk/Dockerfile.builds --target ubuntu20-baseline .
2021-08-15 11:01:55 +00:00
- name: Build on Ubuntu20, with SRT
run: DOCKER_BUILDKIT=1 docker build -f trunk/Dockerfile.builds --target ubuntu20-srt .
2021-08-15 11:01:55 +00:00
2022-08-13 02:27:14 +00:00
build-cross-arm:
name: build-cross-arm
2021-08-15 11:01:55 +00:00
runs-on: ubuntu-20.04
2022-08-13 02:27:14 +00:00
needs:
- utest
2021-08-15 11:01:55 +00:00
steps:
- name: Checkout repository
uses: actions/checkout@v2
2022-08-12 12:12:13 +00:00
- name: Cross Build for ARMv7 on Ubuntu16
run: DOCKER_BUILDKIT=1 docker build -f trunk/Dockerfile.builds --target ubuntu16-cross-armv7 .
2022-08-12 12:12:13 +00:00
- name: Cross Build for ARMv7 on Ubuntu20
run: DOCKER_BUILDKIT=1 docker build -f trunk/Dockerfile.builds --target ubuntu20-cross-armv7 .
2022-08-13 02:27:14 +00:00
build-cross-aarch64:
name: build-cross-aarch64
runs-on: ubuntu-20.04
needs:
- utest
2022-08-13 02:27:14 +00:00
steps:
- name: Checkout repository
uses: actions/checkout@v2
2022-08-12 12:12:13 +00:00
- name: Cross Build for AARCH64 on Ubuntu16
run: DOCKER_BUILDKIT=1 docker build -f trunk/Dockerfile.builds --target ubuntu16-cross-aarch64 .
2022-08-12 12:12:13 +00:00
- name: Cross Build for AARCH64 on Ubuntu20
run: DOCKER_BUILDKIT=1 docker build -f trunk/Dockerfile.builds --target ubuntu20-cross-aarch64 .
2021-08-15 11:01:55 +00:00
build:
2022-08-13 02:27:14 +00:00
name: build
2021-08-15 11:01:55 +00:00
needs:
2022-08-13 00:18:06 +00:00
- build-centos7
- build-centos6
- build-ubuntu16
- build-ubuntu18
- build-ubuntu20
2022-08-13 02:27:14 +00:00
- build-cross-arm
- build-cross-aarch64
2021-08-15 11:01:55 +00:00
runs-on: ubuntu-20.04
steps:
- run: echo 'Build done'
utest:
2022-08-13 02:27:14 +00:00
name: utest
2021-08-15 11:01:55 +00:00
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
2021-12-02 12:15:28 +00:00
run: docker run --rm srs:test bash -c 'make utest && ./objs/srs_utest'
2021-08-15 11:01:55 +00:00
# For regression-test
- name: Run SRS regression-test
run: docker run --rm srs:test bash -c 'make && ./objs/srs -c conf/regression-test.conf && cd 3rdparty/srs-bench && make && ./objs/srs_test -test.v'
coverage:
2022-08-13 02:27:14 +00:00
name: coverage
2021-08-15 11:01:55 +00:00
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/') }}
2022-07-02 06:04:26 +00:00
env:
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
2021-08-15 11:01:55 +00:00
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/develop
2021-08-15 11:01:55 +00:00
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}')
2022-07-02 06:21:12 +00:00
#
echo "For github.ref=${{ github.ref }}, github.sha=${{ github.sha }}"
echo "SRS_BRANCH=$SRS_BRANCH, SRS_PR=$SRS_PR, SRS_SHA=$SRS_SHA, SRS_PROJECT=$SRS_PROJECT"
2022-07-02 06:04:26 +00:00
docker run --rm --env CODECOV_TOKEN=$CODECOV_TOKEN \
--env SRS_BRANCH=$SRS_BRANCH --env SRS_PR=$SRS_PR --env SRS_SHA=$SRS_SHA --env SRS_PROJECT=$SRS_PROJECT \
2021-12-02 12:15:28 +00:00
srs:cov bash -c 'make utest && ./objs/srs_utest && bash auto/codecov.sh'
2022-08-13 00:18:06 +00:00
#
2021-08-15 11:01:55 +00:00
2022-08-13 00:18:06 +00:00
multile-arch-armv7:
2022-08-13 02:27:14 +00:00
name: multile-arch-armv7
runs-on: ubuntu-20.04
steps:
- name: Checkout repository
uses: actions/checkout@v2
2022-08-13 00:18:06 +00:00
# See https://github.com/crazy-max/ghaction-docker-buildx#moved-to-docker-organization
# https://github.com/docker/setup-qemu-action
- name: Set up QEMU
uses: docker/setup-qemu-action@v1
# https://github.com/docker/setup-buildx-action
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v1
- name: Build multiple archs image
run: |
docker buildx build --platform linux/arm/v7 \
--output "type=image,push=false" \
--build-arg IMAGE=ossrs/srs:ubuntu20-cache \
-f trunk/Dockerfile .
2022-08-13 00:18:06 +00:00
multile-arch-aarch64:
2022-08-13 02:27:14 +00:00
name: multile-arch-aarch64
2022-08-13 00:18:06 +00:00
runs-on: ubuntu-20.04
steps:
- name: Checkout repository
uses: actions/checkout@v2
# See https://github.com/crazy-max/ghaction-docker-buildx#moved-to-docker-organization
# https://github.com/docker/setup-qemu-action
- name: Set up QEMU
uses: docker/setup-qemu-action@v1
# https://github.com/docker/setup-buildx-action
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v1
2022-08-13 00:18:06 +00:00
- name: Build multiple archs image
run: |
docker buildx build --platform linux/arm64/v8 \
--output "type=image,push=false" \
--build-arg IMAGE=ossrs/srs:ubuntu20-cache \
-f trunk/Dockerfile .
2022-08-13 00:18:06 +00:00
multile-arch-amd64:
2022-08-13 02:27:14 +00:00
name: multile-arch-amd64
2022-08-13 00:18:06 +00:00
runs-on: ubuntu-20.04
steps:
- name: Checkout repository
uses: actions/checkout@v2
# See https://github.com/crazy-max/ghaction-docker-buildx#moved-to-docker-organization
# https://github.com/docker/setup-qemu-action
- name: Set up QEMU
uses: docker/setup-qemu-action@v1
# https://github.com/docker/setup-buildx-action
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v1
- name: Build multiple archs image
run: |
2022-08-13 00:18:06 +00:00
docker buildx build --platform linux/amd64 \
--output "type=image,push=false" \
2022-06-17 06:18:27 +00:00
--build-arg IMAGE=ossrs/srs:ubuntu20-cache \
-f trunk/Dockerfile .
2021-08-15 11:01:55 +00:00
done:
2022-08-13 02:27:14 +00:00
name: done
2021-08-15 11:01:55 +00:00
needs:
- build
- coverage
- multile-arch-armv7
- multile-arch-aarch64
- multile-arch-amd64
2021-08-15 11:01:55 +00:00
runs-on: ubuntu-20.04
steps:
2022-08-13 00:18:06 +00:00
- run: echo 'All done'