mirror of
https://github.com/ossrs/srs.git
synced 2025-03-09 15:49:59 +00:00
CI: Support codecov
This commit is contained in:
parent
62087fdb05
commit
7243d8e7b8
5 changed files with 49 additions and 7 deletions
|
@ -11,7 +11,7 @@ jobs:
|
|||
- image: ossrs/dev
|
||||
steps:
|
||||
- checkout
|
||||
- run: cd trunk && ./configure && make && ./objs/srs_utest
|
||||
- run: cd trunk && ./configure --gcov --without-research --without-librtmp && make && bash auto/coverage.sh
|
||||
workflows:
|
||||
version: 2
|
||||
build_and_test:
|
||||
|
|
27
trunk/auto/coverage.sh
Normal file
27
trunk/auto/coverage.sh
Normal file
|
@ -0,0 +1,27 @@
|
|||
#!/bin/bash
|
||||
|
||||
# In .circleci/config.yml, generate *.gcno with
|
||||
# ./configure --gcov --without-research --without-librtmp
|
||||
|
||||
# Generate *.gcda
|
||||
./objs/srs_utest
|
||||
ret=$?; if [[ $ret -ne 0 ]]; then echo "Run SRS utest failed, ret=$ret"; exit $ret; fi
|
||||
|
||||
# Collect all *.gcno and *.gcda to objs/cover.
|
||||
(mkdir -p objs/cover && cd objs/cover &&
|
||||
cp -R ../../src . &&
|
||||
for file in `find ../src -name "*.gcno"`; do cp $file .; done &&
|
||||
for file in `find ../src -name "*.gcda"`; do cp $file .; done)
|
||||
ret=$?; if [[ $ret -ne 0 ]]; then echo "Collect *.gcno and *.gcda failed, ret=$ret"; exit $ret; fi
|
||||
|
||||
# Generate *.gcov to objs/cover
|
||||
for file in `find src -name "*.cpp"`; do
|
||||
(mkdir -p objs/cover && cd objs/cover && gcov ../../$file -o .)
|
||||
ret=$?; if [[ $ret -ne 0 ]]; then echo "Collect $file failed, ret=$ret"; exit $ret; fi
|
||||
done
|
||||
|
||||
# Upload report with *.gcov
|
||||
export CODECOV_TOKEN="493bba46-c468-4e73-8b45-8cdd8ff62d96" &&
|
||||
mkdir -p objs/cover && cd objs/cover &&
|
||||
bash <(curl -s https://codecov.io/bash)
|
||||
exit 0
|
|
@ -43,16 +43,18 @@ SRS_DVR=YES
|
|||
#
|
||||
################################################################
|
||||
# libraries
|
||||
SRS_FFMPEG_STUB=RESERVED
|
||||
SRS_FFMPEG_STUB=NO
|
||||
# arguments
|
||||
SRS_PREFIX=/usr/local/srs
|
||||
SRS_JOBS=1
|
||||
SRS_STATIC=RESERVED
|
||||
SRS_STATIC=NO
|
||||
# whether enable the gcov
|
||||
SRS_GCOV=NO
|
||||
# whether enable the log verbose/info/trace level.
|
||||
# always enable the warn/error level.
|
||||
SRS_LOG_VERBOSE=RESERVED
|
||||
SRS_LOG_INFO=RESERVED
|
||||
SRS_LOG_TRACE=RESERVED
|
||||
SRS_LOG_VERBOSE=NO
|
||||
SRS_LOG_INFO=NO
|
||||
SRS_LOG_TRACE=NO
|
||||
#
|
||||
################################################################
|
||||
# experts
|
||||
|
@ -154,7 +156,8 @@ Options:
|
|||
--without-mips-ubuntu12 do not cross build srs on ubuntu12 for mips.
|
||||
|
||||
--prefix=<path> The absolute installation path for srs. Default: $SRS_PREFIX
|
||||
--static whether add '-static' to link options.
|
||||
--static Whether add '-static' to link options.
|
||||
--gcov Whether enable the GCOV compiler options.
|
||||
--jobs[=N] Allow N jobs at once; infinite jobs with no arg.
|
||||
used for make in the configure, for example, to make ffmpeg.
|
||||
--log-verbose whether enable the log verbose level. default: no.
|
||||
|
@ -267,6 +270,7 @@ function parse_user_option() {
|
|||
--log-verbose) SRS_LOG_VERBOSE=YES ;;
|
||||
--log-info) SRS_LOG_INFO=YES ;;
|
||||
--log-trace) SRS_LOG_TRACE=YES ;;
|
||||
--gcov) SRS_GCOV=YES ;;
|
||||
|
||||
--x86-x64) SRS_X86_X64=YES ;;
|
||||
--x86-64) SRS_X86_X64=YES ;;
|
||||
|
@ -640,6 +644,7 @@ SRS_AUTO_CONFIGURE="--prefix=${SRS_PREFIX}"
|
|||
if [ $SRS_LOG_VERBOSE = YES ]; then SRS_AUTO_CONFIGURE="${SRS_AUTO_CONFIGURE} --log-verbose"; fi
|
||||
if [ $SRS_LOG_INFO = YES ]; then SRS_AUTO_CONFIGURE="${SRS_AUTO_CONFIGURE} --log-info"; fi
|
||||
if [ $SRS_LOG_TRACE = YES ]; then SRS_AUTO_CONFIGURE="${SRS_AUTO_CONFIGURE} --log-trace"; fi
|
||||
if [ $SRS_GCOV = YES ]; then SRS_AUTO_CONFIGURE="${SRS_AUTO_CONFIGURE} --gcov"; fi
|
||||
echo "User config: $SRS_AUTO_USER_CONFIGURE"
|
||||
echo "Detail config: ${SRS_AUTO_CONFIGURE}"
|
||||
}
|
||||
|
|
8
trunk/configure
vendored
8
trunk/configure
vendored
|
@ -104,6 +104,10 @@ CXXFLAGS="${CXXFLAGS} ${CppStd}${WarnLevel}${GDBDebug}${LibraryCompile}${SrsGpro
|
|||
if [ $SRS_GPERF = YES ]; then
|
||||
CXXFLAGS="${CXXFLAGS} -fno-builtin-malloc -fno-builtin-calloc -fno-builtin-realloc -fno-builtin-free";
|
||||
fi
|
||||
# For coverage.
|
||||
if [[ $SRS_GCOV == YES ]]; then
|
||||
CXXFLAGS="${CXXFLAGS} -fprofile-arcs -ftest-coverage";
|
||||
fi
|
||||
# Start to generate the Makefile.
|
||||
cat << END > ${SRS_OBJS}/${SRS_MAKEFILE}
|
||||
GCC = gcc
|
||||
|
@ -153,6 +157,10 @@ fi
|
|||
if [ $SRS_MIPS_UBUNTU12 = YES ]; then
|
||||
SrsLinkOptions="${SrsLinkOptions} -lgcc_eh";
|
||||
fi
|
||||
# For coverage.
|
||||
if [[ $SRS_GCOV == YES ]]; then
|
||||
SrsLinkOptions="${SrsLinkOptions} -fprofile-arcs -ftest-coverage";
|
||||
fi
|
||||
|
||||
#####################################################################################
|
||||
# Modules, compile each module, then link to binary
|
||||
|
|
|
@ -303,6 +303,7 @@
|
|||
3C1232F21AAEAC7000CE8F6C /* srs-api */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.script.sh; name = "srs-api"; path = "../../../etc/init.d/srs-api"; sourceTree = "<group>"; };
|
||||
3C1232F31AAEAC7000CE8F6C /* srs-demo */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.script.sh; name = "srs-demo"; path = "../../../etc/init.d/srs-demo"; sourceTree = "<group>"; };
|
||||
3C1232F41AAEAC7000CE8F6C /* srs-demo-19350 */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.script.sh; name = "srs-demo-19350"; path = "../../../etc/init.d/srs-demo-19350"; sourceTree = "<group>"; };
|
||||
3C1CDBFB2205CE0300A8C08E /* coverage.sh */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.script.sh; name = coverage.sh; path = ../../../auto/coverage.sh; sourceTree = "<group>"; };
|
||||
3C1EE6AC1AB1055800576EE9 /* srs_app_hds.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = srs_app_hds.cpp; path = ../../../src/app/srs_app_hds.cpp; sourceTree = "<group>"; };
|
||||
3C1EE6AD1AB1055800576EE9 /* srs_app_hds.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; name = srs_app_hds.hpp; path = ../../../src/app/srs_app_hds.hpp; sourceTree = "<group>"; };
|
||||
3C1EE6B01AB1080900576EE9 /* bandwidth.conf */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; name = bandwidth.conf; path = ../../../conf/bandwidth.conf; sourceTree = "<group>"; };
|
||||
|
@ -731,6 +732,7 @@
|
|||
3C1232BB1AAE827E00CE8F6C /* apps.sh */,
|
||||
3C1232BC1AAE827E00CE8F6C /* auto_headers.sh */,
|
||||
3C1232BD1AAE827E00CE8F6C /* build_ffmpeg.sh */,
|
||||
3C1CDBFB2205CE0300A8C08E /* coverage.sh */,
|
||||
3C1232BE1AAE827E00CE8F6C /* depends.sh */,
|
||||
3C1232BF1AAE827E00CE8F6C /* generate_header.sh */,
|
||||
3C1232C01AAE827E00CE8F6C /* generate-srs-librtmp-project.sh */,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue