mirror of
https://github.com/ossrs/srs.git
synced 2025-03-09 15:49:59 +00:00
Actions: Support push and pullrequest
This commit is contained in:
parent
a2df2a2402
commit
140d180d08
10 changed files with 267 additions and 37 deletions
13
.github/workflows/codeql-analysis.yml
vendored
13
.github/workflows/codeql-analysis.yml
vendored
|
@ -1,18 +1,11 @@
|
||||||
name: "CodeQL"
|
name: "CodeQL"
|
||||||
|
|
||||||
on:
|
# @see https://docs.github.com/en/actions/reference/workflow-syntax-for-github-actions#onpushpull_requestbranchestags
|
||||||
push:
|
on: [push, pull_request]
|
||||||
branches: [ 4.0release, develop ]
|
|
||||||
pull_request:
|
|
||||||
# The branches below must be a subset of the branches above
|
|
||||||
branches: [ 4.0release, develop ]
|
|
||||||
schedule:
|
|
||||||
# '20 19 * * 6' means 'At 19:20, only on Saturday' @see https://crontab.cronhub.io/
|
|
||||||
- cron: '20 19 * * 6'
|
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
analyze:
|
analyze:
|
||||||
name: codeql-analyze
|
name: actions-codeql-analyze
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
|
|
||||||
strategy:
|
strategy:
|
||||||
|
|
1
.github/workflows/release.yml
vendored
1
.github/workflows/release.yml
vendored
|
@ -1,5 +1,6 @@
|
||||||
name: "Release"
|
name: "Release"
|
||||||
|
|
||||||
|
# @see https://docs.github.com/en/actions/reference/workflow-syntax-for-github-actions#onpushpull_requestbranchestags
|
||||||
on:
|
on:
|
||||||
push:
|
push:
|
||||||
tags:
|
tags:
|
||||||
|
|
153
.github/workflows/test.yml
vendored
Normal file
153
.github/workflows/test.yml
vendored
Normal file
|
@ -0,0 +1,153 @@
|
||||||
|
name: "Test"
|
||||||
|
|
||||||
|
# @see https://docs.github.com/en/actions/reference/workflow-syntax-for-github-actions#onpushpull_requestbranchestags
|
||||||
|
on: [push, pull_request]
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
build-centos:
|
||||||
|
name: actions-test-build-centos
|
||||||
|
runs-on: ubuntu-20.04
|
||||||
|
|
||||||
|
steps:
|
||||||
|
- name: Checkout repository
|
||||||
|
uses: actions/checkout@v2
|
||||||
|
|
||||||
|
# Build for CentOS7
|
||||||
|
- name: Build on CentOS7, baseline
|
||||||
|
run: docker build -f trunk/Dockerfile.builds --target centos7-baseline .
|
||||||
|
- name: Build on CentOS7, with SRT
|
||||||
|
run: docker build -f trunk/Dockerfile.builds --target centos7-srt .
|
||||||
|
- name: Build on CentOS7, without WebRTC
|
||||||
|
run: docker build -f trunk/Dockerfile.builds --target centos7-no-webrtc .
|
||||||
|
- name: Build on CentOS7, without ASM
|
||||||
|
run: docker build -f trunk/Dockerfile.builds --target centos7-no-asm .
|
||||||
|
- name: Build on CentOS7, C++98, no FFmpeg
|
||||||
|
run: docker build -f trunk/Dockerfile.builds --target centos7-ansi-no-ffmpeg .
|
||||||
|
# Build for CentOS8
|
||||||
|
- name: Build on CentOS8, baseline
|
||||||
|
run: docker build -f trunk/Dockerfile.builds --target centos8-baseline .
|
||||||
|
- name: Build on CentOS8, with SRT
|
||||||
|
run: docker build -f trunk/Dockerfile.builds --target centos8-srt .
|
||||||
|
|
||||||
|
build-ubuntu:
|
||||||
|
name: actions-test-build-ubuntu
|
||||||
|
runs-on: ubuntu-20.04
|
||||||
|
|
||||||
|
steps:
|
||||||
|
- name: Checkout repository
|
||||||
|
uses: actions/checkout@v2
|
||||||
|
|
||||||
|
# Build for Ubuntu16
|
||||||
|
- name: Build on Ubuntu16, baseline
|
||||||
|
run: docker build -f trunk/Dockerfile.builds --target ubuntu16-baseline .
|
||||||
|
- name: Build on Ubuntu16, with SRT
|
||||||
|
run: docker build -f trunk/Dockerfile.builds --target ubuntu16-srt .
|
||||||
|
# Build for Ubuntu18
|
||||||
|
- name: Build on Ubuntu18, baseline
|
||||||
|
run: docker build -f trunk/Dockerfile.builds --target ubuntu18-baseline .
|
||||||
|
- name: Build on Ubuntu18, with SRT
|
||||||
|
run: docker build -f trunk/Dockerfile.builds --target ubuntu18-srt .
|
||||||
|
# Build for Ubuntu20
|
||||||
|
- name: Build on Ubuntu20, baseline
|
||||||
|
run: docker build -f trunk/Dockerfile.builds --target ubuntu20-baseline .
|
||||||
|
- name: Build on Ubuntu20, with SRT
|
||||||
|
run: docker build -f trunk/Dockerfile.builds --target ubuntu20-srt .
|
||||||
|
|
||||||
|
build-arm:
|
||||||
|
name: actions-test-build-arm
|
||||||
|
runs-on: ubuntu-20.04
|
||||||
|
|
||||||
|
steps:
|
||||||
|
- name: Checkout repository
|
||||||
|
uses: actions/checkout@v2
|
||||||
|
|
||||||
|
# Build for AARCH64
|
||||||
|
- name: Build for AARCH64, baseline
|
||||||
|
run: docker build -f trunk/Dockerfile.builds --target aarch64-baseline .
|
||||||
|
- name: Build for AARCH64, with SRT
|
||||||
|
run: docker build -f trunk/Dockerfile.builds --target aarch64-srt .
|
||||||
|
|
||||||
|
build-cross:
|
||||||
|
name: actions-test-build-cross
|
||||||
|
runs-on: ubuntu-20.04
|
||||||
|
|
||||||
|
steps:
|
||||||
|
- name: Checkout repository
|
||||||
|
uses: actions/checkout@v2
|
||||||
|
|
||||||
|
# Cross Build for ARMv7
|
||||||
|
- name: Cross Build for ARMv7
|
||||||
|
run: docker build -f trunk/Dockerfile.builds --target ubuntu16-cross-armv7 .
|
||||||
|
# Cross Build for AARCH64
|
||||||
|
- name: Cross Build for AARCH64
|
||||||
|
run: docker build -f trunk/Dockerfile.builds --target ubuntu16-cross-aarch64 .
|
||||||
|
|
||||||
|
build:
|
||||||
|
name: actions-test-build
|
||||||
|
needs:
|
||||||
|
- build-centos
|
||||||
|
- build-ubuntu
|
||||||
|
- build-arm
|
||||||
|
- build-cross
|
||||||
|
runs-on: ubuntu-20.04
|
||||||
|
|
||||||
|
steps:
|
||||||
|
- run: echo 'Build done'
|
||||||
|
|
||||||
|
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'
|
||||||
|
# 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:
|
||||||
|
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/4.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/codecov.sh'
|
||||||
|
|
||||||
|
done:
|
||||||
|
name: actions-test-done
|
||||||
|
needs:
|
||||||
|
- build
|
||||||
|
- utest
|
||||||
|
- coverage
|
||||||
|
runs-on: ubuntu-20.04
|
||||||
|
|
||||||
|
steps:
|
||||||
|
- run: echo 'All done'
|
|
@ -3,7 +3,7 @@
|
||||||

|

|
||||||
[](https://github.com/ossrs/srs/actions?query=workflow%3ACodeQL+branch%3A4.0release)
|
[](https://github.com/ossrs/srs/actions?query=workflow%3ACodeQL+branch%3A4.0release)
|
||||||
[](https://github.com/ossrs/srs/actions/workflows/release.yml?query=workflow%3ARelease)
|
[](https://github.com/ossrs/srs/actions/workflows/release.yml?query=workflow%3ARelease)
|
||||||
[](https://circleci.com/gh/ossrs/srs/tree/4.0release)
|
[](https://github.com/ossrs/srs/actions?query=workflow%3ATest+branch%3A4.0release)
|
||||||
[](https://codecov.io/gh/ossrs/srs/branch/4.0release)
|
[](https://codecov.io/gh/ossrs/srs/branch/4.0release)
|
||||||
[](../../wikis/Contact#wechat)
|
[](../../wikis/Contact#wechat)
|
||||||
[](http://bbs.ossrs.net)
|
[](http://bbs.ossrs.net)
|
||||||
|
|
1
trunk/.gitignore
vendored
1
trunk/.gitignore
vendored
|
@ -38,6 +38,7 @@
|
||||||
./srs
|
./srs
|
||||||
*.dSYM/
|
*.dSYM/
|
||||||
*.gcov
|
*.gcov
|
||||||
|
*.gcno
|
||||||
*.ts
|
*.ts
|
||||||
*.h264
|
*.h264
|
||||||
*.264
|
*.264
|
||||||
|
|
|
@ -4,8 +4,8 @@ FROM ossrs/srs:dev AS build
|
||||||
RUN yum install -y gcc make gcc-c++ patch unzip perl git
|
RUN yum install -y gcc make gcc-c++ patch unzip perl git
|
||||||
|
|
||||||
# Build and install SRS.
|
# Build and install SRS.
|
||||||
COPY . /trunk
|
COPY . /srs
|
||||||
WORKDIR /trunk
|
WORKDIR /srs/trunk
|
||||||
RUN ./configure --srt=on --jobs=2 && make -j2 && make install
|
RUN ./configure --srt=on --jobs=2 && make -j2 && make install
|
||||||
|
|
||||||
# All config files for SRS.
|
# All config files for SRS.
|
||||||
|
|
76
trunk/Dockerfile.builds
Normal file
76
trunk/Dockerfile.builds
Normal file
|
@ -0,0 +1,76 @@
|
||||||
|
########################################################
|
||||||
|
FROM ossrs/srs:dev AS centos7-baseline
|
||||||
|
COPY . /srs
|
||||||
|
RUN cd /srs/trunk && ./configure --jobs=2 && make -j2
|
||||||
|
|
||||||
|
FROM ossrs/srs:dev AS centos7-no-webrtc
|
||||||
|
COPY . /srs
|
||||||
|
RUN cd /srs/trunk && ./configure --jobs=2 --rtc=off && make -j2
|
||||||
|
|
||||||
|
FROM ossrs/srs:dev AS centos7-no-asm
|
||||||
|
COPY . /srs
|
||||||
|
RUN cd /srs/trunk && ./configure --jobs=2 --nasm=off --srtp-nasm=off && make -j2
|
||||||
|
|
||||||
|
FROM ossrs/srs:dev AS centos7-srt
|
||||||
|
COPY . /srs
|
||||||
|
RUN cd /srs/trunk && ./configure --jobs=2 --srt=on && make -j2
|
||||||
|
|
||||||
|
FROM ossrs/srs:dev AS centos7-ansi-no-ffmpeg
|
||||||
|
COPY . /srs
|
||||||
|
RUN cd /srs/trunk && ./configure --jobs=2 --cxx11=off --cxx14=off --ffmpeg-fit=off && make -j2
|
||||||
|
|
||||||
|
########################################################
|
||||||
|
FROM ossrs/srs:dev8 AS centos8-baseline
|
||||||
|
COPY . /srs
|
||||||
|
RUN cd /srs/trunk && ./configure --jobs=2 && make -j2
|
||||||
|
|
||||||
|
FROM ossrs/srs:dev8 AS centos8-srt
|
||||||
|
COPY . /srs
|
||||||
|
RUN cd /srs/trunk && ./configure --jobs=2 --srt=on && make -j2
|
||||||
|
|
||||||
|
########################################################
|
||||||
|
FROM ossrs/srs:ubuntu16 AS ubuntu16-baseline
|
||||||
|
COPY . /srs
|
||||||
|
RUN cd /srs/trunk && ./configure --jobs=2 && make -j2
|
||||||
|
|
||||||
|
FROM ossrs/srs:ubuntu16 AS ubuntu16-srt
|
||||||
|
COPY . /srs
|
||||||
|
RUN cd /srs/trunk && ./configure --jobs=2 --srt=on && make -j2
|
||||||
|
|
||||||
|
########################################################
|
||||||
|
FROM ossrs/srs:ubuntu18 AS ubuntu18-baseline
|
||||||
|
COPY . /srs
|
||||||
|
RUN cd /srs/trunk && ./configure --jobs=2 && make -j2
|
||||||
|
|
||||||
|
FROM ossrs/srs:ubuntu18 AS ubuntu18-srt
|
||||||
|
COPY . /srs
|
||||||
|
RUN cd /srs/trunk && ./configure --jobs=2 --srt=on && make -j2
|
||||||
|
|
||||||
|
########################################################
|
||||||
|
FROM ossrs/srs:ubuntu20 AS ubuntu20-baseline
|
||||||
|
COPY . /srs
|
||||||
|
RUN cd /srs/trunk && ./configure --jobs=2 && make -j2
|
||||||
|
|
||||||
|
FROM ossrs/srs:ubuntu20 AS ubuntu20-srt
|
||||||
|
COPY . /srs
|
||||||
|
RUN cd /srs/trunk && ./configure --jobs=2 --srt=on && make -j2
|
||||||
|
|
||||||
|
########################################################
|
||||||
|
FROM ossrs/srs:aarch64 AS aarch64-baseline
|
||||||
|
COPY . /srs
|
||||||
|
RUN cd /srs/trunk && ./configure --jobs=2 && make -j2
|
||||||
|
|
||||||
|
FROM ossrs/srs:aarch64 AS aarch64-srt
|
||||||
|
COPY . /srs
|
||||||
|
RUN cd /srs/trunk && ./configure --jobs=2 --srt=on && make -j2
|
||||||
|
|
||||||
|
########################################################
|
||||||
|
FROM ossrs/srs:ubuntu16 AS ubuntu16-cross-armv7
|
||||||
|
COPY . /srs
|
||||||
|
RUN cd /srs/trunk && ./configure --jobs=2 --cross-build --cc=arm-linux-gnueabihf-gcc --cxx=arm-linux-gnueabihf-g++ \
|
||||||
|
--ar=arm-linux-gnueabihf-ar --ld=arm-linux-gnueabihf-ld --randlib=arm-linux-gnueabihf-randlib && make -j2
|
||||||
|
|
||||||
|
FROM ossrs/srs:ubuntu16 AS ubuntu16-cross-aarch64
|
||||||
|
COPY . /srs
|
||||||
|
RUN cd /srs/trunk && ./configure --jobs=2 --cross-build --cc=aarch64-linux-gnu-gcc --cxx=aarch64-linux-gnu-g++ \
|
||||||
|
--ar=aarch64-linux-gnu-ar --ld=aarch64-linux-gnu-ld --randlib=aarch64-linux-gnu-randlib && make -j2
|
9
trunk/Dockerfile.cov
Normal file
9
trunk/Dockerfile.cov
Normal file
|
@ -0,0 +1,9 @@
|
||||||
|
FROM ossrs/srs:dev
|
||||||
|
|
||||||
|
# Install depends tools.
|
||||||
|
RUN yum install -y gcc make gcc-c++ patch unzip perl git
|
||||||
|
|
||||||
|
# Build and install SRS.
|
||||||
|
COPY . /srs
|
||||||
|
WORKDIR /srs/trunk
|
||||||
|
RUN ./configure --with-utest --gcov --jobs=2 && make -j2
|
|
@ -4,8 +4,8 @@ FROM ossrs/srs:dev
|
||||||
RUN yum install -y gcc make gcc-c++ patch unzip perl git
|
RUN yum install -y gcc make gcc-c++ patch unzip perl git
|
||||||
|
|
||||||
# Build and install SRS.
|
# Build and install SRS.
|
||||||
COPY . /trunk
|
COPY . /srs
|
||||||
WORKDIR /trunk
|
WORKDIR /srs/trunk
|
||||||
RUN ./configure --srt=on --utest=on --jobs=2 && make -j2
|
RUN ./configure --srt=on --utest=on --jobs=2 && make -j2
|
||||||
RUN cd 3rdparty/srs-bench && make
|
RUN cd 3rdparty/srs-bench && make
|
||||||
|
|
||||||
|
|
|
@ -8,29 +8,28 @@
|
||||||
# Workdir is objs/cover.
|
# Workdir is objs/cover.
|
||||||
workdir=`pwd`/objs/cover
|
workdir=`pwd`/objs/cover
|
||||||
|
|
||||||
# Tool git is required to map the right path.
|
|
||||||
git --version >/dev/null 2>&1
|
|
||||||
ret=$?; if [[ $ret -ne 0 ]]; then echo "Tool git is required, ret=$ret"; exit $ret; fi
|
|
||||||
|
|
||||||
# Create trunk under workdir.
|
# Create trunk under workdir.
|
||||||
mkdir -p $workdir && cd $workdir
|
mkdir -p $workdir && cd $workdir
|
||||||
ret=$?; if [[ $ret -ne 0 ]]; then echo "Enter workdir failed, ret=$ret"; exit $ret; fi
|
ret=$?; if [[ $ret -ne 0 ]]; then echo "Enter workdir failed, ret=$ret"; exit $ret; fi
|
||||||
|
|
||||||
# Collect all *.gcno and *.gcda to objs/cover.
|
CODECOV_ARGS=""
|
||||||
cd $workdir && (rm -rf src && cp -R ../../src . && cp -R ../src/* src/)
|
if [[ $SRS_PROJECT != '' ]]; then
|
||||||
ret=$?; if [[ $ret -ne 0 ]]; then echo "Collect *.gcno and *.gcda failed, ret=$ret"; exit $ret; fi
|
# -R root dir Used when not in git/hg project to identify project root directory
|
||||||
|
# -p dir Project root directory. Also used when preparing gcov
|
||||||
# Generate *.gcov for coverage.
|
CODECOV_ARGS="$CODECOV_ARGS -R $SRS_PROJECT -p $SRS_PROJECT"
|
||||||
cd $workdir &&
|
fi
|
||||||
for file in `find src -name "*.cpp"|grep -v utest`; do
|
if [[ $SRS_BRANCH != '' ]]; then
|
||||||
gcov $file -o `dirname $file`
|
# -B branch Specify the branch name
|
||||||
ret=$?; if [[ $ret -ne 0 ]]; then echo "Collect $file failed, ret=$ret"; exit $ret; fi
|
CODECOV_ARGS="$CODECOV_ARGS -B $SRS_BRANCH"
|
||||||
done
|
fi
|
||||||
|
if [[ $SRS_SHA != '' ]]; then
|
||||||
# Cook the gcov files.
|
# -C sha Specify the commit sha
|
||||||
cd $workdir &&
|
CODECOV_ARGS="$CODECOV_ARGS -C $SRS_SHA"
|
||||||
find . -name "*.gcov"|grep -v srs|xargs rm -f
|
fi
|
||||||
ret=$?; if [[ $ret -ne 0 ]]; then echo "Cook gcov files failed, ret=$ret"; exit $ret; fi
|
if [[ $SRS_PR != '' ]]; then
|
||||||
|
# -P pr Specify the pull request number
|
||||||
|
CODECOV_ARGS="$CODECOV_ARGS -P $SRS_PR"
|
||||||
|
fi
|
||||||
|
|
||||||
# Upload report with *.gcov
|
# Upload report with *.gcov
|
||||||
# Remark: The file codecov.yml is not neccessary. It literally depends on git.
|
# Remark: The file codecov.yml is not neccessary. It literally depends on git.
|
||||||
|
@ -39,9 +38,7 @@ ret=$?; if [[ $ret -ne 0 ]]; then echo "Cook gcov files failed, ret=$ret"; exit
|
||||||
# https://codecov.io/gh/ossrs/srs/src/20fbb4466fdc8ba5d810b8570df6004063212838/trunk/src/protocol/srs_rtmp_stack.cpp
|
# https://codecov.io/gh/ossrs/srs/src/20fbb4466fdc8ba5d810b8570df6004063212838/trunk/src/protocol/srs_rtmp_stack.cpp
|
||||||
# Remark: It takes a few minutes to sync with github, so it might not available when CircleCI is done.
|
# Remark: It takes a few minutes to sync with github, so it might not available when CircleCI is done.
|
||||||
# https://circleci.com/gh/ossrs/srs/tree/3.0release
|
# https://circleci.com/gh/ossrs/srs/tree/3.0release
|
||||||
#
|
|
||||||
# Note: Use '-X gcov' to avoid generate the gcov files again.
|
|
||||||
cd $workdir &&
|
cd $workdir &&
|
||||||
export CODECOV_TOKEN="493bba46-c468-4e73-8b45-8cdd8ff62d96" &&
|
export CODECOV_TOKEN="493bba46-c468-4e73-8b45-8cdd8ff62d96" &&
|
||||||
bash <(curl -s https://codecov.io/bash) -X gcov &&
|
bash <(curl -s https://codecov.io/bash) $CODECOV_ARGS &&
|
||||||
echo "Done" && exit 0
|
echo "Done" && exit 0
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue