Skip to content

Commit

Permalink
Update gnome_unit_test.yml
Browse files Browse the repository at this point in the history
  • Loading branch information
cmuhammedrafi committed Nov 13, 2024
1 parent 68caa3e commit 5d3cd43
Show file tree
Hide file tree
Showing 5 changed files with 11 additions and 233 deletions.
48 changes: 9 additions & 39 deletions .github/workflows/gnome_unit_test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,17 +13,6 @@ jobs:
unit-tests:
name: Build and run unit tests
runs-on: ubuntu-latest
strategy:
matrix:
compiler: [ gcc, clang ]
coverage: [ with-coverage, without-coverage ]
exclude:
- compiler: clang
coverage: with-coverage
- compiler: clang
coverage: without-coverage
- compiler: gcc
coverage: without-coverage

steps:
- name: Configure cache
Expand Down Expand Up @@ -101,28 +90,20 @@ jobs:
uses: actions/checkout@v3
with:
path: networkmanager

- name: Set clang toolchain
if: ${{ matrix.compiler == 'clang' }}
run: echo "TOOLCHAIN_FILE=${{github.workspace}}/networkmanager/Tests/clang.cmake" >> $GITHUB_ENV

- name: Set gcc/with-coverage toolchain
if: ${{ matrix.compiler == 'gcc' && matrix.coverage == 'with-coverage' && !env.ACT }}
run: echo "TOOLCHAIN_FILE=${{github.workspace}}/networkmanager/Tests/gcc-with-coverage.cmake" >> $GITHUB_ENV

- name: Build networkmanager with Gnome Proxy
run: >
cmake
-S "${{github.workspace}}/networkmanager"
-B build/GnomeNetworkmanager
-B build/Networkmanager
-DCMAKE_TOOLCHAIN_FILE="${{ env.TOOLCHAIN_FILE }}"
-DCMAKE_INSTALL_PREFIX="${{github.workspace}}/install/usr"
-DCMAKE_MODULE_PATH="${{github.workspace}}/install/tools/cmake"
-DCMAKE_CXX_FLAGS=" -fprofile-arcs -ftest-coverage "
-DENABLE_GNOME_NETWORKMANAGER=ON
-DENABLE_UNIT_TESTING=ON
&&
cmake --build build/GnomeNetworkmanager --target install -j8
cmake --build build/Networkmanager --target install -j8
- name: Run unit tests without valgrind
Expand All @@ -132,27 +113,16 @@ jobs:
wifiTest
- name: Generate coverage
if: ${{ matrix.coverage == 'with-coverage' && !env.ACT }}
run: >
cp ${{github.workspace}}/networkmanager/Tests/WiFi/.lcovrc_l1 ~/.lcovrc
&&
lcov -c
-o coverage.info
-d build/GnomeNetworkmanager
&&
lcov
-r coverage.info
'/usr/include/*'
'*/build/GnomeNetworkmanager/_deps/*'
'*/install/usr/include/*'
'*/Tests/headers/*'
'*/Tests/mocks/*'
'*/Tests/WiFi/*'
-o filtered_coverage.info
run: |
lcov -c -o coverage.info -d build/Networkmanager
lcov -r coverage.info '/usr/include/*' '*/build/Networkmanager/*' \
'*/install/usr/include/*' '*/Tests/*' 'googlemock/*' 'googletest/*' \
-o filtered_coverage.info
- name: Generate the html report
run: |
genhtml coverage.info --output-directory /tmp/coverage_report
genhtml filtered_coverage.info --output-directory /tmp/coverage_report
- name: Upload the coverage report to Pull request using actions
uses: actions/upload-artifact@v4
with:
Expand Down
181 changes: 0 additions & 181 deletions Tests/WiFi/.lcovrc_l1

This file was deleted.

2 changes: 2 additions & 0 deletions Tests/WiFi/wifiTest.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,8 @@ set_target_properties(${WIFI_TEST} PROPERTIES
)
target_compile_options(${WIFI_TEST} PRIVATE -Wall -include ${CMAKE_SOURCE_DIR}/INetworkManager.h)

set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} --coverage")

target_include_directories(${WIFI_TEST} PRIVATE
${GLIB_INCLUDE_DIRS}
${LIBNM_INCLUDE_DIRS}
Expand Down
12 changes: 0 additions & 12 deletions Tests/clang.cmake

This file was deleted.

1 change: 0 additions & 1 deletion Tests/gcc-with-coverage.cmake

This file was deleted.

0 comments on commit 5d3cd43

Please sign in to comment.