From cbb80aa0db68e7fac873911a16c42ade919dc86b Mon Sep 17 00:00:00 2001 From: Mathis Logemann Date: Mon, 21 Nov 2022 22:56:50 +0100 Subject: [PATCH 1/3] refactor actions --- .github/actions/run_tests/action.yml | 90 ++++++++++++++ .github/actions/setup_vcpkg/action.yml | 50 ++++++++ .github/workflows/build_and_test.yml | 91 ++++++++++++++ .github/workflows/build_test.yml | 91 -------------- .github/workflows/macos.yml | 146 ---------------------- .github/workflows/release_linux.yml | 55 +++++++++ .github/workflows/ubuntu.yml | 162 ------------------------- .github/workflows/windows.yml | 135 --------------------- CMakePresets.json | 21 +++- cmake/pack.cmake | 3 +- 10 files changed, 307 insertions(+), 537 deletions(-) create mode 100644 .github/actions/run_tests/action.yml create mode 100644 .github/actions/setup_vcpkg/action.yml create mode 100644 .github/workflows/build_and_test.yml delete mode 100644 .github/workflows/build_test.yml delete mode 100644 .github/workflows/macos.yml create mode 100644 .github/workflows/release_linux.yml delete mode 100644 .github/workflows/ubuntu.yml delete mode 100644 .github/workflows/windows.yml diff --git a/.github/actions/run_tests/action.yml b/.github/actions/run_tests/action.yml new file mode 100644 index 000000000..44db0d99b --- /dev/null +++ b/.github/actions/run_tests/action.yml @@ -0,0 +1,90 @@ +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 + working-directory: build/${{ inputs.cmake-preset }}/out + 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 + working-directory: build/${{ inputs.cmake-preset }}/out + 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 + working-directory: build/${{ inputs.cmake-preset }}/out + 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 }} + path: build/${{ inputs.cmake-preset }}/out/visual-test-results.tar.gz + + - name: Run Benchmarks + working-directory: build/${{ inputs.cmake-preset }}/out + if: runner.os != 'Windows' + shell: "pwsh" + run: ./run_benchmarks + + - name: Collect coverage (linux & macos) + working-directory: build/${{ inputs.cmake-preset }} + 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: + files: build/${{ inputs.cmake-preset }}/coverage.info + + - name: Upload coverage to Codecov (windows) + if: runner.os == 'Windows' + uses: codecov/codecov-action@v3 + with: + files: build/${{ inputs.cmake-preset }}/out/mapnik-test-visual.cov diff --git a/.github/actions/setup_vcpkg/action.yml b/.github/actions/setup_vcpkg/action.yml new file mode 100644 index 000000000..9cf659639 --- /dev/null +++ b/.github/actions/setup_vcpkg/action.yml @@ -0,0 +1,50 @@ +name: "Setup vcpkg" +description: "Sets up vcpkg" +inputs: + vcpkg-sha: + description: "vcpkg git sha to use" + required: true + nuget-source: + description: "The nuget json" + required: true + nuget-username: + description: "The username for the nuget repository" + required: true + nuget-pat: + description: "The PAT for the nuget repository" + required: true + mono: + description: "mono exec" + required: true + + +runs: + using: "composite" + steps: + - 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" + shell: "bash" + run: > + ${{ inputs.mono }} `./vcpkg/vcpkg fetch nuget | tail -n 1` + sources add + -source "${{ inputs.nuget-source }}" + -storepasswordincleartext + -name "GitHub" + -username "${{ inputs.nuget-username }}" + -password "${{ inputs.nuget-pat }}" + + - name: "Setup NuGet apikey" + shell: "bash" + run: > + ${{ inputs.mono }} `./vcpkg/vcpkg fetch nuget | tail -n 1` + setapikey "${{ inputs.nuget-pat }}" -Source "${{ inputs.nuget-source }}" diff --git a/.github/workflows/build_and_test.yml b/.github/workflows/build_and_test.yml new file mode 100644 index 000000000..fd6f808d5 --- /dev/null +++ b/.github/workflows/build_and_test.yml @@ -0,0 +1,91 @@ +name: Build and Test + +on: + push: + branches: + - "*" + pull_request: + branches-ignore: + - "no-ci-*" + +env: + VCPKG_BINARY_SOURCES: "clear;nuget,GitHub,readwrite" + VCPKG_NUGET_REPOSITORY: https://github.com/mathisloge/vcpkg-nuget.git + +jobs: + checkSource: + name: Check Source Code + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v3 + - uses: actions/setup-python@v4 + with: + python-version: '3.10' + - uses: pre-commit/action@v3.0.0 + + buildAndTest: + name: Build and Test + strategy: + matrix: + os: [macos-latest, windows-latest, ubuntu-latest] + memory-mapped: ["OFF", "ON"] + include: + - os: ubuntu-latest + mono: mono + - os: macos-latest + mono: mono + + runs-on: ${{ matrix.os }} + + steps: + - name: "Install required system packages" + shell: bash + run: | + if [ "$RUNNER_OS" == "Windows" ]; then + choco install ninja OpenCppCoverage + echo "C:\Program Files\OpenCppCoverage" >> ${GITHUB_PATH} + elif [ "$RUNNER_OS" == "Linux" ]; then + sudo apt update + sudo apt install -y gperf libxxf86vm-dev ninja-build postgresql-client lcov autoconf-archive + else + brew install automake ninja lcov autoconf-archive + fi + + - uses: ilammy/msvc-dev-cmd@v1 + if: runner.os == 'Windows' + + - name: checkout mapnik + uses: actions/checkout@v3 + with: + submodules: "recursive" + + - name: setup vcpkg + uses: ./.github/actions/setup_vcpkg + with: + vcpkg-sha: 34d2cf7e62d781f4bcb9c7f44f4d2389f568e92b + nuget-source: https://nuget.pkg.github.com/mapnik/index.json + nuget-username: ${{ github.actor }} + nuget-pat: ${{ secrets.GITHUB_TOKEN }} + mono: ${{ matrix.mono }} + + - id: lc_platform + uses: ASzc/change-string-case-action@v5 + with: + string: ${{ runner.os }} + + - name: set lower case runner os + shell: "bash" + run: | + echo "PRESET=${{ steps.lc_platform.outputs.lowercase }}-ci" >>${GITHUB_ENV} + + - name: Configure CMake + run: cmake -DUSE_MEMORY_MAPPED_FILE=${{ matrix.memory-mapped }} --preset ${{ env.PRESET }} + + - name: Build + run: cmake --build --preset ${{ env.PRESET }} + + - name: Run Tests + uses: ./.github/actions/run_tests + with: + cmake-preset: ${{ env.PRESET }} diff --git a/.github/workflows/build_test.yml b/.github/workflows/build_test.yml deleted file mode 100644 index 7b208586d..000000000 --- a/.github/workflows/build_test.yml +++ /dev/null @@ -1,91 +0,0 @@ -name: Build and Test - -on: - push: - branches: - - "master" - pull_request: - branches-ignore: - - "no-ci-*" - -jobs: - checkSource: - name: Check Source Code - runs-on: ubuntu-latest - - steps: - - uses: actions/checkout@v3 - - uses: actions/setup-python@v3 - - uses: pre-commit/action@v3.0.0 - - windows: - needs: checkSource - name: Windows memory mapped - uses: ./.github/workflows/windows.yml - with: - VCPKG_SHA: 34d2cf7e62d781f4bcb9c7f44f4d2389f568e92b - NUGET_REGISTRY: https://nuget.pkg.github.com/mapnik/index.json - NUGET_USERNAME: mapnik - USE_MEMORY_MAPPED_FILE: "ON" - secrets: - NUGET_REGISTRY_PAT: ${{ secrets.VCPKG_CACHE_PAT }} - - windows-mmf-off: - needs: checkSource - name: Windows file based - uses: ./.github/workflows/windows.yml - with: - VCPKG_SHA: 34d2cf7e62d781f4bcb9c7f44f4d2389f568e92b - NUGET_REGISTRY: https://nuget.pkg.github.com/mapnik/index.json - NUGET_USERNAME: mapnik - USE_MEMORY_MAPPED_FILE: "OFF" - secrets: - NUGET_REGISTRY_PAT: ${{ secrets.VCPKG_CACHE_PAT }} - - ubuntu: - needs: checkSource - name: Linux memory mapped - uses: ./.github/workflows/ubuntu.yml - with: - VCPKG_SHA: 34d2cf7e62d781f4bcb9c7f44f4d2389f568e92b - NUGET_REGISTRY: https://nuget.pkg.github.com/mapnik/index.json - NUGET_USERNAME: mapnik - USE_MEMORY_MAPPED_FILE: "ON" - secrets: - NUGET_REGISTRY_PAT: ${{ secrets.VCPKG_CACHE_PAT }} - - ubuntu-mmf-off: - needs: checkSource - name: Linux file based - uses: ./.github/workflows/ubuntu.yml - with: - VCPKG_SHA: 34d2cf7e62d781f4bcb9c7f44f4d2389f568e92b - NUGET_REGISTRY: https://nuget.pkg.github.com/mapnik/index.json - NUGET_USERNAME: mapnik - USE_MEMORY_MAPPED_FILE: "OFF" - secrets: - NUGET_REGISTRY_PAT: ${{ secrets.VCPKG_CACHE_PAT }} - - macos: - needs: checkSource - name: MacOS memory mapped - uses: ./.github/workflows/macos.yml - with: - VCPKG_SHA: 34d2cf7e62d781f4bcb9c7f44f4d2389f568e92b - NUGET_REGISTRY: https://nuget.pkg.github.com/mapnik/index.json - NUGET_USERNAME: mapnik - USE_MEMORY_MAPPED_FILE: "ON" - secrets: - NUGET_REGISTRY_PAT: ${{ secrets.VCPKG_CACHE_PAT }} - - macos-mmf-off: - needs: checkSource - name: MacOS file based - uses: ./.github/workflows/macos.yml - with: - VCPKG_SHA: 34d2cf7e62d781f4bcb9c7f44f4d2389f568e92b - NUGET_REGISTRY: https://nuget.pkg.github.com/mapnik/index.json - NUGET_USERNAME: mapnik - USE_MEMORY_MAPPED_FILE: "OFF" - secrets: - NUGET_REGISTRY_PAT: ${{ secrets.VCPKG_CACHE_PAT }} diff --git a/.github/workflows/macos.yml b/.github/workflows/macos.yml deleted file mode 100644 index f4cf2868b..000000000 --- a/.github/workflows/macos.yml +++ /dev/null @@ -1,146 +0,0 @@ -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 autoconf-archive - - - 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 - 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 - 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 diff --git a/.github/workflows/release_linux.yml b/.github/workflows/release_linux.yml new file mode 100644 index 000000000..b331f54e3 --- /dev/null +++ b/.github/workflows/release_linux.yml @@ -0,0 +1,55 @@ +name: Release Linux + +on: + push: + branches: + - "*" + pull_request: + branches-ignore: + - "no-ci-*" +env: + PRESET: linux-ci-release + +jobs: + build: + runs-on: "ubuntu-22.04" + steps: + + - name: checkout mapnik + uses: actions/checkout@v3 + with: + submodules: "recursive" + + - name: "Install required system packages" + shell: bash + run: | + sudo apt update + sudo apt install -y ninja-build\ + libicu-dev \ + libfreetype6-dev \ + libharfbuzz-dev \ + libxml2-dev \ + libjpeg-dev \ + libtiff-dev \ + libwebp-dev \ + libcairo2-dev \ + libproj-dev \ + libgdal-dev \ + libboost-filesystem-dev \ + libboost-program-options-dev \ + libboost-regex-dev + + - name: Configure CMake + run: cmake --preset ${{ env.PRESET }} + + - name: Build + run: cmake --build --preset ${{ env.PRESET }} + + - name: Package + run: cmake --build --preset ${{ env.PRESET }} --target package + + - name: Upload mapnik debian package + uses: actions/upload-artifact@v3 + with: + name: ${{ env.PRESET }}-deb + path: build/${{ env.PRESET }}/mapnik-*.deb diff --git a/.github/workflows/ubuntu.yml b/.github/workflows/ubuntu.yml deleted file mode 100644 index 34b972068..000000000 --- a/.github/workflows/ubuntu.yml +++ /dev/null @@ -1,162 +0,0 @@ -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-cache.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 autoconf-archive - - - 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-linux/share/proj - 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/proj - 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 }}-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@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 diff --git a/.github/workflows/windows.yml b/.github/workflows/windows.yml deleted file mode 100644 index 0abc5b2ff..000000000 --- a/.github/workflows/windows.yml +++ /dev/null @@ -1,135 +0,0 @@ -name: Windows - -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: windows-ci - -jobs: - build: - runs-on: windows-latest - - steps: - - name: Install required system packages - run: | - choco install ninja OpenCppCoverage - echo "C:\Program Files\OpenCppCoverage" >> $env:GITHUB_PATH - - - uses: ilammy/msvc-dev-cmd@v1 - - - 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" - run: ./vcpkg/bootstrap-vcpkg.bat - - - name: "Setup NuGet Credentials" - if: ${{ !(github.event_name == 'pull_request' || github.repository != 'mapnik/mapnik') }} - shell: "bash" - run: > - `./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: > - `./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: > - `./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: > - `./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: OpenCppCoverage --modules *libmapnik* --modules mapnik*.exe --modules *.input --sources ${{ github.workspace }} --export_type binary --cover_children -- ctest --preset ${{env.preset}} - - - name: Test visuals - shell: pwsh - continue-on-error: true - working-directory: build/${{ env.preset }}/out - env: - PROJ_LIB: ${{ github.workspace }}/build/${{ env.preset }}/vcpkg_installed/x64-windows/share/proj - 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: Pack visual test results - working-directory: build/${{ env.preset }}/out - run: tar cfvz visual-test-results.tar.gz ./visual-test-result - - - name: Upload coverage to Codecov - uses: codecov/codecov-action@v2 - with: - files: build/${{ env.preset }}/out/mapnik-test-visual.cov - - - name: Package - if: failure() - run: cmake --build --preset ${{env.preset}} --target package - - - uses: actions/upload-artifact@v3 - if: failure() - with: - name: ${{ env.preset }}-artifact-mmio-${{ inputs.USE_MEMORY_MAPPED_FILE }} - path: build/*-ci/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 diff --git a/CMakePresets.json b/CMakePresets.json index 08efaa020..f0bbb21a6 100644 --- a/CMakePresets.json +++ b/CMakePresets.json @@ -1,8 +1,8 @@ { - "version": 2, + "version": 6, "cmakeMinimumRequired": { "major": 3, - "minor": 20, + "minor": 25, "patch": 0 }, "configurePresets": [ @@ -213,6 +213,19 @@ "PROJ_LIB": "${sourceDir}/build/${presetName}/vcpkg_installed/x64-linux/share/proj" } }, + { + "name": "linux-ci-release", + "description": "used by the ci pipeline for releasing", + "inherits": [ + "release-build", + "linux-gcc-release" + ], + "cacheVariables": { + "BUILD_TESTING": "OFF", + "BUILD_DEMO_VIEWER": "OFF", + "USE_MEMORY_MAPPED_FILE": "ON" + } + }, { "name": "macos-ci", "description": "used by the ci pipeline", @@ -263,6 +276,10 @@ "name": "linux-ci", "configurePreset": "linux-ci" }, + { + "name": "linux-ci-release", + "configurePreset": "linux-ci-release" + }, { "name": "macos-ci", "configurePreset": "macos-ci" diff --git a/cmake/pack.cmake b/cmake/pack.cmake index 1544e5018..50e6dddcc 100644 --- a/cmake/pack.cmake +++ b/cmake/pack.cmake @@ -1,9 +1,10 @@ include(InstallRequiredSystemLibraries) set(CPACK_PACKAGE_NAME "mapnik") +set(CPACK_PACKAGE_CONTACT "ubuntu-mathis@outlook.com") set(CPACK_PACKAGE_HOMEPAGE_URL "https://mapnik.org") set(CPACK_RESOURCE_FILE_LICENSE "${PROJECT_SOURCE_DIR}/COPYING") set(CPACK_SOURCE_GENERATOR "TGZ") -set(CPACK_GENERATOR "TGZ") +set(CPACK_GENERATOR "DEB;TGZ") set(CPACK_SOURCE_IGNORE_FILES \\.git/ build/ From d949acb9259ae53036593080b7074f79e7440caf Mon Sep 17 00:00:00 2001 From: Mathis Logemann Date: Sat, 26 Nov 2022 16:10:16 +0100 Subject: [PATCH 2/3] [CI] only build if the check source code step is succesfull --- .github/workflows/build_and_test.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/build_and_test.yml b/.github/workflows/build_and_test.yml index fd6f808d5..0efa12aaf 100644 --- a/.github/workflows/build_and_test.yml +++ b/.github/workflows/build_and_test.yml @@ -26,6 +26,7 @@ jobs: buildAndTest: name: Build and Test + needs: checkSource strategy: matrix: os: [macos-latest, windows-latest, ubuntu-latest] From 2ff1f4228d8c971d0d34fca550430bbbbb245e76 Mon Sep 17 00:00:00 2001 From: Mathis Logemann Date: Sat, 26 Nov 2022 16:40:16 +0100 Subject: [PATCH 3/3] [CI] fail-fast: false --- .github/workflows/build_and_test.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/build_and_test.yml b/.github/workflows/build_and_test.yml index 0efa12aaf..8fda668c2 100644 --- a/.github/workflows/build_and_test.yml +++ b/.github/workflows/build_and_test.yml @@ -28,6 +28,7 @@ jobs: name: Build and Test needs: checkSource strategy: + fail-fast: false matrix: os: [macos-latest, windows-latest, ubuntu-latest] memory-mapped: ["OFF", "ON"]