mapnik/.github/actions/run_tests/action.yml

86 lines
2.6 KiB
YAML
Raw Normal View History

2024-06-22 20:59:01 +02:00
name: Run tests with coverage
description: Runs all mapnik tests with coverage
2022-11-21 22:56:50 +01:00
inputs:
cmake-preset:
2024-06-22 20:59:01 +02:00
description: The used CMake preset
2022-11-21 22:56:50 +01:00
required: true
2024-06-22 20:59:01 +02:00
2022-11-21 22:56:50 +01:00
runs:
2024-06-22 20:59:01 +02:00
using: composite
2022-11-21 22:56:50 +01:00
steps:
2024-06-22 20:59:01 +02:00
- name: Set PROJ_LIB
shell: bash
2022-11-21 22:56:50 +01:00
run: |
2024-06-22 20:59:01 +02:00
cmake --preset ${{ inputs.cmake-preset }} -N -L | grep -o "PROJ_LIB=.*" >> ${GITHUB_ENV}
- name: Set TEST_WRAPPER (Windows)
if: runner.os == 'Windows'
shell: bash
run: |-
echo "TEST_WRAPPER=OpenCppCoverage \
--cover_children \
--export_type binary \
--modules '*.input' \
--modules '*libmapnik*' \
--modules 'mapnik*.exe' \
--quiet \
--sources '${{ github.workspace }}' \
--" >> ${GITHUB_ENV}
2022-11-21 22:56:50 +01:00
- name: Test
2024-06-22 20:59:01 +02:00
shell: bash
2022-11-21 22:56:50 +01:00
env:
2024-06-22 20:59:01 +02:00
UPDATE: 1
2022-11-21 22:56:50 +01:00
run: |
2024-06-22 20:59:01 +02:00
${TEST_WRAPPER:-} ctest --preset ${{ inputs.cmake-preset }}
2022-11-21 22:56:50 +01:00
2024-06-22 20:59:01 +02:00
- name: Test visuals
2022-11-21 22:56:50 +01:00
continue-on-error: true
2022-11-28 08:31:25 +01:00
working-directory: build/out
2024-06-22 20:59:01 +02:00
shell: bash
2022-11-21 22:56:50 +01:00
run: |
2024-06-22 20:59:01 +02:00
${TEST_WRAPPER:-} ./mapnik-test-visual -j ${CTEST_PARALLEL_LEVEL} --output-dir visual-test-result
2022-11-21 22:56:50 +01:00
- name: Pack visual test results
2022-11-28 08:31:25 +01:00
working-directory: build/out
2024-06-22 20:59:01 +02:00
shell: bash
2022-11-21 22:56:50 +01:00
run: |
2024-06-22 20:59:01 +02:00
tar -vzcf visual-test-results.tar.gz visual-test-result
2022-11-21 22:56:50 +01:00
- name: Upload visual test results
2024-03-12 14:24:34 +01:00
uses: actions/upload-artifact@v4
2022-11-21 22:56:50 +01:00
with:
2024-06-22 20:59:01 +02:00
name: ${{ inputs.cmake-preset }}-visual-tests-${{ github.sha }}
2022-11-28 08:31:25 +01:00
path: build/out/visual-test-results.tar.gz
2022-11-21 22:56:50 +01:00
2024-06-22 20:59:01 +02:00
- name: Run Benchmarks (Linux & macOS)
2022-11-28 08:31:25 +01:00
working-directory: build/out
2022-11-21 22:56:50 +01:00
if: runner.os != 'Windows'
2024-06-22 20:59:01 +02:00
shell: bash
run: |
./run_benchmarks
2022-11-21 22:56:50 +01:00
2024-06-22 20:59:01 +02:00
- name: Collect coverage (Linux & macOS)
2022-11-28 08:31:25 +01:00
working-directory: build
2022-11-21 22:56:50 +01:00
if: runner.os != 'Windows'
2024-06-22 20:59:01 +02:00
shell: bash
2022-11-21 22:56:50 +01:00
run: |
2024-06-22 20:59:01 +02:00
if [ "${RUNNER_OS}" == "macOS" ]; then
LCOV_EXTRA_OPTIONS="--ignore-errors count,gcov,inconsistent,range,unused --keep-going"
2024-04-17 23:41:49 +02:00
fi
lcov ${LCOV_EXTRA_OPTIONS:-} --directory . --capture --output-file coverage.info
lcov ${LCOV_EXTRA_OPTIONS:-} --remove coverage.info '/usr/*' '*/vcpkg_installed/*' '/.cache/*' '*/test/*' --output-file coverage.info
lcov ${LCOV_EXTRA_OPTIONS:-} --list coverage.info
2022-11-21 22:56:50 +01:00
2024-06-22 20:59:01 +02:00
- name: Upload coverage to Codecov (Linux & macOS)
2022-11-21 22:56:50 +01:00
if: runner.os != 'Windows'
2024-03-12 14:24:34 +01:00
uses: codecov/codecov-action@v4
2022-11-21 22:56:50 +01:00
with:
2022-11-28 08:31:25 +01:00
files: build/coverage.info
2022-11-21 22:56:50 +01:00
2024-06-22 20:59:01 +02:00
- name: Upload coverage to Codecov (Windows)
2022-11-21 22:56:50 +01:00
if: runner.os == 'Windows'
2024-03-12 14:24:34 +01:00
uses: codecov/codecov-action@v4
2022-11-21 22:56:50 +01:00
with:
2024-06-22 20:59:01 +02:00
files: ctest.cov,build/out/mapnik-test-visual.cov