Skip to content

Commit 1497deb

Browse files
committed
Install osm2pgsql-replication script/man page on make install
This also adds a new Github actions workflow which tests the installation of osm2pgsql and osm2pgsql-replication.
1 parent 25a1e9d commit 1497deb

File tree

2 files changed

+96
-0
lines changed

2 files changed

+96
-0
lines changed

.github/workflows/test-install.yml

Lines changed: 94 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,94 @@
1+
name: Test install
2+
3+
on: [ push, pull_request ]
4+
5+
jobs:
6+
ubuntu-test-install:
7+
runs-on: ubuntu-20.04
8+
9+
env:
10+
LUA_VERSION: 5.3
11+
POSTGRESQL_VERSION: 12
12+
POSTGIS_VERSION: 3
13+
BUILD_TYPE: Release
14+
CXXFLAGS: -pedantic -Wextra -Werror
15+
PREFIX: /usr/local
16+
OSMURL: https://download.geofabrik.de/europe/monaco-latest.osm.pbf
17+
OSMFILE: monaco-latest.osm.pbf
18+
19+
steps:
20+
- uses: actions/checkout@v2
21+
- name: Show installed PostgreSQL packages
22+
run: apt-cache search postgresql | sort
23+
- name: Install prerequisites
24+
run: |
25+
sudo apt-get purge -yq postgresql*
26+
sudo apt-get install -yq --no-install-suggests --no-install-recommends \
27+
libboost-filesystem-dev \
28+
libboost-system-dev \
29+
libbz2-dev \
30+
libexpat1-dev \
31+
liblua${LUA_VERSION}-dev \
32+
libluajit-5.1-dev \
33+
libpq-dev \
34+
libproj-dev \
35+
lua${LUA_VERSION} \
36+
pandoc \
37+
postgresql-${POSTGRESQL_VERSION} \
38+
postgresql-${POSTGRESQL_VERSION}-postgis-${POSTGIS_VERSION} \
39+
postgresql-${POSTGRESQL_VERSION}-postgis-${POSTGIS_VERSION}-scripts \
40+
postgresql-client-${POSTGRESQL_VERSION} \
41+
python3-pyosmium \
42+
python3-psycopg2 \
43+
zlib1g-dev
44+
- name: Run CMake
45+
run: |
46+
mkdir build
47+
cd build
48+
cmake .. -DCMAKE_BUILD_TYPE=$BUILD_TYPE
49+
- name: Build osm2pgsql
50+
working-directory: build
51+
run: make -j3 all man
52+
- name: Install osm2pgsql
53+
working-directory: build
54+
run: sudo make install
55+
- name: Check osm2pgsql install
56+
run: |
57+
test -d $PREFIX/bin
58+
test -e $PREFIX/bin/osm2pgsql
59+
test -e $PREFIX/bin/osm2pgsql-replication
60+
test -d $PREFIX/share/man/man1
61+
test -f $PREFIX/share/man/man1/osm2pgsql.1
62+
test -f $PREFIX/share/man/man1/osm2pgsql-replication.1
63+
test -d $PREFIX/share/osm2pgsql
64+
test -f $PREFIX/share/osm2pgsql/default.style
65+
test -f $PREFIX/share/osm2pgsql/empty.style
66+
- name: Set up test databases
67+
run: |
68+
sudo systemctl start postgresql
69+
sudo -u postgres createuser runner
70+
sudo -u postgres createdb -O runner o2ptest
71+
sudo -u postgres psql o2ptest -c "CREATE EXTENSION postgis;"
72+
sudo -u postgres psql o2ptest -c "CREATE EXTENSION hstore;"
73+
- name: Remove repository
74+
# Remove contents of workspace to be sure the install runs independently
75+
working-directory: /
76+
run: rm -fr "${{github.workspace}}"/*
77+
- name: Show man pages
78+
run: |
79+
man -P cat osm2pgsql
80+
man -P cat osm2pgsql-replication
81+
- name: Download test file
82+
run: wget --quiet $OSMURL
83+
working-directory: /tmp
84+
- name: Test run of osm2pgsql
85+
run: $PREFIX/bin/osm2pgsql -d o2ptest --slim $OSMFILE
86+
working-directory: /tmp
87+
- name: Test run osm2pgsql-replication
88+
run: |
89+
$PREFIX/bin/osm2pgsql-replication init -v -d o2ptest
90+
$PREFIX/bin/osm2pgsql-replication status -v -d o2ptest
91+
$PREFIX/bin/osm2pgsql-replication update -v -d o2ptest --once --max-diff-size=1
92+
$PREFIX/bin/osm2pgsql-replication status -v -d o2ptest --json
93+
working-directory: /tmp
94+

CMakeLists.txt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -335,5 +335,7 @@ add_subdirectory(docs)
335335

336336
if (ENABLE_INSTALL)
337337
install(TARGETS osm2pgsql DESTINATION bin)
338+
install(PROGRAMS scripts/osm2pgsql-replication DESTINATION bin)
339+
install(FILES docs/osm2pgsql-replication.1 DESTINATION share/man/man1)
338340
install(FILES default.style empty.style DESTINATION share/osm2pgsql)
339341
endif()

0 commit comments

Comments
 (0)