From a0a10927218ffaa28fb78371a7c4fbc049dce05e Mon Sep 17 00:00:00 2001 From: Hummeltech <6109326+hummeltech@users.noreply.github.com> Date: Fri, 19 Jan 2024 16:15:19 -0700 Subject: [PATCH] Report coverage for `latest` Mapnik as well (#375) _Also_: * Don't build unneeded `latest` Mapnik `benchmarks`/`demos`/`utilities` --- .github/actions/coverage/action.yml | 28 +++++++++ .../mapnik/latest/action.yml | 13 +++- .../actions/dependencies/install/action.yml | 2 +- .github/workflows/coverage.yml | 61 +++++++++++-------- 4 files changed, 76 insertions(+), 28 deletions(-) create mode 100644 .github/actions/coverage/action.yml diff --git a/.github/actions/coverage/action.yml b/.github/actions/coverage/action.yml new file mode 100644 index 0000000..6d9d3fb --- /dev/null +++ b/.github/actions/coverage/action.yml @@ -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 diff --git a/.github/actions/dependencies/build-and-install/mapnik/latest/action.yml b/.github/actions/dependencies/build-and-install/mapnik/latest/action.yml index 2ee3031..6d2fff8 100644 --- a/.github/actions/dependencies/build-and-install/mapnik/latest/action.yml +++ b/.github/actions/dependencies/build-and-install/mapnik/latest/action.yml @@ -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 @@ -23,8 +23,17 @@ 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 @@ -32,5 +41,5 @@ runs: 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} diff --git a/.github/actions/dependencies/install/action.yml b/.github/actions/dependencies/install/action.yml index 0b2f77c..b7e002a 100644 --- a/.github/actions/dependencies/install/action.yml +++ b/.github/actions/dependencies/install/action.yml @@ -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 diff --git a/.github/workflows/coverage.yml b/.github/workflows/coverage.yml index 0db544c..05133cd 100644 --- a/.github/workflows/coverage.yml +++ b/.github/workflows/coverage.yml @@ -11,12 +11,22 @@ 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 @@ -24,11 +34,23 @@ jobs: - 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 @@ -36,31 +58,20 @@ jobs: - 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