1
0
Fork 0
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:
winlin 2019-02-02 21:42:03 +08:00
parent 62087fdb05
commit 7243d8e7b8
5 changed files with 49 additions and 7 deletions

27
trunk/auto/coverage.sh Normal file
View 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