mapnik/.github/workflows/ubuntu.yml
Mathis Logemann bff4dbd957 add github actions
use mapnik as user

drop codecov token (not needed)
2022-01-28 11:14:04 +01:00

141 lines
4.2 KiB
YAML

name: Ubuntu
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-nuget.git
UPDATE: 1
preset: linux-ci
mono: mono
jobs:
build:
runs-on: ubuntu-latest
services:
postgres:
image: postgis/postgis
env:
POSTGRES_PASSWORD: password
POSTGRES_DB: mapnik-tmp-postgis-test-db
ports:
- 5432:5432
options: >-
--health-cmd pg_isready
--health-interval 10s
--health-timeout 5s
--health-retries 5
steps:
- name: Install required system packages
shell: "bash"
run: |
sudo apt-get install -y gperf libxxf86vm-dev ninja-build postgresql-client lcov
- name: checkout mapnik
uses: actions/checkout@v2
with:
submodules: "recursive"
- name: checkout vcpkg
uses: actions/checkout@v2
with:
repository: "microsoft/vcpkg"
ref: ${{ inputs.VCPKG_SHA }}
path: vcpkg
- name: "Setup vcpkg"
shell: bash
run: ./vcpkg/bootstrap-vcpkg.sh
- name: "Setup NuGet Credentials"
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"
shell: "bash"
run: >
${{ env.mono }} `./vcpkg/vcpkg fetch nuget | tail -n 1`
setapikey "${{ secrets.NUGET_REGISTRY_PAT }}" -Source "${{ inputs.NUGET_REGISTRY }}"
- name: Configure CMake
run: cmake -DCMAKE_TOOLCHAIN_FILE=./vcpkg/scripts/buildsystems/vcpkg.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-linux/share/proj4
run: ./mapnik-test-visual -j $(nproc) --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 Benchmarks
working-directory: build/${{ env.preset }}/out
env:
PROJ_LIB: ${{ github.workspace }}/build/${{ env.preset }}/vcpkg_installed/x64-linux/share/proj4
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@v2
if: failure()
with:
name: ${{ env.preset }}-artifact-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@v2
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