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 python3 -m behave -DREMOVE_TEMPLATE=1 -DBUILDDIR=$GITHUB_WORKSPACE/build --format=progress3
122 working-directory: Nominatim/test/bdd
124 - name: Install mypy and typechecking info
125 run: pip3 install -U mypy osmium uvicorn types-PyYAML types-jinja2 types-psycopg2 types-psutil types-requests types-ujson types-Pygments typing-extensions
126 if: matrix.flavour != 'oldstuff'
128 - name: Python static typechecking
129 run: python3 -m mypy --strict src
130 working-directory: Nominatim
131 if: matrix.flavour != 'oldstuff'
134 needs: create-archive
135 runs-on: ubuntu-20.04
139 postgresql: ["13", "16"]
142 - uses: actions/download-artifact@v4
146 - name: Unpack Nominatim
147 run: tar xf nominatim-src.tar.bz2
150 uses: shivammathur/setup-php@v2
154 - uses: ./Nominatim/.github/actions/setup-postgresql
156 postgresql-version: ${{ matrix.postgresql }}
159 - name: Install Postgresql server dev
160 run: sudo apt-get install postgresql-server-dev-$PGVER
162 PGVER: ${{ matrix.postgresql }}
164 - uses: ./Nominatim/.github/actions/build-nominatim
166 cmake-args: -DBUILD_MODULE=on
168 - name: Install test prerequisites
169 run: sudo apt-get install -y -qq python3-behave
171 - name: BDD tests (legacy tokenizer)
173 python3 -m behave -DREMOVE_TEMPLATE=1 -DBUILDDIR=$GITHUB_WORKSPACE/build -DAPI_ENGINE=php -DTOKENIZER=legacy --format=progress3
174 working-directory: Nominatim/test/bdd
178 needs: create-archive
179 runs-on: ubuntu-22.04
182 - uses: actions/download-artifact@v4
186 - name: Unpack Nominatim
187 run: tar xf nominatim-src.tar.bz2
189 - uses: ./Nominatim/.github/actions/setup-postgresql
191 postgresql-version: 15
195 uses: shivammathur/setup-php@v2
198 tools: phpunit:9, phpcs, composer
199 ini-values: opcache.jit=disable
201 GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
204 run: phpcs --report-width=120 .
205 working-directory: Nominatim
207 - name: PHP unit tests
209 working-directory: Nominatim/test/php
211 - uses: ./Nominatim/.github/actions/build-nominatim
215 - name: Install test prerequisites
216 run: sudo apt-get install -y -qq python3-behave
218 - name: BDD tests (php)
220 python3 -m behave -DREMOVE_TEMPLATE=1 -DBUILDDIR=$GITHUB_WORKSPACE/build -DAPI_ENGINE=php --format=progress3
221 working-directory: Nominatim/test/bdd
225 runs-on: ubuntu-latest
226 needs: create-archive
230 name: [Ubuntu-22, Ubuntu-24]
233 image: "ubuntu:22.04"
235 install_mode: install-apache
237 image: "ubuntu:24.04"
239 install_mode: install-apache
242 image: ${{ matrix.image }}
248 shell: sudo -Hu nominatim bash --noprofile --norc -eo pipefail {0}
251 - name: Prepare container (Ubuntu)
253 export APT_LISTCHANGES_FRONTEND=none
254 export DEBIAN_FRONTEND=noninteractive
256 apt-get install -y git sudo wget
257 ln -snf /usr/share/zoneinfo/$CONTAINER_TIMEZONE /etc/localtime && echo $CONTAINER_TIMEZONE > /etc/timezone
260 - name: Setup import user
263 echo 'nominatim ALL=(ALL:ALL) NOPASSWD: ALL' > /etc/sudoers.d/nominiatim
264 echo "/home/nominatim/Nominatim/vagrant/Install-on-${OS}.sh no $INSTALL_MODE" > /home/nominatim/vagrant.sh
267 OS: ${{ matrix.name }}
268 INSTALL_MODE: ${{ matrix.install_mode }}
270 - uses: actions/download-artifact@v4
273 path: /home/nominatim
275 - name: Install Nominatim
277 export USERNAME=nominatim
278 export USERHOME=/home/nominatim
280 export HAVE_SELINUX=no
281 tar xf nominatim-src.tar.bz2
283 working-directory: /home/nominatim
285 - name: Prepare import environment
287 mv Nominatim/test/testdb/apidb-test-data.pbf test.pbf
288 mv Nominatim/settings/flex-base.lua flex-base.lua
289 mv Nominatim/settings/import-extratags.lua import-extratags.lua
290 mv Nominatim/settings/taginfo.lua taginfo.lua
292 mkdir data-env-reverse
293 working-directory: /home/nominatim
295 - name: Add nominatim to path
297 sudo ln -s /home/nominatim/nominatim-venv/bin/nominatim /usr/local/bin/nominatim
298 if: matrix.ubuntu == 24
300 - name: Need lua binary
302 sudo apt-get install -y lua5.4 lua-dkjson
303 if: matrix.ubuntu == 24
305 - name: Print version
306 run: nominatim --version
307 working-directory: /home/nominatim/nominatim-project
309 - name: Print taginfo
311 working-directory: /home/nominatim
313 - name: Collect host OS information
314 run: nominatim admin --collect-os-info
315 working-directory: /home/nominatim/nominatim-project
318 run: nominatim import --osm-file ../test.pbf
319 working-directory: /home/nominatim/nominatim-project
321 - name: Import special phrases
322 run: nominatim special-phrases --import-from-wiki
323 working-directory: /home/nominatim/nominatim-project
325 - name: Check full import
326 run: nominatim admin --check-database
327 working-directory: /home/nominatim/nominatim-project
329 - name: Warm up database
330 run: nominatim admin --warm
331 working-directory: /home/nominatim/nominatim-project
333 - name: Prepare update (Ubuntu)
334 run: apt-get install -y python3-pip
337 - name: Install osmium (Ubuntu 22)
339 pip3 install --user osmium
340 if: matrix.ubuntu == 22
342 - name: Install osmium (Ubuntu 24)
344 /home/nominatim/nominatim-venv/bin/pip install osmium
345 if: matrix.ubuntu == 24
349 nominatim replication --init
350 NOMINATIM_REPLICATION_MAX_DIFF=1 nominatim replication --once
351 working-directory: /home/nominatim/nominatim-project
353 - name: Clean up database
354 run: nominatim refresh --postcodes --word-tokens
355 working-directory: /home/nominatim/nominatim-project
357 - name: Run reverse-only import
359 echo 'NOMINATIM_DATABASE_DSN="pgsql:dbname=reverse"' >> .env
360 nominatim import --osm-file ../test.pbf --reverse-only --no-updates
361 working-directory: /home/nominatim/data-env-reverse
363 - name: Check reverse-only import
364 run: nominatim admin --check-database
365 working-directory: /home/nominatim/data-env-reverse
367 - name: Clean up database (reverse-only import)
368 run: nominatim refresh --postcodes --word-tokens
369 working-directory: /home/nominatim/nominatim-project
371 install-no-superuser:
372 runs-on: ubuntu-latest
373 needs: create-archive
376 - uses: actions/download-artifact@v4
380 - name: Unpack Nominatim
381 run: tar xf nominatim-src.tar.bz2
383 - uses: ./Nominatim/.github/actions/setup-postgresql
385 postgresql-version: 16
388 - uses: ./Nominatim/.github/actions/build-nominatim
393 - name: Prepare import environment
395 mv Nominatim/test/testdb/apidb-test-data.pbf test.pbf
398 - name: Prepare Database
400 nominatim import --prepare-database
402 - name: Create import user
404 sudo -u postgres createuser osm-import
405 psql -d nominatim -c "ALTER USER \"osm-import\" WITH PASSWORD 'osm-import'"
406 psql -d nominatim -c 'GRANT CREATE ON SCHEMA public TO "osm-import"'
410 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
412 - name: Check full import
413 run: nominatim admin --check-database
416 runs-on: ubuntu-latest
418 - uses: codespell-project/actions-codespell@v2