diff --git a/.github/workflows/check.yml b/.github/workflows/check.yml index 1ab62220..d26e2889 100644 --- a/.github/workflows/check.yml +++ b/.github/workflows/check.yml @@ -43,7 +43,6 @@ jobs: runs-on: ubuntu-20.04 container: ghcr.io/neugates/build:x86_64-main - steps: - uses: actions/checkout@v4 with: @@ -59,28 +58,22 @@ jobs: - name: unit test run: | cd build - sudo apt-get update - sudo apt install -y lcov - ctest --output-on-failure -O tests/ut/reports/ut.log --output-junit tests/ut/reports/output.xml - lcov --capture --directory . --output-file testneuron.info --test-name testneuron - genhtml -o result testneuron.info + ctest --output-on-failure - - uses: actions/upload-artifact@v3 - with: - name: ut_result - path: | - build/tests/ut/reports/ut.log - build/tests/ut/reports/output.xml - build/result/index.html - build/neuron.log + - name: create cov report + run: | + sudo apt-get update + sudo apt-get -y install lcov + mkdir -p cov_report + ./create_cov_report.sh ut - name: Upload coverage to Codecov uses: codecov/codecov-action@v3 with: - gcov: true + verbose: true fail_ci_if_error: true - gcov_include: include plugins src - gcov_ignore: tests simulator + directory: ./cov_report/ + files: cov-ut.info ft: runs-on: ubuntu-20.04 @@ -110,17 +103,22 @@ jobs: with: name: ft_result path: | - ft/reports/log.html - ft/reports/output.xml - ft/reports/report.html build/neuron.log + - name: create cov report + run: | + sudo apt-get update + sudo apt-get -y install lcov + mkdir -p cov_report + ./create_cov_report.sh ft + - name: Upload coverage to Codecov uses: codecov/codecov-action@v3 with: - gcov: true - gcov_include: include plugins src - gcov_ignore: tests simulator + verbose: true + fail_ci_if_error: true + directory: ./cov_report/ + files: cov-ft.info pft: runs-on: ubuntu-20.04 diff --git a/create_cov_report.sh b/create_cov_report.sh index dcb07e71..edfb761c 100755 --- a/create_cov_report.sh +++ b/create_cov_report.sh @@ -11,6 +11,21 @@ function gen_trace () { } case $1 in + (ut) + lcov -c -d build/tests/ut/CMakeFiles/tag_sort_test.dir -o cov_report/cov-tag_sort_test.info + lcov -c -d build/tests/ut/CMakeFiles/modbus_test.dir -o cov_report/cov-modbus_test.info + lcov -c -d build/tests/ut/CMakeFiles/jwt_test.dir -o cov_report/cov-jwt_test.info + lcov -c -d build/tests/ut/CMakeFiles/json_test.dir -o cov_report/cov-json_test.info + lcov -c -d build/tests/ut/CMakeFiles/http_test.dir -o cov_report/cov-http_test.info + lcov -c -d build/tests/ut/CMakeFiles/base64_test.dir -o cov_report/cov-base64_test.info + cd cov_report + lcov -a cov-tag_sort_test.info -a cov-modbus_test.info -a cov-jwt_test.info -a cov-json_test.info -a cov-http_test.info -a cov-base64_test.info -o cov-ut.info;; + (ft) + lcov -c -d build/plugins/mqtt/CMakeFiles/plugin-mqtt.dir -o cov_report/cov-mqtt.info + lcov -c -d build/plugins/modbus/CMakeFiles/plugin-modbus-rtu.dir -o cov_report/cov-modbus-rtu.info + lcov -c -d build/plugins/modbus/CMakeFiles/plugin-modbus-tcp.dir -o cov_report/cov-modbus-tcp.info + cd cov_report + gen_trace -a cov-mqtt.info -a cov-modbus-rtu.info -a cov-modbus-tcp.info -o cov-ft.info;; (ekuiper) lcov -c -d build/plugins/ekuiper/CMakeFiles/plugin-ekuiper.dir -o cov_report/cov-ekuiper.info cd cov_report