Skip to content

Commit 07c8ad1

Browse files
authored
Test CMake build system support in GitHub Actions (#288)
* GitHub Actions * Consolidate Mapnik v3/v4 builds into one workflow * Removed pkg-config from macos-build-dependencies * Simplify FreeBSD build * Remove now-merged patch from install latest Mapnik action
1 parent d8a0f29 commit 07c8ad1

28 files changed

Lines changed: 785 additions & 639 deletions

File tree

.github/actions/apache/configure/action.yml

Lines changed: 0 additions & 123 deletions
This file was deleted.
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
---
2+
runs:
3+
using: composite
4+
steps:
5+
- name: Run `./autogen.sh`
6+
run: ./autogen.sh
7+
shell: bash --noprofile --norc -euxo pipefail {0}
8+
9+
- name: Run `./configure`
10+
run: ./configure
11+
shell: bash --noprofile --norc -euxo pipefail {0}
12+
13+
- name: Run `make`
14+
run: make
15+
shell: bash --noprofile --norc -euxo pipefail {0}
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
---
2+
runs:
3+
using: composite
4+
steps:
5+
- name: Run `make install`
6+
run: make install
7+
shell: bash --noprofile --norc -euxo pipefail {0}
8+
9+
- name: Run `make install-mod_tile`
10+
run: make install-mod_tile
11+
shell: bash --noprofile --norc -euxo pipefail {0}
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
---
2+
runs:
3+
using: composite
4+
steps:
5+
- name: Run `make test`
6+
run: make test
7+
shell: bash --noprofile --norc -euxo pipefail {0}

.github/actions/build/action.yml

Lines changed: 6 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -2,22 +2,10 @@
22
runs:
33
using: composite
44
steps:
5-
- name: Link `iniparser.h` to `iniparser/iniparser.h`
6-
run: |
7-
if [ ! -f /usr/include/iniparser/iniparser.h ]; then
8-
mkdir --parents /usr/include/iniparser
9-
ln --symbolic ../iniparser.h /usr/include/iniparser/iniparser.h
10-
fi
11-
shell: bash --noprofile --norc -euxo pipefail {0}
5+
- name: Build `mod_tile` (Autotools)
6+
uses: ./.github/actions/autotools/build
7+
if: matrix.build_system == 'Autotools'
128

13-
- name: Run `./autogen.sh`
14-
run: ./autogen.sh
15-
shell: bash --noprofile --norc -euxo pipefail {0}
16-
17-
- name: Run `./configure`
18-
run: ./configure
19-
shell: bash --noprofile --norc -euxo pipefail {0}
20-
21-
- name: Run `make`
22-
run: make
23-
shell: bash --noprofile --norc -euxo pipefail {0}
9+
- name: Build `mod_tile` (CMake)
10+
uses: ./.github/actions/cmake/build
11+
if: matrix.build_system == 'CMake'
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
---
2+
runs:
3+
using: composite
4+
steps:
5+
- name: Create `cmake` symbolic link
6+
run: |
7+
if ! command -v cmake &> /dev/null && command -v cmake3 &> /dev/null; then
8+
ln --symbolic cmake3 /usr/bin/cmake
9+
fi
10+
shell: bash --noprofile --norc -euxo pipefail {0}
11+
12+
- name: Prepare `build` directory
13+
run: |
14+
cmake -S . -B build \
15+
-LA \
16+
-DCMAKE_BUILD_TYPE=${BUILD_TYPE:-Debug} \
17+
-DCMAKE_INSTALL_PREFIX=${INSTALL_PREFIX:-/usr/local} \
18+
-DENABLE_TESTS=1
19+
shell: bash --noprofile --norc -euxo pipefail {0}
20+
21+
- name: Build `mod_tile`
22+
run: |
23+
export CMAKE_BUILD_PARALLEL_LEVEL=${BUILD_PARALLEL_LEVEL:-$(nproc)}
24+
cmake --build build
25+
shell: bash --noprofile --norc -euxo pipefail {0}
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
---
2+
runs:
3+
using: composite
4+
steps:
5+
- name: Install `mod_tile`
6+
run: cmake --install build
7+
shell: bash --noprofile --norc -euxo pipefail {0}
Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
---
2+
runs:
3+
using: composite
4+
steps:
5+
- name: Create `ctest` symbolic link
6+
run: |
7+
if ! command -v ctest &> /dev/null && command -v ctest3 &> /dev/null; then
8+
ln --symbolic ctest3 /usr/bin/ctest
9+
fi
10+
shell: bash --noprofile --norc -euxo pipefail {0}
11+
12+
- name: Test `mod_tile`
13+
run: ctest -T test
14+
shell: bash --noprofile --norc -euxo pipefail {0}
15+
working-directory: build
16+
17+
- name: Process `mod_tile` coverage results
18+
if: matrix.build_system == 'CMake' && matrix.compiler == 'GNU'
19+
run: ctest -T coverage
20+
shell: bash --noprofile --norc -euxo pipefail {0}
21+
working-directory: build
22+
23+
- name: Retest `mod_tile` on failure
24+
if: failure()
25+
run: ctest --exclude-regex 'clear_dirs|remove_tile' --verbose
26+
shell: bash --noprofile --norc -euxo pipefail {0}
27+
working-directory: build
28+
29+
- name: Archive test artifacts on failure
30+
if: failure()
31+
run: |
32+
TAR_FILENAME=${{ matrix.image }}-${{ matrix.compiler }}.tar.gz
33+
TAR_FILENAME=$(echo "${TAR_FILENAME}" | sed 's/:/-/g')
34+
tar -zcf /tmp/${TAR_FILENAME} tests
35+
shell: bash --noprofile --norc -euxo pipefail {0}
36+
working-directory: build
37+
38+
- name: Upload test artifacts on failure
39+
if: failure()
40+
uses: actions/upload-artifact@v3
41+
with:
42+
name: Test Artifacts
43+
path: /tmp/*.tar.gz
Lines changed: 64 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,64 @@
1+
---
2+
inputs:
3+
version:
4+
description: Version of Mapnik to build & install
5+
required: true
6+
7+
runs:
8+
using: composite
9+
steps:
10+
- name: Install `gcc-c++` (CentOS 7)
11+
uses: ./.github/actions/dependencies/install/yum
12+
with:
13+
packages: gcc-c++
14+
if: matrix.image == 'centos:7' && matrix.compiler == 'LLVM'
15+
16+
- name: Create `Mapnik` source directory
17+
run: |
18+
mkdir mapnik-src
19+
shell: bash --noprofile --norc -euxo pipefail {0}
20+
21+
- name: Cache "Download `Mapnik`" & "Build `Mapnik`"
22+
id: cache-mapnik-src
23+
uses: actions/cache@v3
24+
with:
25+
path: mapnik-src
26+
key: ${{ matrix.image }}-${{ matrix.compiler }}-mapnik-${{ inputs.version }}
27+
28+
- name: Download `Mapnik`
29+
run: |
30+
curl --silent --location \
31+
https://github.com/mapnik/mapnik/releases/download/v${{ inputs.version }}/mapnik-v${{ inputs.version }}.tar.bz2 \
32+
| tar --extract --bzip2 --strip-components=1 --file=-
33+
shell: bash --noprofile --norc -euxo pipefail {0}
34+
working-directory: mapnik-src
35+
if: steps.cache-mapnik-src.outputs.cache-hit != 'true'
36+
37+
- name: Build `Mapnik`
38+
run: |
39+
# Export variables
40+
export GDAL_DATA=/usr/share/gdal
41+
export JOBS=${JOBS:-$(nproc)}
42+
export PROJ_LIB=/usr/share/proj
43+
export PYTHON=${PYTHON:-python3}
44+
45+
# Create GDAL_DATA/PROJ_LIB directories
46+
mkdir --parents ${GDAL_DATA} ${PROJ_LIB}
47+
48+
# Configure & build
49+
./configure FAST=True \
50+
PREFIX="/usr" \
51+
OPTIMIZATION=0
52+
make PYTHON=${PYTHON} || make PYTHON=${PYTHON}
53+
shell: bash --noprofile --norc -euxo pipefail {0}
54+
working-directory: mapnik-src
55+
if: steps.cache-mapnik-src.outputs.cache-hit != 'true'
56+
57+
- name: Install `Mapnik`
58+
run: |
59+
# Export `PYTHON`
60+
export PYTHON=${PYTHON:-python3}
61+
62+
make install PYTHON=${PYTHON}
63+
shell: bash --noprofile --norc -euxo pipefail {0}
64+
working-directory: mapnik-src
Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
---
2+
runs:
3+
using: composite
4+
steps:
5+
- name: Cache "Checkout `Mapnik`" & "Build `Mapnik`"
6+
id: cache-mapnik
7+
uses: actions/cache@v3
8+
with:
9+
path: |
10+
mapnik-build
11+
mapnik-src
12+
key: ${{ matrix.image }}-${{ matrix.compiler }}-mapnik-latest
13+
14+
- name: Checkout `Mapnik`
15+
uses: actions/checkout@v3
16+
with:
17+
path: mapnik-src
18+
repository: mapnik/mapnik
19+
submodules: recursive
20+
if: steps.cache-mapnik.outputs.cache-hit != 'true'
21+
22+
- name: Build `Mapnik`
23+
run: |
24+
export CMAKE_BUILD_PARALLEL_LEVEL=${BUILD_PARALLEL_LEVEL:-$(nproc)}
25+
cmake -S mapnik-src -B mapnik-build \
26+
-DBUILD_DEMO_VIEWER:BOOL=OFF \
27+
-DBUILD_TESTING:BOOL=OFF \
28+
-DCMAKE_BUILD_TYPE=Release \
29+
-DCMAKE_INSTALL_PREFIX:PATH=/usr
30+
cmake --build mapnik-build
31+
shell: bash --noprofile --norc -euxo pipefail {0}
32+
if: steps.cache-mapnik.outputs.cache-hit != 'true'
33+
34+
- name: Install `Mapnik`
35+
run: cmake --install mapnik-build
36+
shell: bash --noprofile --norc -euxo pipefail {0}

0 commit comments

Comments
 (0)