3 on: [ push, pull_request ]
10 - uses: actions/checkout@v4
14 - uses: actions/cache@v4
17 data/country_osm_grid.sql.gz
18 key: nominatim-country-data-1
20 - name: Package tarball
22 if [ ! -f data/country_osm_grid.sql.gz ]; then
23 wget --no-verbose -O data/country_osm_grid.sql.gz https://www.nominatim.org/data/country_grid.sql.gz
26 tar czf nominatim-src.tar.bz2 Nominatim
27 mv nominatim-src.tar.bz2 Nominatim
29 - name: 'Upload Artifact'
30 uses: actions/upload-artifact@v4
33 path: nominatim-src.tar.bz2
40 flavour: [oldstuff, "ubuntu-20", "ubuntu-22"]
58 runs-on: ubuntu-${{ matrix.ubuntu }}.04
61 - uses: actions/download-artifact@v4
65 - name: Unpack Nominatim
66 run: tar xf nominatim-src.tar.bz2
68 - uses: actions/setup-python@v5
71 if: matrix.flavour == 'oldstuff'
73 - uses: ./Nominatim/.github/actions/setup-postgresql
75 postgresql-version: ${{ matrix.postgresql }}
76 postgis-version: ${{ matrix.postgis }}
78 - uses: ./Nominatim/.github/actions/build-nominatim
80 flavour: ${{ matrix.flavour }}
81 lua: ${{ matrix.lua }}
83 - name: Install test prerequisites (behave from apt)
84 run: sudo apt-get install -y -qq python3-behave
85 if: matrix.flavour == 'ubuntu-20'
87 - name: Install test prerequisites (behave from pip)
88 run: pip3 install behave==1.2.6
89 if: (matrix.flavour == 'oldstuff') || (matrix.flavour == 'ubuntu-22')
91 - name: Install test prerequisites (from apt for Ununtu 2x)
92 run: sudo apt-get install -y -qq python3-pytest python3-pytest-asyncio uvicorn
93 if: matrix.flavour != 'oldstuff'
95 - name: Install newer pytest-asyncio
96 run: pip3 install -U pytest-asyncio
97 if: matrix.flavour == 'ubuntu-20'
99 - name: Install test prerequisites (from pip for Ubuntu 18)
100 run: pip3 install pytest pytest-asyncio uvicorn
101 if: matrix.flavour == 'oldstuff'
103 - name: Install Python webservers
104 run: pip3 install falcon starlette asgi_lifespan
106 - name: Install latest pylint
107 run: pip3 install -U pylint
108 if: matrix.flavour == 'ubuntu-22'
110 - name: Python linting
111 run: python3 -m pylint src
112 working-directory: Nominatim
113 if: matrix.flavour == 'ubuntu-22'
115 - name: Python unit tests
116 run: python3 -m pytest test/python
117 working-directory: Nominatim
121 export PATH=$GITHUB_WORKSPACE/build/osm2pgsql:$PATH
122 python3 -m behave -DREMOVE_TEMPLATE=1 --format=progress3
123 working-directory: Nominatim/test/bdd
125 - name: Install mypy and typechecking info
126 run: pip3 install -U mypy osmium uvicorn types-PyYAML types-jinja2 types-psycopg2 types-psutil types-requests types-ujson types-Pygments typing-extensions
127 if: matrix.flavour != 'oldstuff'
129 - name: Python static typechecking
130 run: python3 -m mypy --strict src
131 working-directory: Nominatim
132 if: matrix.flavour != 'oldstuff'
135 needs: create-archive
136 runs-on: ubuntu-20.04
140 postgresql: ["13", "16"]
143 - uses: actions/download-artifact@v4
147 - name: Unpack Nominatim
148 run: tar xf nominatim-src.tar.bz2
151 uses: shivammathur/setup-php@v2
155 - uses: ./Nominatim/.github/actions/setup-postgresql
157 postgresql-version: ${{ matrix.postgresql }}
160 - name: Install Postgresql server dev
161 run: sudo apt-get install postgresql-server-dev-$PGVER
163 PGVER: ${{ matrix.postgresql }}
165 - uses: ./Nominatim/.github/actions/build-nominatim
167 cmake-args: -DBUILD_MODULE=on
169 - name: Install test prerequisites
170 run: sudo apt-get install -y -qq python3-behave
172 - name: BDD tests (legacy tokenizer)
174 export PATH=$GITHUB_WORKSPACE/build/osm2pgsql:$PATH
175 python3 -m behave -DREMOVE_TEMPLATE=1 -DSERVER_MODULE_PATH=$GITHUB_WORKSPACE/build/module -DAPI_ENGINE=php -DTOKENIZER=legacy --format=progress3
176 working-directory: Nominatim/test/bdd
180 needs: create-archive
181 runs-on: ubuntu-22.04
184 - uses: actions/download-artifact@v4
188 - name: Unpack Nominatim
189 run: tar xf nominatim-src.tar.bz2
191 - uses: ./Nominatim/.github/actions/setup-postgresql
193 postgresql-version: 15
197 uses: shivammathur/setup-php@v2
200 tools: phpunit:9, phpcs, composer
201 ini-values: opcache.jit=disable
203 GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
206 run: phpcs --report-width=120 .
207 working-directory: Nominatim
209 - name: PHP unit tests
211 working-directory: Nominatim/test/php
213 - uses: ./Nominatim/.github/actions/build-nominatim
217 - name: Install test prerequisites
218 run: sudo apt-get install -y -qq python3-behave
220 - name: BDD tests (php)
222 export PATH=$GITHUB_WORKSPACE/build/osm2pgsql:$PATH
223 python3 -m behave -DREMOVE_TEMPLATE=1 -DAPI_ENGINE=php --format=progress3
224 working-directory: Nominatim/test/bdd
228 runs-on: ubuntu-latest
229 needs: create-archive
233 name: [Ubuntu-22, Ubuntu-24]
236 image: "ubuntu:22.04"
238 install_mode: install-apache
240 image: "ubuntu:24.04"
242 install_mode: install-apache
245 image: ${{ matrix.image }}
251 shell: sudo -Hu nominatim bash --noprofile --norc -eo pipefail {0}
254 - name: Prepare container (Ubuntu)
256 export APT_LISTCHANGES_FRONTEND=none
257 export DEBIAN_FRONTEND=noninteractive
259 apt-get install -y git sudo wget
260 ln -snf /usr/share/zoneinfo/$CONTAINER_TIMEZONE /etc/localtime && echo $CONTAINER_TIMEZONE > /etc/timezone
263 - name: Setup import user
266 echo 'nominatim ALL=(ALL:ALL) NOPASSWD: ALL' > /etc/sudoers.d/nominiatim
267 echo "/home/nominatim/Nominatim/vagrant/Install-on-${OS}.sh no $INSTALL_MODE" > /home/nominatim/vagrant.sh
270 OS: ${{ matrix.name }}
271 INSTALL_MODE: ${{ matrix.install_mode }}
273 - uses: actions/download-artifact@v4
276 path: /home/nominatim
278 - name: Install Nominatim
280 export USERNAME=nominatim
281 export USERHOME=/home/nominatim
283 export HAVE_SELINUX=no
284 tar xf nominatim-src.tar.bz2
286 working-directory: /home/nominatim
288 - name: Prepare import environment
290 mv Nominatim/test/testdb/apidb-test-data.pbf test.pbf
291 mv Nominatim/settings/flex-base.lua flex-base.lua
292 mv Nominatim/settings/import-extratags.lua import-extratags.lua
293 mv Nominatim/settings/taginfo.lua taginfo.lua
295 mkdir data-env-reverse
296 working-directory: /home/nominatim
298 - name: Add nominatim to path
300 sudo ln -s /home/nominatim/nominatim-venv/bin/nominatim /usr/local/bin/nominatim
301 if: matrix.ubuntu == 24
303 - name: Need lua binary
305 sudo apt-get install -y lua5.4 lua-dkjson
306 if: matrix.ubuntu == 24
308 - name: Print version
309 run: nominatim --version
310 working-directory: /home/nominatim/nominatim-project
312 - name: Print taginfo
314 working-directory: /home/nominatim
316 - name: Collect host OS information
317 run: nominatim admin --collect-os-info
318 working-directory: /home/nominatim/nominatim-project
321 run: nominatim import --osm-file ../test.pbf
322 working-directory: /home/nominatim/nominatim-project
324 - name: Import special phrases
325 run: nominatim special-phrases --import-from-wiki
326 working-directory: /home/nominatim/nominatim-project
328 - name: Check full import
329 run: nominatim admin --check-database
330 working-directory: /home/nominatim/nominatim-project
332 - name: Warm up database
333 run: nominatim admin --warm
334 working-directory: /home/nominatim/nominatim-project
336 - name: Prepare update (Ubuntu)
337 run: apt-get install -y python3-pip
340 - name: Install osmium (Ubuntu 22)
342 pip3 install --user osmium
343 if: matrix.ubuntu == 22
345 - name: Install osmium (Ubuntu 24)
347 /home/nominatim/nominatim-venv/bin/pip install osmium
348 if: matrix.ubuntu == 24
352 nominatim replication --init
353 NOMINATIM_REPLICATION_MAX_DIFF=1 nominatim replication --once
354 working-directory: /home/nominatim/nominatim-project
356 - name: Clean up database
357 run: nominatim refresh --postcodes --word-tokens
358 working-directory: /home/nominatim/nominatim-project
360 - name: Run reverse-only import
362 echo 'NOMINATIM_DATABASE_DSN="pgsql:dbname=reverse"' >> .env
363 nominatim import --osm-file ../test.pbf --reverse-only --no-updates
364 working-directory: /home/nominatim/data-env-reverse
366 - name: Check reverse-only import
367 run: nominatim admin --check-database
368 working-directory: /home/nominatim/data-env-reverse
370 - name: Clean up database (reverse-only import)
371 run: nominatim refresh --postcodes --word-tokens
372 working-directory: /home/nominatim/nominatim-project
374 install-no-superuser:
375 runs-on: ubuntu-latest
376 needs: create-archive
379 - uses: actions/download-artifact@v4
383 - name: Unpack Nominatim
384 run: tar xf nominatim-src.tar.bz2
386 - uses: ./Nominatim/.github/actions/setup-postgresql
388 postgresql-version: 16
391 - uses: ./Nominatim/.github/actions/build-nominatim
396 - name: Prepare import environment
398 mv Nominatim/test/testdb/apidb-test-data.pbf test.pbf
401 - name: Prepare Database
403 nominatim import --prepare-database
405 - name: Create import user
407 sudo -u postgres createuser osm-import
408 psql -d nominatim -c "ALTER USER \"osm-import\" WITH PASSWORD 'osm-import'"
409 psql -d nominatim -c 'GRANT CREATE ON SCHEMA public TO "osm-import"'
413 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
415 - name: Check full import
416 run: nominatim admin --check-database
419 runs-on: ubuntu-latest
421 - uses: codespell-project/actions-codespell@v2