Skip to content

Commit c172ca8

Browse files
authored
Merge pull request #3592 from lonvia/remove-cmake
Remove cmake building and bundled osm2pgsql
2 parents 02364ce + 4e59efa commit c172ca8

File tree

16 files changed

+138
-574
lines changed

16 files changed

+138
-574
lines changed
Lines changed: 23 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,10 @@
11
name: 'Build Nominatim'
22

33
inputs:
4-
flavour:
5-
description: 'Version of Ubuntu to install on'
4+
dependencies:
5+
description: 'Where to install dependencies from (pip/apt)'
66
required: false
7-
default: 'ubuntu-20'
8-
cmake-args:
9-
description: 'Additional options to hand to cmake'
10-
required: false
11-
default: ''
12-
lua:
13-
description: 'Version of Lua to use'
14-
required: false
15-
default: '5.3'
7+
default: 'pip'
168

179
runs:
1810
using: "composite"
@@ -23,30 +15,30 @@ runs:
2315
sudo rm -rf /opt/hostedtoolcache/go /opt/hostedtoolcache/CodeQL /usr/lib/jvm /usr/local/share/chromium /usr/local/lib/android
2416
df -h
2517
shell: bash
26-
- name: Install${{ matrix.flavour }} prerequisites
18+
- name: Install general prerequisites
19+
run: |
20+
sudo apt-get install -y -qq libspatialite-dev libsqlite3-mod-spatialite libicu-dev virtualenv python3-dev osm2pgsql
21+
shell: bash
22+
23+
- name: Install prerequisites from apt
2724
run: |
28-
sudo apt-get install -y -qq libboost-system-dev libboost-filesystem-dev libexpat1-dev zlib1g-dev libbz2-dev libpq-dev libproj-dev libicu-dev liblua${LUA_VERSION}-dev lua${LUA_VERSION} lua-dkjson nlohmann-json3-dev libspatialite-dev libsqlite3-mod-spatialite
29-
if [ "$FLAVOUR" == "oldstuff" ]; then
30-
pip3 install MarkupSafe==2.0.1 python-dotenv jinja2==2.8 psutil==5.4.2 pyicu==2.9 osmium PyYAML==5.1 sqlalchemy==1.4.31 psycopg==3.1.7 datrie asyncpg aiosqlite
31-
else
32-
sudo apt-get install -y -qq python3-icu python3-datrie python3-pyosmium python3-jinja2 python3-psutil python3-dotenv python3-yaml
33-
pip3 install sqlalchemy psycopg aiosqlite
34-
fi
25+
sudo apt-get install -y -qq python3-icu python3-datrie python3-jinja2 python3-psutil python3-dotenv python3-yaml python3-sqlalchemy python3-psycopg python3-asyncpg
3526
shell: bash
36-
env:
37-
FLAVOUR: ${{ inputs.flavour }}
38-
CMAKE_ARGS: ${{ inputs.cmake-args }}
39-
LUA_VERSION: ${{ inputs.lua }}
27+
if: inputs.dependencies == 'apt'
4028

41-
- name: Configure
42-
run: mkdir build && cd build && cmake $CMAKE_ARGS ../Nominatim
29+
- name: Setup virtual environment (for pip)
30+
run: |
31+
virtualenv venv
32+
./venv/bin/pip install -U pip
4333
shell: bash
44-
env:
45-
CMAKE_ARGS: ${{ inputs.cmake-args }}
34+
if: inputs.dependencies == 'pip'
4635

47-
- name: Build
36+
- name: Setup virtual environment (for apt)
4837
run: |
49-
make -j2 all
50-
sudo make install
38+
virtualenv venv --system-site-packages
39+
shell: bash
40+
if: inputs.dependencies == 'apt'
41+
42+
- name: Build nominatim
43+
run: ./venv/bin/pip install Nominatim/packaging/nominatim-{api,db}
5144
shell: bash
52-
working-directory: build

.github/actions/setup-postgresql/action.yml

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,6 @@ inputs:
44
postgresql-version:
55
description: 'Version of PostgreSQL to install'
66
required: true
7-
postgis-version:
8-
description: 'Version of Postgis to install'
9-
required: true
107

118
runs:
129
using: "composite"
@@ -24,11 +21,10 @@ runs:
2421

2522
- name: Install PostgreSQL
2623
run: |
27-
sudo apt-get install -y -qq --no-install-suggests --no-install-recommends postgresql-client-${PGVER} postgresql-${PGVER}-postgis-${POSTGISVER} postgresql-${PGVER}-postgis-${POSTGISVER}-scripts postgresql-contrib-${PGVER} postgresql-${PGVER}
24+
sudo apt-get install -y -qq --no-install-suggests --no-install-recommends postgresql-client-${PGVER} postgresql-${PGVER}-postgis-3 postgresql-${PGVER}-postgis-3-scripts postgresql-contrib-${PGVER} postgresql-${PGVER}
2825
shell: bash
2926
env:
3027
PGVER: ${{ inputs.postgresql-version }}
31-
POSTGISVER: ${{ inputs.postgis-version }}
3228

3329
- name: Adapt postgresql configuration
3430
run: |

.github/workflows/ci-tests.yml

Lines changed: 44 additions & 52 deletions
Original file line numberDiff line numberDiff line change
@@ -42,13 +42,13 @@ jobs:
4242
- flavour: ubuntu-20
4343
ubuntu: 20
4444
postgresql: 12
45-
postgis: 3
4645
lua: '5.1'
46+
dependencies: pip
4747
- flavour: ubuntu-24
4848
ubuntu: 24
4949
postgresql: 17
50-
postgis: 3
5150
lua: '5.3'
51+
dependencies: apt
5252

5353
runs-on: ubuntu-${{ matrix.ubuntu }}.04
5454

@@ -60,58 +60,67 @@ jobs:
6060
- name: Unpack Nominatim
6161
run: tar xf nominatim-src.tar.bz2
6262

63-
- uses: actions/setup-python@v5
64-
with:
65-
python-version: 3.7
66-
if: matrix.flavour == 'oldstuff'
67-
6863
- uses: ./Nominatim/.github/actions/setup-postgresql
6964
with:
7065
postgresql-version: ${{ matrix.postgresql }}
71-
postgis-version: ${{ matrix.postgis }}
7266

7367
- uses: ./Nominatim/.github/actions/build-nominatim
7468
with:
75-
flavour: ${{ matrix.flavour }}
76-
lua: ${{ matrix.lua }}
69+
dependencies: ${{ matrix.dependencies }}
7770

78-
- name: Install test prerequisites
79-
run: pip3 install behave==1.2.6
71+
- name: Compile osm2pgsql
72+
run: |
73+
sudo apt-get install -y -qq libboost-system-dev libboost-filesystem-dev libexpat1-dev zlib1g-dev libbz2-dev libpq-dev libproj-dev libicu-dev liblua${LUA_VERSION}-dev lua-dkjson nlohmann-json3-dev
74+
mkdir osm2pgsql-build
75+
cd osm2pgsql-build
76+
git clone https://github.com/osm2pgsql-dev/osm2pgsql
77+
mkdir build
78+
cd build
79+
cmake ../osm2pgsql
80+
make
81+
sudo make install
82+
cd ../..
83+
rm -rf osm2pgsql-build
84+
if: matrix.ubuntu == '20'
85+
env:
86+
LUA_VERSION: ${{ matrix.lua }}
8087

8188
- name: Install test prerequisites
82-
run: sudo apt-get install -y -qq python3-pytest python3-pytest-asyncio uvicorn
89+
run: ./venv/bin/pip install behave==1.2.6
8390

84-
- name: Install newer pytest-asyncio
85-
run: pip3 install -U pytest-asyncio
86-
if: matrix.flavour == 'ubuntu-20'
91+
- name: Install test prerequisites (apt)
92+
run: sudo apt-get install -y -qq python3-pytest python3-pytest-asyncio uvicorn python3-falcon python3-aiosqlite python3-pyosmium
93+
if: matrix.dependencies == 'apt'
8794

88-
- name: Install Python webservers
89-
run: pip3 install falcon starlette asgi_lifespan
95+
- name: Install test prerequisites (pip)
96+
run: ./venv/bin/pip install pytest-asyncio falcon starlette asgi_lifespan aiosqlite osmium uvicorn
97+
if: matrix.dependencies == 'pip'
9098

9199
- name: Install latest flake8
92-
run: pip3 install -U flake8
100+
run: ./venv/bin/pip install -U flake8
93101

94102
- name: Python linting
95-
run: python3 -m flake8 src
103+
run: ../venv/bin/python -m flake8 src
96104
working-directory: Nominatim
97105

106+
- name: Install mypy and typechecking info
107+
run: ./venv/bin/pip install -U mypy types-PyYAML types-jinja2 types-psutil types-requests types-ujson types-Pygments typing-extensions
108+
if: matrix.dependencies == 'pip'
109+
110+
- name: Python static typechecking
111+
run: ../venv/bin/python -m mypy --strict --python-version 3.8 src
112+
working-directory: Nominatim
113+
if: matrix.dependencies == 'pip'
114+
98115
- name: Python unit tests
99-
run: python3 -m pytest test/python
116+
run: ../venv/bin/python -m pytest test/python
100117
working-directory: Nominatim
101118

102119
- name: BDD tests
103120
run: |
104-
export PATH=$GITHUB_WORKSPACE/build/osm2pgsql:$PATH
105-
python3 -m behave -DREMOVE_TEMPLATE=1 --format=progress3
121+
../../../venv/bin/python -m behave -DREMOVE_TEMPLATE=1 --format=progress3
106122
working-directory: Nominatim/test/bdd
107123

108-
- name: Install mypy and typechecking info
109-
run: pip3 install -U mypy osmium uvicorn types-PyYAML types-jinja2 types-psycopg2 types-psutil types-requests types-ujson types-Pygments typing-extensions
110-
111-
- name: Python static typechecking
112-
run: python3 -m mypy --strict --python-version 3.8 src
113-
working-directory: Nominatim
114-
115124
install:
116125
runs-on: ubuntu-latest
117126
needs: create-archive
@@ -186,12 +195,10 @@ jobs:
186195
- name: Add nominatim to path
187196
run: |
188197
sudo ln -s /home/nominatim/nominatim-venv/bin/nominatim /usr/local/bin/nominatim
189-
if: matrix.ubuntu == 24
190198
191199
- name: Need lua binary
192200
run: |
193201
sudo apt-get install -y lua5.4 lua-dkjson
194-
if: matrix.ubuntu == 24
195202
196203
- name: Print version
197204
run: nominatim --version
@@ -221,19 +228,9 @@ jobs:
221228
run: nominatim admin --warm
222229
working-directory: /home/nominatim/nominatim-project
223230

224-
- name: Prepare update (Ubuntu)
225-
run: apt-get install -y python3-pip
226-
shell: bash
227-
228-
- name: Install osmium (Ubuntu 22)
229-
run: |
230-
pip3 install --user osmium
231-
if: matrix.ubuntu == 22
232-
233-
- name: Install osmium (Ubuntu 24)
231+
- name: Install osmium
234232
run: |
235233
/home/nominatim/nominatim-venv/bin/pip install osmium
236-
if: matrix.ubuntu == 24
237234
238235
- name: Run update
239236
run: |
@@ -260,7 +257,7 @@ jobs:
260257
working-directory: /home/nominatim/nominatim-project
261258

262259
install-no-superuser:
263-
runs-on: ubuntu-latest
260+
runs-on: ubuntu-24.04
264261
needs: create-archive
265262

266263
steps:
@@ -274,12 +271,8 @@ jobs:
274271
- uses: ./Nominatim/.github/actions/setup-postgresql
275272
with:
276273
postgresql-version: 16
277-
postgis-version: 3
278274

279275
- uses: ./Nominatim/.github/actions/build-nominatim
280-
with:
281-
flavour: ubuntu-22
282-
lua: 5.3
283276

284277
- name: Prepare import environment
285278
run: |
@@ -288,7 +281,7 @@ jobs:
288281
289282
- name: Prepare Database
290283
run: |
291-
nominatim import --prepare-database
284+
./venv/bin/nominatim import --prepare-database
292285
293286
- name: Create import user
294287
run: |
@@ -298,10 +291,10 @@ jobs:
298291
299292
- name: Run import
300293
run: |
301-
NOMINATIM_DATABASE_DSN="pgsql:host=127.0.0.1;dbname=nominatim;user=osm-import;password=osm-import" nominatim import --continue import-from-file --osm-file test.pbf
294+
NOMINATIM_DATABASE_DSN="pgsql:host=127.0.0.1;dbname=nominatim;user=osm-import;password=osm-import" ./venv/bin/nominatim import --continue import-from-file --osm-file test.pbf
302295
303296
- name: Check full import
304-
run: nominatim admin --check-database
297+
run: ./venv/bin/nominatim admin --check-database
305298

306299
migrate:
307300
runs-on: ubuntu-24.04
@@ -318,7 +311,6 @@ jobs:
318311
- uses: ./Nominatim/.github/actions/setup-postgresql
319312
with:
320313
postgresql-version: 17
321-
postgis-version: 3
322314

323315
- name: Install Python dependencies
324316
run: |

.gitmodules

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +0,0 @@
1-
[submodule "osm2pgsql"]
2-
path = osm2pgsql
3-
url = https://github.com/openstreetmap/osm2pgsql.git
4-
ignore = dirty

0 commit comments

Comments
 (0)