mirror of https://github.com/ossrs/srs.git
You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
48 lines
1.9 KiB
Bash
48 lines
1.9 KiB
Bash
6 years ago
|
#!/bin/bash
|
||
|
|
||
|
# In .circleci/config.yml, generate *.gcno with
|
||
5 years ago
|
# ./configure --gcov --without-research --without-librtmp && make
|
||
6 years ago
|
# and generate *.gcda by
|
||
|
# ./objs/srs_utest
|
||
6 years ago
|
|
||
5 years ago
|
# Workdir is objs/cover.
|
||
5 years ago
|
workdir=`pwd`/objs/cover
|
||
|
|
||
5 years ago
|
# 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
|
||
|
|
||
5 years ago
|
# Create trunk under workdir.
|
||
5 years ago
|
mkdir -p $workdir && cd $workdir
|
||
5 years ago
|
ret=$?; if [[ $ret -ne 0 ]]; then echo "Enter workdir failed, ret=$ret"; exit $ret; fi
|
||
|
|
||
6 years ago
|
# Collect all *.gcno and *.gcda to objs/cover.
|
||
5 years ago
|
cd $workdir && (rm -rf src && cp -R ../../src . && cp -R ../src/* src/)
|
||
6 years ago
|
ret=$?; if [[ $ret -ne 0 ]]; then echo "Collect *.gcno and *.gcda failed, ret=$ret"; exit $ret; fi
|
||
|
|
||
5 years ago
|
# Generate *.gcov for coverage.
|
||
5 years ago
|
cd $workdir &&
|
||
5 years ago
|
for file in `find src -name "*.cpp"|grep -v utest`; do
|
||
5 years ago
|
gcov $file -o `dirname $file`
|
||
6 years ago
|
ret=$?; if [[ $ret -ne 0 ]]; then echo "Collect $file failed, ret=$ret"; exit $ret; fi
|
||
|
done
|
||
|
|
||
5 years ago
|
# Cook the gcov files.
|
||
5 years ago
|
cd $workdir &&
|
||
5 years ago
|
find . -name "*.gcov"|grep -v srs|xargs rm -f
|
||
5 years ago
|
ret=$?; if [[ $ret -ne 0 ]]; then echo "Cook gcov files failed, ret=$ret"; exit $ret; fi
|
||
|
|
||
6 years ago
|
# Upload report with *.gcov
|
||
5 years ago
|
# Remark: The file codecov.yml is not neccessary. It literally depends on git.
|
||
|
# Note: The right path is like:
|
||
|
# https://codecov.io/gh/ossrs/srs/src/3.0release/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.
|
||
|
# https://circleci.com/gh/ossrs/srs/tree/3.0release
|
||
4 years ago
|
#
|
||
|
# Note: Use '-X gcov' to avoid generate the gcov files again.
|
||
5 years ago
|
cd $workdir &&
|
||
5 years ago
|
export CODECOV_TOKEN="493bba46-c468-4e73-8b45-8cdd8ff62d96" &&
|
||
4 years ago
|
bash <(curl -s https://codecov.io/bash) -X gcov &&
|
||
5 years ago
|
echo "Done" && exit 0
|