Move gcov to Github Actions (#1500)

* Add gcov generation

* Install missing software

* Change working directory

* typo

* Added echo statements

* Enquote args

* add test for args

* add error message

* replace return with exit

* added extra line returns
This commit is contained in:
David Holdeman 2020-06-16 14:39:50 -07:00 committed by GitHub
parent 06dda18c95
commit 1aa51c25f2
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 42 additions and 0 deletions

View File

@ -18,3 +18,10 @@ jobs:
- name: Run Tests
run: ./unit_tests/build/rusefi_test
- name: Install Coverage Tools
run: sudo apt-get install ncftp lcov
- name: Generate Code Coverage
working-directory: ./unit_tests/
run: ./ci_gcov.sh ${{ secrets.RUSEFI_DOXYGEN_FTP_USER }} ${{ secrets.RUSEFI_DOXYGEN_FTP_PASS }} ${{ secrets.RUSEFI_FTP_SERVER }}

35
unit_tests/ci_gcov.sh Executable file
View File

@ -0,0 +1,35 @@
#!/bin/bash
rm -rf gcov_working_area
mkdir gcov_working_area
cd gcov_working_area
echo "Looking for source code"
find .. -name *.c* > source_files.txt
find ../../firmware/console/ -name *.c* >> source_files.txt
find ../../firmware/controllers/ -name *.c* >> source_files.txt
wc -l source_files.txt
xargs -L 1 -I {} cp {} . < source_files.txt
cp ../build/obj/* .
echo -e "\nGenerating coverage"
gcov *.c* > gcov.log 2>gcov.err
echo -e "\nCollecting coverage"
lcov --capture --directory . --output-file coverage.info
echo -e "\nGenerating HTML"
genhtml coverage.info --output-directory gcov
echo -e "\nUploading HTML"
if [ $1 ] && [ $2 ] && [ $3 ]; then
ncftpput -m -R -v -u "$1" -p "$2" "$3" /unit_tests_coverage gcov/*
else
echo "Error: FTP server details seem to be missing"
exit 1
fi