diff --git a/.github/workflows/compilation_on_android_ubuntu.yml b/.github/workflows/compilation_on_android_ubuntu.yml index 98d4b1b723..752fdbf1e9 100644 --- a/.github/workflows/compilation_on_android_ubuntu.yml +++ b/.github/workflows/compilation_on_android_ubuntu.yml @@ -363,13 +363,32 @@ jobs: run: | sudo apt-get update sudo apt-get install -y g++-multilib + + - name: Install lcov + run: | + sudo apt-get update + sudo apt-get install -y lcov - name: Build and run unit tests + if: matrix.build_target == 'X86_32' run: | - mkdir build && cd build - cmake .. -DWAMR_BUILD_TARGET=${{ matrix.build_target }} - cmake --build . --config Release --parallel 4 - ctest + rm -rf build + cmake -S . -B build -DWAMR_BUILD_TARGET=${{ matrix.build_target }} + cmake --build build --config Release --parallel 4 + ctest --test-dir build --output-on-failure + + - name: Build and run unit tests and collect coverage-data + if: matrix.build_target == 'X86_64' + run: | + rm -rf build + cmake -S . -B build -DWAMR_BUILD_TARGET=${{ matrix.build_target }} -DCOLLECT_CODE_COVERAGE=1 + cmake --build build --config Release --parallel 4 + ctest --test-dir build --output-on-failure + + lcov --quiet --capture --directory build --output-file coverage.all.info + # only keep coverage data for platform independent code + lcov --quiet --extract coverage.all.info "*/core/iwasm/*" "*/core/shared/*" --output-file coverage.info + lcov --summary coverage.info >> $GITHUB_STEP_SUMMARY working-directory: tests/unit build_regression_tests: