mapnik/.github/workflows/macos.yml

146 lines
4.8 KiB
YAML

name: MacOS
on:
workflow_call:
inputs:
VCPKG_SHA:
required: true
type: string
NUGET_REGISTRY:
required: true
type: string
NUGET_USERNAME:
required: true
type: string
USE_MEMORY_MAPPED_FILE:
required: true
type: string
secrets:
NUGET_REGISTRY_PAT:
required: true
env:
VCPKG_BINARY_SOURCES: "clear;nuget,GitHub,readwrite"
VCPKG_NUGET_REPOSITORY: https://github.com/mapnik/vcpkg-cache.git
UPDATE: 1
preset: macos-ci
mono: mono
jobs:
build:
runs-on: macos-latest
steps:
- name: Install required system packages
run: |
brew install automake ninja lcov
- name: checkout mapnik
uses: actions/checkout@v3
with:
submodules: "recursive"
- name: checkout vcpkg
uses: actions/checkout@v3
with:
repository: "microsoft/vcpkg"
ref: ${{ inputs.VCPKG_SHA }}
path: vcpkg
- name: "Setup vcpkg"
shell: bash
run: ./vcpkg/bootstrap-vcpkg.sh
- name: "Setup NuGet Credentials"
if: ${{ !(github.event_name == 'pull_request' || github.repository != 'mapnik/mapnik') }}
shell: "bash"
run: >
${{ env.mono }} `./vcpkg/vcpkg fetch nuget | tail -n 1`
sources add
-source "${{ inputs.NUGET_REGISTRY }}"
-storepasswordincleartext
-name "GitHub"
-username "${{ inputs.NUGET_USERNAME }}"
-password "${{ secrets.NUGET_REGISTRY_PAT }}"
- name: "Setup NuGet apikey"
if: ${{ !(github.event_name == 'pull_request' || github.repository != 'mapnik/mapnik') }}
shell: "bash"
run: >
${{ env.mono }} `./vcpkg/vcpkg fetch nuget | tail -n 1`
setapikey "${{ secrets.NUGET_REGISTRY_PAT }}" -Source "${{ inputs.NUGET_REGISTRY }}"
- name: "Setup NuGet Credentials READONLY"
if: ${{ github.event_name == 'pull_request' || github.repository != 'mapnik/mapnik' }}
shell: "bash"
run: >
${{ env.mono }} `./vcpkg/vcpkg fetch nuget | tail -n 1`
sources add
-source "${{ inputs.NUGET_REGISTRY }}"
-storepasswordincleartext
-name "GitHub"
-username "${{ github.actor }}"
-password "${{ secrets.GITHUB_TOKEN }}"
- name: "Setup NuGet apikey READONLY"
if: ${{ github.event_name == 'pull_request' || github.repository != 'mapnik/mapnik' }}
shell: "bash"
run: >
${{ env.mono }} `./vcpkg/vcpkg fetch nuget | tail -n 1`
setapikey "${{ secrets.GITHUB_TOKEN }}" -Source "${{ inputs.NUGET_REGISTRY }}"
- name: Configure CMake
run: cmake -DUSE_MEMORY_MAPPED_FILE=${{ inputs.USE_MEMORY_MAPPED_FILE }} --preset=${{ env.preset }}
- name: Build
run: cmake --build --preset ${{ env.preset }}
- name: Test
run: ctest --preset ${{ env.preset }}
- name: Test visuals
continue-on-error: true
working-directory: build/${{ env.preset }}/out
env:
PROJ_LIB: ${{ github.workspace }}/build/${{ env.preset }}/vcpkg_installed/x64-osx/share/proj/data
run: ./mapnik-test-visual -j $(sysctl -n hw.logicalcpu) --output-dir ./visual-test-result
- name: Pack visual test results
working-directory: build/${{ env.preset }}/out
run: tar cfvz visual-test-results.tar.gz ./visual-test-result
- name: Run Benchmark
working-directory: build/${{ env.preset }}/out
env:
PROJ_LIB: ${{ github.workspace }}/build/${{ env.preset }}/vcpkg_installed/x64-osx/share/proj/data
run: ./run_benchmarks
- name: Coverage
working-directory: build/${{ env.preset }}
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
uses: codecov/codecov-action@v2
with:
files: build/${{ env.preset }}/coverage.info
- name: Package
if: failure()
run: cmake --build --preset ${{ env.preset }} --target package
- name: Upload mapnik build artifact
uses: actions/upload-artifact@v3
if: failure()
with:
name: ${{ env.preset }}-mmio-${{ inputs.USE_MEMORY_MAPPED_FILE }}
path: build/${{ env.preset }}/mapnik-*.tar.gz
retention-days: 2
- name: Upload visual test results
uses: actions/upload-artifact@v3
with:
name: ${{ env.preset }}-visual-tests-mmio-${{ inputs.USE_MEMORY_MAPPED_FILE }}
path: build/${{ env.preset }}/out/visual-test-results.tar.gz
retention-days: 2