mirror of
https://github.com/Zxilly/UA2F.git
synced 2026-01-08 19:33:11 +00:00
ci: use gcno instead
This commit is contained in:
parent
287db4235d
commit
5442ea2df3
22
.github/workflows/ci.yml
vendored
22
.github/workflows/ci.yml
vendored
@ -26,7 +26,7 @@ jobs:
|
||||
- name: Install dependencies
|
||||
run: |
|
||||
sudo apt-get update
|
||||
sudo apt-get install -y cmake libnetfilter-queue-dev libmnl-dev libnetfilter-conntrack-dev libjson-c-dev lcov
|
||||
sudo apt-get install -y cmake libnetfilter-queue-dev libmnl-dev libnetfilter-conntrack-dev libjson-c-dev
|
||||
|
||||
- name: Build and install libubox
|
||||
working-directory: /tmp
|
||||
@ -66,7 +66,7 @@ jobs:
|
||||
- name: Upload unit test coverage to Codecov
|
||||
uses: codecov/codecov-action@v5
|
||||
with:
|
||||
files: build-coverage/coverage_filtered.info
|
||||
directory: build-coverage
|
||||
flags: unittests
|
||||
fail_ci_if_error: true
|
||||
verbose: true
|
||||
@ -83,7 +83,7 @@ jobs:
|
||||
- name: Install dependencies
|
||||
run: |
|
||||
sudo apt-get update
|
||||
sudo apt-get install -y cmake libnetfilter-queue-dev libmnl-dev libnetfilter-conntrack-dev lcov
|
||||
sudo apt-get install -y cmake libnetfilter-queue-dev libmnl-dev libnetfilter-conntrack-dev
|
||||
|
||||
- name: Run unit tests
|
||||
run: |
|
||||
@ -101,7 +101,7 @@ jobs:
|
||||
- name: Upload unit test coverage to Codecov (standalone)
|
||||
uses: codecov/codecov-action@v5
|
||||
with:
|
||||
files: build-coverage/coverage_filtered.info
|
||||
directory: build-coverage
|
||||
flags: unittests-standalone
|
||||
fail_ci_if_error: true
|
||||
verbose: true
|
||||
@ -120,7 +120,7 @@ jobs:
|
||||
- name: Install dependencies
|
||||
run: |
|
||||
sudo apt-get update
|
||||
sudo apt-get install -y cmake libnetfilter-queue-dev libmnl-dev libnetfilter-conntrack-dev lcov
|
||||
sudo apt-get install -y cmake libnetfilter-queue-dev libmnl-dev libnetfilter-conntrack-dev
|
||||
|
||||
- name: Setup Python
|
||||
uses: actions/setup-python@v6
|
||||
@ -174,16 +174,20 @@ jobs:
|
||||
sudo ./ua2f --version
|
||||
sudo -E $(which python3) ../scripts/test.py ./ua2f
|
||||
|
||||
# Fix ownership of coverage files
|
||||
# Fix ownership of all coverage files recursively
|
||||
sudo chown -R $(whoami):$(whoami) .
|
||||
|
||||
# Collect coverage data
|
||||
make coverage-collect
|
||||
# Ensure coverage files are readable
|
||||
find . -name "*.gcno" -o -name "*.gcda" | xargs chmod 644
|
||||
|
||||
# Debug: List coverage files and their permissions
|
||||
echo "Coverage files generated:"
|
||||
find . -name "*.gcno" -o -name "*.gcda" | head -10 | xargs ls -la
|
||||
|
||||
- name: Upload integration test coverage to Codecov
|
||||
uses: codecov/codecov-action@v5
|
||||
with:
|
||||
files: build-coverage/coverage_filtered.info
|
||||
directory: build-coverage
|
||||
flags: integration
|
||||
fail_ci_if_error: true
|
||||
token: ${{ secrets.CODECOV_TOKEN }}
|
||||
|
||||
@ -224,24 +224,13 @@ if (UA2F_BUILD_TESTS)
|
||||
|
||||
# Add coverage target
|
||||
if (UA2F_ENABLE_COVERAGE)
|
||||
find_program(LCOV_PATH lcov)
|
||||
find_program(GENHTML_PATH genhtml)
|
||||
|
||||
if(LCOV_PATH AND GENHTML_PATH)
|
||||
add_custom_target(coverage
|
||||
COMMAND ${LCOV_PATH} --directory . --zerocounters
|
||||
COMMAND ${CMAKE_CURRENT_BINARY_DIR}/ua2f_test
|
||||
COMMAND ${LCOV_PATH} --directory . --capture --output-file coverage.info --ignore-errors mismatch
|
||||
COMMAND ${LCOV_PATH} --remove coverage.info '/usr/*' '${CMAKE_CURRENT_BINARY_DIR}/_deps/*' '*/test/*' --output-file coverage_filtered.info --ignore-errors mismatch
|
||||
COMMAND ${GENHTML_PATH} coverage_filtered.info --output-directory coverage_html --ignore-errors mismatch
|
||||
COMMAND echo "Coverage report generated in coverage_html/index.html"
|
||||
WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}
|
||||
COMMENT "Generating code coverage report"
|
||||
DEPENDS ua2f_test
|
||||
)
|
||||
else()
|
||||
message(WARNING "lcov and genhtml are required for coverage reports")
|
||||
endif()
|
||||
add_custom_target(coverage
|
||||
COMMAND echo "Running unit tests to generate coverage data"
|
||||
COMMAND ${CMAKE_CURRENT_BINARY_DIR}/ua2f_test
|
||||
COMMENT "Generating code coverage data"
|
||||
DEPENDS ua2f_test
|
||||
WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}
|
||||
)
|
||||
endif()
|
||||
|
||||
include(GoogleTest)
|
||||
@ -252,29 +241,15 @@ endif ()
|
||||
|
||||
# Coverage targets for integration testing (independent of unit tests)
|
||||
if (UA2F_ENABLE_COVERAGE)
|
||||
find_program(LCOV_PATH lcov)
|
||||
find_program(GENHTML_PATH genhtml)
|
||||
add_custom_target(coverage-integration
|
||||
COMMAND find . -name "*.gcda" -delete
|
||||
COMMENT "Reset coverage counters for integration tests"
|
||||
WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}
|
||||
)
|
||||
|
||||
if(LCOV_PATH AND GENHTML_PATH)
|
||||
add_custom_target(coverage-integration
|
||||
COMMAND ${LCOV_PATH} --directory . --zerocounters
|
||||
COMMENT "Reset coverage counters for integration tests"
|
||||
WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}
|
||||
)
|
||||
|
||||
add_custom_target(coverage-collect
|
||||
COMMAND ${LCOV_PATH} --directory . --capture --output-file coverage.info --ignore-errors mismatch
|
||||
COMMAND ${LCOV_PATH} --remove coverage.info '/usr/*' '${CMAKE_CURRENT_BINARY_DIR}/_deps/*' '*/test/*' --output-file coverage_filtered.info --ignore-errors mismatch,unused
|
||||
COMMAND ${GENHTML_PATH} coverage_filtered.info --output-directory coverage_html --ignore-errors mismatch
|
||||
COMMENT "Collect integration test coverage data"
|
||||
WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}
|
||||
)
|
||||
|
||||
add_custom_target(coverage-clean
|
||||
COMMAND ${LCOV_PATH} --directory . --zerocounters
|
||||
COMMAND find . -name "*.gcda" -delete
|
||||
WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}
|
||||
COMMENT "Cleaning coverage data"
|
||||
)
|
||||
endif()
|
||||
add_custom_target(coverage-clean
|
||||
COMMAND find . -name "*.gcda" -delete
|
||||
WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}
|
||||
COMMENT "Cleaning coverage data"
|
||||
)
|
||||
endif()
|
||||
|
||||
Loading…
Reference in New Issue
Block a user