Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
72 changes: 72 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,78 @@ jobs:
with:
name: ReferenceDocumentation
path: build/doc/html

Coverage:
name: "Coverage (Ubuntu GCC)"
runs-on: ubuntu-24.04
steps:
- name: Check out repository code
uses: actions/checkout@v4
with:
submodules: recursive

- name: Install latest CMake 3 and Ninja
uses: lukka/get-cmake@latest
with:
cmakeVersion: "3.31.6"

- name: Install coverage tools
run: |
sudo apt-get update
sudo apt-get install -y jq python3-pip

- name: Install pinned gcovr
run: |
python3 -m pip install --user --upgrade gcovr==8.4
echo "$HOME/.local/bin" >> "$GITHUB_PATH"
gcovr --version

- name: Add VCPKG_ROOT
run: |
echo "VCPKG_ROOT=${VCPKG_INSTALLATION_ROOT}" >> "$GITHUB_ENV"

- name: Make more swap space available
run: |
sudo swapoff -a
sudo fallocate -l 10G /mnt/swapfile
sudo chmod 600 /mnt/swapfile
sudo mkswap /mnt/swapfile
sudo swapon /mnt/swapfile
sudo swapon --show

- name: Configure coverage build
run: |
cp doc/cmake-presets/CMakeUserPresets.json .
cmake --preset=vcpkg-linux -DCMAKE_BUILD_TYPE=Debug -DCESIUM_COVERAGE_ENABLED=ON

- name: Run coverage target
run: |
cmake --build build --target cesium-native-tests-coverage --parallel 2

- name: Generate machine-readable coverage summary
run: |
gcovr --json-summary --json-summary-pretty \
-r . \
-e ".*/extern/.*" \
-e ".*/generated/.*" \
-e ".*/test/.*" \
-e ".*/build.*" \
--object-directory build \
-o build/coverage-summary.json

- name: Upload HTML coverage report
if: ${{ !cancelled() }}
uses: actions/upload-artifact@v4
with:
name: CoverageReportHtml
path: build/cesium-native-tests-coverage

- name: Upload current coverage summary
if: ${{ !cancelled() }}
uses: actions/upload-artifact@v4
with:
name: coverage-current-summary
path: build/coverage-summary.json
WindowsBuild:
strategy:
fail-fast: false
Expand Down
6 changes: 5 additions & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -337,7 +337,11 @@ if (CESIUM_COVERAGE_ENABLED AND NOT MSVC)
setup_target_for_coverage_gcovr_html(
NAME cesium-native-tests-coverage
EXECUTABLE ctest -j ${PROCESSOR_COUNT}
EXCLUDE "${PROJECT_SOURCE_DIR}/extern/*" "${PROJECT_BINARY_DIR}"
EXCLUDE
".*/extern/.*"
".*/generated/.*"
".*/test/.*"
"${PROJECT_BINARY_DIR}"
DEPENDENCIES cesium-native-tests
)
endif()
Expand Down
Loading