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

91 lines
3.1 KiB
YAML
Raw Normal View History

2022-11-21 22:56:50 +01:00
name: "Run tests with coverage"
description: "Runs all mapnik tests with coverage"
inputs:
cmake-preset:
description: "the used cmake preset"
required: true
runs:
using: "composite"
steps:
- name: Set proj enviroment
shell: "pwsh"
run: |
$out = cmake --preset ${{ inputs.cmake-preset }} -N -L
$proj_lib = $out -match "PROJ_LIB=*"
echo ("PROJ_LIB=" + $proj_lib.Substring(11)) >> $env:GITHUB_ENV
- name: Test
shell: "bash"
env:
UPDATE: "1"
run: |
if [ "$RUNNER_OS" == "Windows" ]; then
OpenCppCoverage --modules *libmapnik* --modules mapnik*.exe --modules *.input --sources ${{ github.workspace }} --export_type binary --cover_children -- ctest --preset ${{ inputs.cmake-preset }}
else
ctest --preset ${{ inputs.cmake-preset }}
fi
- name: Test visuals (windows)
continue-on-error: true
2022-11-28 08:31:25 +01:00
working-directory: build/out
2022-11-21 22:56:50 +01:00
shell: "pwsh"
if: runner.os == 'Windows'
run: OpenCppCoverage --modules *libmapnik* --modules mapnik*.exe --modules *.input --sources ${{ github.workspace }} --export_type binary --input_coverage=${{ github.workspace }}/ctest.cov --cover_children -- .\mapnik-test-visual.exe -j (Get-CimInstance -ClassName Win32_ComputerSystem).NumberOfLogicalProcessors --output-dir ./visual-test-result
- name: Test visuals (linux & mac)
continue-on-error: true
2022-11-28 08:31:25 +01:00
working-directory: build/out
2022-11-21 22:56:50 +01:00
shell: "bash"
if: runner.os != 'Windows'
run: |
if [ "$RUNNER_OS" == "Linux" ]; then
./mapnik-test-visual -j $(nproc) --output-dir ./visual-test-result
else
./mapnik-test-visual -j $(sysctl -n hw.logicalcpu) --output-dir ./visual-test-result
fi
- name: Pack visual test results
2022-11-28 08:31:25 +01:00
working-directory: build/out
2022-11-21 22:56:50 +01:00
shell: "pwsh"
run: tar cfvz visual-test-results.tar.gz ./visual-test-result
- name: Generate run guid
id: run-guid
shell: "pwsh"
run: |
$guid = New-Guid
echo ("GUID=" + $guid.toString()) >> $env:GITHUB_OUTPUT
- name: Upload visual test results
uses: actions/upload-artifact@v3
with:
name: ${{ inputs.cmake-preset }}-visual-tests-${{ steps.run-guid.outputs.GUID }}
2022-11-28 08:31:25 +01:00
path: build/out/visual-test-results.tar.gz
2022-11-21 22:56:50 +01:00
- name: Run Benchmarks
2022-11-28 08:31:25 +01:00
working-directory: build/out
2022-11-21 22:56:50 +01:00
if: runner.os != 'Windows'
shell: "pwsh"
run: ./run_benchmarks
- 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'
shell: "bash"
run: |
lcov --directory . --capture --output-file coverage.info
lcov --remove coverage.info '/usr/*' '*/vcpkg_installed/*' '/.cache/*' '*/test/*' --output-file coverage.info
lcov --list coverage.info
- name: Upload coverage to Codecov (linux & macos)
if: runner.os != 'Windows'
uses: codecov/codecov-action@v3
with:
2022-11-28 08:31:25 +01:00
files: build/coverage.info
2022-11-21 22:56:50 +01:00
- name: Upload coverage to Codecov (windows)
if: runner.os == 'Windows'
uses: codecov/codecov-action@v3
with:
2022-11-28 08:31:25 +01:00
files: build/out/mapnik-test-visual.cov