Added OpenSUSE support to build & test pipeline (#344)

* Also added build documentation

Resolves #89
This commit is contained in:
Hummeltech
2023-10-05 15:05:53 -07:00
committed by GitHub
parent 184f1430f5
commit c2896c78ec
11 changed files with 196 additions and 24 deletions

View File

@ -7,12 +7,6 @@ inputs:
runs:
using: composite
steps:
- name: Install `gcc-c++` (CentOS 7)
uses: ./.github/actions/dependencies/install/yum
with:
packages: gcc-c++
if: matrix.image == 'centos:7' && matrix.compiler == 'LLVM'
- name: Create `Mapnik` source directory
run: |
mkdir mapnik-src
@ -46,9 +40,12 @@ runs:
mkdir --parents ${GDAL_DATA} ${PROJ_LIB}
# Configure & build
./configure FAST=True \
PREFIX="/usr" \
OPTIMIZATION=0
./configure \
CC=${CC:-gcc} \
CXX=${CXX:-g++} \
FAST=True \
OPTIMIZATION=0 \
PREFIX="/usr"
make PYTHON=${PYTHON} || make PYTHON=${PYTHON}
shell: bash --noprofile --norc -euxo pipefail {0}
working-directory: mapnik-src

View File

@ -22,7 +22,7 @@ runs:
- name: Build `Mapnik`
run: |
export CMAKE_BUILD_PARALLEL_LEVEL=${BUILD_PARALLEL_LEVEL:-$(nproc)}
cmake -S mapnik-src -B mapnik-build \
cmake -B mapnik-build -S mapnik-src \
-DBUILD_DEMO_VIEWER:BOOL=OFF \
-DBUILD_TESTING:BOOL=OFF \
-DCMAKE_BUILD_TYPE:STRING=Release \

View File

@ -70,6 +70,45 @@ inputs:
macos-test-dependencies:
default: >-
coreutils
opensuse-build-dependencies:
default: >-
apache2-devel
cairo-devel
curl
glib2-devel
libcurl-devel
libiniparser-devel
libmemcached-devel
librados-devel
opensuse-test-dependencies:
default: >-
apache2
apache2-event
apache2-prefork
opensuse-mapnik-build-dependencies:
default: >-
bzip2
freetype-devel
gdal-devel
harfbuzz-devel
libboost_filesystem1_75_0-devel
libboost_headers1_75_0-devel
libboost_program_options1_75_0-devel
libboost_regex1_75_0-devel
libboost_system1_75_0-devel
libicu-devel
libjpeg8-devel
libpng16-devel
libtiff-devel
libwebp-devel
libxml2-devel
make
postgresql-devel
proj-devel
python3
sqlite3-devel
tar
zlib-devel
rhel-build-dependencies:
default: >-
cairo-devel
@ -137,6 +176,8 @@ inputs:
default: 3.1.0
mapnik-build-version-amazonlinux2-centos7:
default: 3.0.17
mapnik-build-version-opensuse:
default: 3.1.0
runs:
using: composite
@ -151,6 +192,7 @@ runs:
${{ inputs.rhel-test-dependencies }}
${{ matrix.build_system == 'CMake' && 'cmake3' || 'autoconf automake redhat-rpm-config' }}
${{ matrix.compiler == 'LLVM' && 'clang' || 'gcc gcc-c++' }}
${{ matrix.image == 'centos:7' && matrix.compiler == 'LLVM' && 'gcc-c++' || '' }}
if: |
startsWith(matrix.image, 'amazonlinux:') ||
startsWith(matrix.image, 'centos:') ||
@ -196,6 +238,17 @@ runs:
${{ matrix.compiler == 'GNU' && 'gcc' || '' }}
if: github.job == 'macOS'
- name: Install Dependencies (openSUSE)
uses: ./.github/actions/dependencies/install/zypper
with:
packages: >-
${{ inputs.opensuse-build-dependencies }}
${{ inputs.opensuse-mapnik-build-dependencies }}
${{ inputs.opensuse-test-dependencies }}
${{ matrix.build_system == 'CMake' && 'cmake' || 'automake' }}
${{ matrix.compiler == 'LLVM' && 'clang' || 'gcc12 gcc12-c++' }}
if: startsWith(matrix.image, 'opensuse/')
- name: Install Dependencies (Ubuntu)
uses: ./.github/actions/dependencies/install/apt-get
with:
@ -209,6 +262,19 @@ runs:
startsWith(matrix.image, 'ubuntu:') ||
(!matrix.image && runner.os == 'Linux')
- name: Link `gcc`/`g++` (openSUSE)
run: |
update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-12 40
update-alternatives --install /usr/bin/g++ g++ /usr/bin/g++-12 40
shell: bash --noprofile --norc -euxo pipefail {0}
if: startsWith(matrix.image, 'opensuse/') && matrix.compiler == 'GNU'
- name: Add `nobody` user/group (openSUSE)
run: |
useradd --home-dir / --no-create-home --shell /usr/sbin/nologin --system --user-group nobody
shell: bash --noprofile --norc -euxo pipefail {0}
if: startsWith(matrix.image, 'opensuse/')
- name: Build & Install `mapnik` (Amazon Linux 2/CentOS 7)
uses: ./.github/actions/dependencies/build-and-install/mapnik
with:
@ -221,8 +287,18 @@ runs:
version: ${{ inputs.mapnik-build-version-centos-stream }}
if: startsWith(matrix.image, 'quay.io/centos/centos:stream')
- name: Build & Install `mapnik` (openSUSE)
uses: ./.github/actions/dependencies/build-and-install/mapnik
with:
version: ${{ inputs.mapnik-build-version-opensuse }}
if: (!matrix.mapnik_latest && startsWith(matrix.image, 'opensuse/'))
- name: Build & Install latest `mapnik` (Debian/Ubuntu)
uses: ./.github/actions/dependencies/build-and-install/mapnik/latest
if: |
matrix.mapnik_latest &&
(startsWith(matrix.image, 'debian:') || startsWith(matrix.image, 'ubuntu:'))
- name: Build & Install latest `mapnik` (openSUSE)
uses: ./.github/actions/dependencies/build-and-install/mapnik/latest
if: (matrix.mapnik_latest && startsWith(matrix.image, 'opensuse/'))

View File

@ -0,0 +1,12 @@
---
inputs:
packages:
description: List of package(s) to install
required: true
runs:
using: composite
steps:
- name: Install package(s)
run: ${{ !matrix.image && 'sudo' || '' }} zypper --non-interactive install ${{ inputs.packages }}
shell: bash --noprofile --norc -euxo pipefail {0}

View File

@ -23,6 +23,7 @@ jobs:
- "fedora:37"
- "fedora:38"
- "fedora:rawhide"
- "opensuse/leap:15"
- "ubuntu:20.04"
build_system:
- CMake
@ -66,6 +67,10 @@ jobs:
run: yum --assumeyes install git
if: matrix.image == 'amazonlinux:2'
- name: Install `git` (openSUSE)
run: zypper --non-interactive install git
if: startsWith(matrix.image, 'opensuse/')
- name: Checkout code (CentOS 7)
uses: actions/checkout@v3
if: matrix.image == 'centos:7'

View File

@ -220,6 +220,9 @@ if(EXISTS "/etc/os-release")
elseif(DISTRO_ID MATCHES "freebsd")
set(TILE_LOAD_DIRECTORY "${HTTPD_SYSCONFDIR}/modules.d")
set(TILE_LOAD_FILENAME "080_tile.conf")
elseif(DISTRO_ID MATCHES "opensuse-leap")
set(TILE_LOAD_DIRECTORY "${HTTPD_SYSCONFDIR}/conf.d")
set(TILE_LOAD_FILENAME "mod_tile.conf")
endif()
elseif(CMAKE_SYSTEM_NAME MATCHES "Darwin")
set(TILE_LOAD_DIRECTORY "${HTTPD_SYSCONFDIR}/extra")

View File

@ -71,6 +71,7 @@ distributions:
* `Fedora </docs/build/building_on_fedora.md>`__
* `FreeBSD </docs/build/building_on_freebsd.md>`__
* `macOS </docs/build/building_on_macos.md>`__
* `openSUSE </docs/build/building_on_opensuse.md>`__
* `Ubuntu </docs/build/building_on_ubuntu.md>`__
Configuration

66
docs/build/building_on_opensuse.md vendored Normal file
View File

@ -0,0 +1,66 @@
# Building on openSUSE
This document provides users with step-by-step instructions on how to compile and use`mod_tile` and `renderd`.
Please see our [Continuous Integration script](/.github/workflows/build-and-test.yml) for more details.
_openSUSE does not provide a `mapnik`/`mapnik-devel` package, so it will first need to be built & installed, which is beyond the scope of this document, please visit the project's [installation document on GitHub](https://github.com/mapnik/mapnik/blob/master/INSTALL.md) or our [Continuous Integration script](/.github/actions/dependencies/build-and-install/mapnik/action.yml) for more information._
## openSUSE 15
```shell
#!/usr/bin/env bash
# Update installed packages
sudo zypper --non-interactive update
# Install build dependencies
# (libmemcached-devel & librados-devel are optional)
sudo zypper --non-interactive install \
apache2 \
apache2-devel \
apache2-prefork \
cairo-devel \
curl \
glib2-devel \
libcurl-devel \
libiniparser-devel \
libmemcached-devel \
librados-devel
# Create `nobody` user and group
sudo useradd --home-dir / --no-create-home --shell /usr/sbin/nologin --system --user-group nobody
# Download, Build, Test & Install `mod_tile`
export CMAKE_BUILD_PARALLEL_LEVEL=$(nproc)
rm -rf /tmp/mod_tile_src /tmp/mod_tile_build
mkdir /tmp/mod_tile_src /tmp/mod_tile_build
cd /tmp/mod_tile_src
git clone --depth 1 https://github.com/openstreetmap/mod_tile.git .
cd /tmp/mod_tile_build
cmake -B . -S /tmp/mod_tile_src \
-DCMAKE_BUILD_TYPE:STRING=Release \
-DENABLE_TESTS:BOOL=ON
cmake --build .
ctest
sudo cmake --install . --prefix /usr --strip
# Create /usr/share/renderd directory
sudo mkdir --parents /usr/share/renderd
# Copy files of example map
sudo cp -av /tmp/mod_tile_src/utils/example-map /usr/share/renderd/example-map
# Add configuration
sudo cp -av /tmp/mod_tile_src/etc/apache2/renderd-example-map.conf /etc/apache2/conf.d/renderd-example-map.conf
printf '\n[example-map]\nURI=/tiles/renderd-example\nXML=/usr/share/renderd/example-map/mapnik.xml\n' | sudo tee -a /etc/renderd.conf
# Enable `mod_access_compat`
sudo sed -i 's/^APACHE_MODULES="actions/APACHE_MODULES="access_compat actions/g' /etc/sysconfig/apache2
# Start services
sudo apache2ctl start
sudo renderd -f
```
Then you can visit: `http://localhost:8081/renderd-example-map`

View File

@ -3,10 +3,10 @@ Redirect /renderd-example-map/leaflet/leaflet.css https://unpkg.com/leaflet/dist
Redirect /renderd-example-map/leaflet/leaflet.min.js https://unpkg.com/leaflet/dist/leaflet.js
<Directory /usr/share/renderd/example-map>
Options +FollowSymLinks
AllowOverride All
Order Allow,Deny
Allow from all
Options +FollowSymLinks
AllowOverride All
Order Allow,Deny
Allow from all
<IfModule authz_core_module>
Require all granted
</IfModule>

View File

@ -27,11 +27,6 @@ find_program(MKDIR_EXECUTABLE NAMES mkdir REQUIRED)
find_program(SHA256SUM_EXECUTABLE NAMES gsha256sum sha256sum REQUIRED)
find_program(TOUCH_EXECUTABLE NAMES gtouch touch REQUIRED)
execute_process(COMMAND ${ID_EXECUTABLE} -gn nobody
OUTPUT_STRIP_TRAILING_WHITESPACE
OUTPUT_VARIABLE NOGROUP_NAME
)
#-----------------------------------------------------------------------------
#
# Test configurations
@ -42,6 +37,7 @@ set(MAP_NAME "default")
set(HTTPD0_PORT "59980")
set(HTTPD1_PORT "59981")
set(RENDERD1_PORT "59991")
set(WWW_USER_NAME "nobody")
set(TILE_DEFAULT_URL "http://localhost:${HTTPD0_PORT}/tiles/renderd-example/9/297/191.png")
set(TILE_JPG_URL "http://localhost:${HTTPD0_PORT}/tiles/renderd-example-jpg/9/297/191.jpg")
@ -62,6 +58,11 @@ set(TILE_WEBP_SHA256SUM_4 "ef3862a57831b21ec69c15be196e1e2b4fea66246c361142631b9
set(TILE_WEBP_SHA256SUM_6 "96fc0455b2269a7bcd4a5b3c9844529c3c77e3bb15f56e72f78a5af3bc15b6b5") # libwebp.so.6
set(TILE_WEBP_SHA256SUM_7 "a82ef9ba5dc333de88af7b645084c30ab2b01c664e17162cbf6659c287cc4df4") # libwebp.so.7
execute_process(COMMAND ${ID_EXECUTABLE} -gn ${WWW_USER_NAME}
OUTPUT_STRIP_TRAILING_WHITESPACE
OUTPUT_VARIABLE WWW_GROUP_NAME
)
configure_file(
renderd.conf.in
conf/renderd.conf

View File

@ -60,14 +60,14 @@ Redirect /renderd-example-map/leaflet/leaflet.min.js https://unpkg.com/leaflet/d
CustomLog logs/access_log "%h %l %u %t \"%r\" %>s %b"
ErrorLog logs/error_log
Group @NOGROUP_NAME@
Group @WWW_GROUP_NAME@
Listen @HTTPD0_PORT@
Listen @HTTPD1_PORT@
LogLevel debug
PidFile run/httpd.pid
ServerName localhost
ServerRoot @PROJECT_BINARY_DIR@/tests
User nobody
User @WWW_USER_NAME@
<IfModule !access_compat_module>
LoadModule access_compat_module @HTTPD_LIBEXECDIR@/mod_access_compat.so
@ -84,9 +84,20 @@ User nobody
<IfModule !log_config_module>
LoadModule log_config_module @HTTPD_LIBEXECDIR@/mod_log_config.so
</IfModule>
<IfModule !mpm_event_module>
LoadModule mpm_event_module @HTTPD_LIBEXECDIR@/mod_mpm_event.so
</IfModule>
<If "-f '@HTTPD_LIBEXECDIR@/mod_mpm_event.so'">
<IfModule !mpm_prefork_module>
<IfModule !mpm_event_module>
LoadModule mpm_event_module @HTTPD_LIBEXECDIR@/mod_mpm_event.so
</IfModule>
</IfModule>
</If>
<If "-f '@HTTPD_LIBEXECDIR@/mod_mpm_prefork.so'">
<IfModule !mpm_event_module>
<IfModule !mpm_prefork_module>
LoadModule mpm_prefork_module @HTTPD_LIBEXECDIR@/mod_mpm_prefork.so
</IfModule>
</IfModule>
</If>
<IfModule !unixd_module>
LoadModule unixd_module @HTTPD_LIBEXECDIR@/mod_unixd.so
</IfModule>