Skip to content

Commit

Permalink
Report coverage for latest Mapnik as well (#375)
Browse files Browse the repository at this point in the history
_Also_:
* Don't build unneeded `latest` Mapnik `benchmarks`/`demos`/`utilities`
  • Loading branch information
hummeltech authored Jan 19, 2024
1 parent b3c19c1 commit a0a1092
Show file tree
Hide file tree
Showing 4 changed files with 76 additions and 28 deletions.
28 changes: 28 additions & 0 deletions .github/actions/coverage/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
---
inputs:
lcov-extra-options:
default: ""

runs:
using: composite
steps:
- name: Process `mod_tile` coverage results
run: |
ctest -T coverage || true
lcov ${{ inputs.lcov-extra-options }} \
--capture \
--directory . \
--output-file coverage.info
lcov ${{ inputs.lcov-extra-options }} \
--output-file coverage.info \
--remove coverage.info \
"${GITHUB_WORKSPACE}/includes/catch/catch.hpp" \
"${GITHUB_WORKSPACE}/src/gen_tile_test.cpp" \
"/usr/*"
working-directory: build
shell: bash --noprofile --norc -euxo pipefail {0}

- name: Report `mod_tile` coverage results to `codecov.io`
uses: codecov/codecov-action@v3
with:
files: build/coverage.info
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ runs:
path: |
mapnik-build
mapnik-src
key: ${{ matrix.image }}-${{ matrix.compiler }}-mapnik-latest
key: ${{ matrix.image || matrix.os || github.job }}-${{ matrix.compiler }}-mapnik-latest

- name: Checkout `Mapnik`
uses: actions/checkout@v4
Expand All @@ -23,14 +23,23 @@ runs:
run: |
export CMAKE_BUILD_PARALLEL_LEVEL=${BUILD_PARALLEL_LEVEL:-$(nproc)}
cmake -B mapnik-build -S mapnik-src \
-DBUILD_BENCHMARK:BOOL=OFF \
-DBUILD_DEMO_CPP:BOOL=OFF \
-DBUILD_DEMO_VIEWER:BOOL=OFF \
-DBUILD_TESTING:BOOL=OFF \
-DBUILD_UTILITY_GEOMETRY_TO_WKB:BOOL=OFF \
-DBUILD_UTILITY_MAPNIK_INDEX:BOOL=OFF \
-DBUILD_UTILITY_MAPNIK_RENDER:BOOL=OFF \
-DBUILD_UTILITY_OGRINDEX:BOOL=OFF \
-DBUILD_UTILITY_PGSQL2SQLITE:BOOL=OFF \
-DBUILD_UTILITY_SHAPEINDEX:BOOL=OFF \
-DBUILD_UTILITY_SVG2PNG:BOOL=OFF \
-DCMAKE_BUILD_TYPE:STRING=Release \
-DCMAKE_INSTALL_PREFIX:PATH=/usr
cmake --build mapnik-build
shell: bash --noprofile --norc -euxo pipefail {0}
if: steps.cache-mapnik.outputs.cache-hit != 'true'

- name: Install `Mapnik`
run: cmake --install mapnik-build
run: ${{ !matrix.image && 'sudo' || '' }} cmake --install mapnik-build
shell: bash --noprofile --norc -euxo pipefail {0}
2 changes: 1 addition & 1 deletion .github/actions/dependencies/install/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -321,7 +321,7 @@ runs:
uses: ./.github/actions/dependencies/build-and-install/mapnik/latest
if: |
matrix.mapnik_latest &&
(startsWith(matrix.image, 'debian:') || startsWith(matrix.image, 'ubuntu:'))
(startsWith(matrix.image, 'debian:') || startsWith(matrix.image, 'ubuntu:') || runner.os == 'Linux')
- name: Build & Install latest `mapnik` (openSUSE)
uses: ./.github/actions/dependencies/build-and-install/mapnik/latest
Expand Down
61 changes: 36 additions & 25 deletions .github/workflows/coverage.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,56 +11,67 @@ on:

jobs:
Coverage:
name: Build, Test & Report Coverage
name: >-
Build, Test & Report Coverage
${{ matrix.mapnik_latest && '(Latest Mapnik)' || '' }}
runs-on: ubuntu-latest
env:
BUILD_TYPE: Debug
CFLAGS: --coverage
CXXFLAGS: --coverage
strategy:
matrix:
compiler:
- GNU
mapnik_latest:
- false
- true
fail-fast: false
steps:
- name: Checkout code
uses: actions/checkout@v4

- name: Install dependencies
uses: ./.github/actions/dependencies/install
with:
ubuntu-test-dependencies: >-
apache2
jq
lcov
memcached
ubuntu-mapnik-latest-build-dependencies: >-
cmake
git
libboost-filesystem-dev
libboost-program-options-dev
libboost-regex-dev
libfreetype6-dev
libgdal-dev
libharfbuzz-dev
libicu-dev
libjpeg-dev
libpq-dev
libproj-dev
libsqlite3-dev
libtiff-dev
libwebp-dev
libxml2-dev
- name: Build `mod_tile`
uses: ./.github/actions/cmake/build

- name: Test `mod_tile`
uses: ./.github/actions/cmake/test

- name: Process `mod_tile` coverage results
run: |
lcov \
--capture \
--directory . \
--output-file coverage.info
lcov \
--output-file coverage.info \
--remove coverage.info \
"${GITHUB_WORKSPACE}/includes/catch/catch.hpp" \
"${GITHUB_WORKSPACE}/src/gen_tile_test.cpp" \
"/usr/*"
genhtml coverage.info --output-directory coverage
working-directory: build
- name: Process & Report `mod_tile` coverage results
uses: ./.github/actions/coverage

- name: Write coverage summary to `$GITHUB_STEP_SUMMARY`
run: lcov --summary build/coverage.info | sed 's/^ /* /g' >> ${GITHUB_STEP_SUMMARY}

- name: Generate `mod_tile` coverage results artifact
run: |
mkdir -p coverage
genhtml coverage.info --output-directory coverage/${{ matrix.mapnik_latest && 'mapnik_latest' || 'mapnik' }}
working-directory: build

- name: Upload `mod_tile` coverage results artifact
uses: actions/upload-artifact@v3
with:
name: Coverage Results
path: build/coverage

- name: Report `mod_tile` coverage results to `codecov.io`
uses: codecov/codecov-action@v3
with:
files: build/coverage.info

0 comments on commit a0a1092

Please sign in to comment.