Merge pull request #2261 from falko17/properly-set-schema-for-find_ch… #1230
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Test install | |
on: [ push, pull_request ] | |
jobs: | |
ubuntu-test-install: | |
runs-on: ubuntu-22.04 | |
strategy: | |
matrix: | |
flavour: [public, middle_schema] | |
include: | |
- flavour: public | |
options: "" | |
schema: "" | |
- flavour: middle_schema | |
options: "--middle-schema=myschema" | |
schema: "myschema" | |
env: | |
LUA_VERSION: 5.3 | |
POSTGRESQL_VERSION: 14 | |
POSTGIS_VERSION: 3 | |
BUILD_TYPE: Release | |
CXXFLAGS: -pedantic -Wextra -Wno-stringop-overread -Werror | |
PREFIX: /usr/local | |
OSMURL: https://download.geofabrik.de/europe/monaco-latest.osm.pbf | |
OSMFILE: monaco-latest.osm.pbf | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Show installed PostgreSQL packages | |
run: apt-cache search postgresql | sort | |
- name: Install prerequisites | |
run: | | |
sudo apt-get purge -yq postgresql* | |
sudo apt-get update -qq | |
sudo apt-get install -yq --no-install-suggests --no-install-recommends \ | |
libboost-dev \ | |
libbz2-dev \ | |
libexpat1-dev \ | |
liblua${LUA_VERSION}-dev \ | |
libluajit-5.1-dev \ | |
libopencv-core-dev \ | |
libopencv-imgcodecs-dev \ | |
libopencv-imgproc-dev \ | |
libpotrace-dev \ | |
libpq-dev \ | |
libproj-dev \ | |
nlohmann-json3-dev \ | |
lua${LUA_VERSION} \ | |
pandoc \ | |
postgresql-${POSTGRESQL_VERSION} \ | |
postgresql-${POSTGRESQL_VERSION}-postgis-${POSTGIS_VERSION} \ | |
postgresql-${POSTGRESQL_VERSION}-postgis-${POSTGIS_VERSION}-scripts \ | |
postgresql-client-${POSTGRESQL_VERSION} \ | |
python3-pyosmium \ | |
python3-psycopg2 \ | |
zlib1g-dev | |
- name: Run CMake | |
run: | | |
mkdir build | |
cd build | |
cmake .. -DCMAKE_BUILD_TYPE=$BUILD_TYPE | |
- name: Build osm2pgsql | |
working-directory: build | |
run: make -j3 all man | |
- name: Install osm2pgsql | |
working-directory: build | |
run: sudo make install | |
- name: Check osm2pgsql install | |
run: | | |
test -d $PREFIX/bin | |
test -e $PREFIX/bin/osm2pgsql | |
test -e $PREFIX/bin/osm2pgsql-replication | |
test -d $PREFIX/share/man/man1 | |
test -f $PREFIX/share/man/man1/osm2pgsql.1 | |
test -f $PREFIX/share/man/man1/osm2pgsql-replication.1 | |
test -d $PREFIX/share/osm2pgsql | |
test -f $PREFIX/share/osm2pgsql/default.style | |
test -f $PREFIX/share/osm2pgsql/empty.style | |
- name: Set up test databases | |
run: | | |
sudo systemctl start postgresql | |
sudo -u postgres createuser runner | |
sudo -u postgres createdb -O runner o2ptest | |
sudo -u postgres psql o2ptest -c "CREATE EXTENSION postgis" | |
sudo -u postgres psql o2ptest -c "CREATE EXTENSION hstore" | |
- name: Set up schema | |
run: | | |
sudo -u postgres psql o2ptest -c "CREATE SCHEMA $SCHEMANAME" | |
sudo -u postgres psql o2ptest -c "GRANT ALL ON SCHEMA $SCHEMANAME TO runner" | |
if: ${{ matrix.schema }} | |
env: | |
SCHEMANAME: ${{ matrix.schema }} | |
- name: Remove repository | |
# Remove contents of workspace to be sure the install runs independently | |
working-directory: / | |
run: rm -fr "${{github.workspace}}"/* | |
- name: Show man pages | |
run: | | |
man -P cat osm2pgsql | |
man -P cat osm2pgsql-replication | |
- name: Download test file | |
run: wget --quiet $OSMURL | |
working-directory: /tmp | |
- name: Test run of osm2pgsql (no schema) | |
run: $PREFIX/bin/osm2pgsql $EXTRAOPTS -d o2ptest --slim $OSMFILE | |
working-directory: /tmp | |
env: | |
EXTRAOPTS: ${{ matrix.options }} | |
- name: Test run osm2pgsql-replication (no schema) | |
run: | | |
$PREFIX/bin/osm2pgsql-replication init $EXTRAOPTS -v -d o2ptest | |
$PREFIX/bin/osm2pgsql-replication status $EXTRAOPTS -v -d o2ptest | |
$PREFIX/bin/osm2pgsql-replication update $EXTRAOPTS -v -d o2ptest --once --max-diff-size=1 | |
$PREFIX/bin/osm2pgsql-replication status $EXTRAOPTS -v -d o2ptest --json | |
working-directory: /tmp | |
env: | |
EXTRAOPTS: ${{ matrix.options }} |