3 on: [ push, pull_request ]
10 - uses: actions/checkout@v4
14 - uses: actions/cache@v3
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@v3
33 path: nominatim-src.tar.bz2
40 flavour: [oldstuff, "ubuntu-20", "ubuntu-22"]
61 runs-on: ubuntu-${{ matrix.ubuntu }}.04
64 - uses: actions/download-artifact@v3
68 - name: Unpack Nominatim
69 run: tar xf nominatim-src.tar.bz2
72 uses: shivammathur/setup-php@v2
74 php-version: ${{ matrix.php }}
75 tools: phpunit:9, phpcs, composer
76 ini-values: opcache.jit=disable
78 GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
80 - uses: actions/setup-python@v4
83 if: matrix.flavour == 'oldstuff'
85 - uses: ./Nominatim/.github/actions/setup-postgresql
87 postgresql-version: ${{ matrix.postgresql }}
88 postgis-version: ${{ matrix.postgis }}
90 - uses: ./Nominatim/.github/actions/build-nominatim
92 flavour: ${{ matrix.flavour }}
93 lua: ${{ matrix.lua }}
95 - name: Install test prerequsites (behave from apt)
96 run: sudo apt-get install -y -qq python3-behave
97 if: matrix.flavour == 'ubuntu-20'
99 - name: Install test prerequsites (behave from pip)
100 run: pip3 install behave==1.2.6
101 if: (matrix.flavour == 'oldstuff') || (matrix.flavour == 'ubuntu-22')
103 - name: Install test prerequsites (from apt for Ununtu 2x)
104 run: sudo apt-get install -y -qq python3-pytest python3-pytest-asyncio uvicorn
105 if: matrix.flavour != 'oldstuff'
107 - name: Install newer pytest-asyncio
108 run: pip3 install -U pytest-asyncio==0.21.1
109 if: matrix.flavour == 'ubuntu-20'
111 - name: Install test prerequsites (from pip for Ubuntu 18)
112 run: pip3 install pytest pytest-asyncio uvicorn
113 if: matrix.flavour == 'oldstuff'
115 - name: Install Python webservers
116 run: pip3 install falcon starlette asgi_lifespan
118 - name: Install latest pylint
119 run: pip3 install -U pylint
120 if: matrix.flavour != 'oldstuff'
123 run: phpcs --report-width=120 .
124 working-directory: Nominatim
125 if: matrix.flavour != 'oldstuff'
127 - name: Python linting
128 run: python3 -m pylint nominatim
129 working-directory: Nominatim
130 if: matrix.flavour != 'oldstuff'
132 - name: PHP unit tests
134 working-directory: Nominatim/test/php
136 - name: Python unit tests
137 run: python3 -m pytest test/python
138 working-directory: Nominatim
142 python3 -m behave -DREMOVE_TEMPLATE=1 -DBUILDDIR=$GITHUB_WORKSPACE/build --format=progress3
143 working-directory: Nominatim/test/bdd
145 - name: Install mypy and typechecking info
146 run: pip3 install -U mypy osmium uvicorn types-PyYAML types-jinja2 types-psycopg2 types-psutil types-requests types-ujson types-Pygments typing-extensions
147 if: matrix.flavour != 'oldstuff'
149 - name: Python static typechecking
150 run: python3 -m mypy --strict nominatim
151 working-directory: Nominatim
152 if: matrix.flavour != 'oldstuff'
155 needs: create-archive
156 runs-on: ubuntu-20.04
159 - uses: actions/download-artifact@v3
163 - name: Unpack Nominatim
164 run: tar xf nominatim-src.tar.bz2
167 uses: shivammathur/setup-php@v2
171 - uses: ./Nominatim/.github/actions/setup-postgresql
173 postgresql-version: 13
176 - name: Install Postgresql server dev
177 run: sudo apt-get install postgresql-server-dev-13
179 - uses: ./Nominatim/.github/actions/build-nominatim
181 cmake-args: -DBUILD_MODULE=on
183 - name: Install test prerequsites
184 run: sudo apt-get install -y -qq python3-behave
186 - name: BDD tests (legacy tokenizer)
188 python3 -m behave -DREMOVE_TEMPLATE=1 -DBUILDDIR=$GITHUB_WORKSPACE/build -DTOKENIZER=legacy --format=progress3
189 working-directory: Nominatim/test/bdd
193 needs: create-archive
194 runs-on: ubuntu-22.04
197 - uses: actions/download-artifact@v3
201 - name: Unpack Nominatim
202 run: tar xf nominatim-src.tar.bz2
204 - uses: ./Nominatim/.github/actions/setup-postgresql
206 postgresql-version: 15
209 - uses: ./Nominatim/.github/actions/build-nominatim
213 - name: Install test prerequsites
214 run: sudo apt-get install -y -qq python3-behave
216 - name: Install Python webservers
217 run: pip3 install starlette asgi_lifespan httpx
219 - name: BDD tests (starlette)
221 python3 -m behave -DREMOVE_TEMPLATE=1 -DBUILDDIR=$GITHUB_WORKSPACE/build -DAPI_ENGINE=starlette --format=progress3
222 working-directory: Nominatim/test/bdd
226 runs-on: ubuntu-latest
227 needs: create-archive
231 name: [Ubuntu-20, Ubuntu-22]
234 image: "ubuntu:20.04"
236 install_mode: install-apache
238 image: "ubuntu:22.04"
240 install_mode: install-apache
243 image: ${{ matrix.image }}
249 shell: sudo -Hu nominatim bash --noprofile --norc -eo pipefail {0}
252 - name: Prepare container (Ubuntu)
254 export APT_LISTCHANGES_FRONTEND=none
255 export DEBIAN_FRONTEND=noninteractive
257 apt-get install -y git sudo wget
258 ln -snf /usr/share/zoneinfo/$CONTAINER_TIMEZONE /etc/localtime && echo $CONTAINER_TIMEZONE > /etc/timezone
261 - name: Setup import user
264 echo 'nominatim ALL=(ALL:ALL) NOPASSWD: ALL' > /etc/sudoers.d/nominiatim
265 echo "/home/nominatim/Nominatim/vagrant/Install-on-${OS}.sh no $INSTALL_MODE" > /home/nominatim/vagrant.sh
268 OS: ${{ matrix.name }}
269 INSTALL_MODE: ${{ matrix.install_mode }}
271 - uses: actions/download-artifact@v3
274 path: /home/nominatim
276 - name: Install Nominatim
278 export USERNAME=nominatim
279 export USERHOME=/home/nominatim
281 export HAVE_SELINUX=no
282 tar xf nominatim-src.tar.bz2
284 working-directory: /home/nominatim
286 - name: Prepare import environment
288 mv Nominatim/test/testdb/apidb-test-data.pbf test.pbf
289 mv Nominatim/settings/flex-base.lua flex-base.lua
290 mv Nominatim/settings/import-extratags.lua import-extratags.lua
291 mv Nominatim/settings/taginfo.lua taginfo.lua
293 mkdir data-env-reverse
294 working-directory: /home/nominatim
296 - name: Print version
297 run: nominatim --version
298 working-directory: /home/nominatim/nominatim-project
300 - name: Print taginfo
302 working-directory: /home/nominatim
304 - name: Collect host OS information
305 run: nominatim admin --collect-os-info
306 working-directory: /home/nominatim/nominatim-project
309 run: nominatim import --osm-file ../test.pbf
310 working-directory: /home/nominatim/nominatim-project
312 - name: Import special phrases
313 run: nominatim special-phrases --import-from-wiki
314 working-directory: /home/nominatim/nominatim-project
316 - name: Check full import
317 run: nominatim admin --check-database
318 working-directory: /home/nominatim/nominatim-project
320 - name: Warm up database
321 run: nominatim admin --warm
322 working-directory: /home/nominatim/nominatim-project
324 - name: Prepare update (Ubuntu)
325 run: apt-get install -y python3-pip
330 pip3 install --user osmium
331 nominatim replication --init
332 NOMINATIM_REPLICATION_MAX_DIFF=1 nominatim replication --once
333 working-directory: /home/nominatim/nominatim-project
335 - name: Clean up database
336 run: nominatim refresh --postcodes --word-tokens
337 working-directory: /home/nominatim/nominatim-project
339 - name: Run reverse-only import
341 echo 'NOMINATIM_DATABASE_DSN="pgsql:dbname=reverse"' >> .env
342 nominatim import --osm-file ../test.pbf --reverse-only --no-updates
343 working-directory: /home/nominatim/data-env-reverse
345 - name: Check reverse-only import
346 run: nominatim admin --check-database
347 working-directory: /home/nominatim/data-env-reverse
349 - name: Clean up database (reverse-only import)
350 run: nominatim refresh --postcodes --word-tokens
351 working-directory: /home/nominatim/nominatim-project
353 install-no-superuser:
354 runs-on: ubuntu-latest
355 needs: create-archive
362 image: "ubuntu:22.04"
364 install_mode: install-apache
367 image: ${{ matrix.image }}
373 shell: sudo -Hu nominatim bash --noprofile --norc -eo pipefail {0}
376 - name: Prepare container (Ubuntu)
378 export APT_LISTCHANGES_FRONTEND=none
379 export DEBIAN_FRONTEND=noninteractive
381 apt-get install -y git sudo wget
382 ln -snf /usr/share/zoneinfo/$CONTAINER_TIMEZONE /etc/localtime && echo $CONTAINER_TIMEZONE > /etc/timezone
385 - name: Setup import user
388 echo 'nominatim ALL=(ALL:ALL) NOPASSWD: ALL' > /etc/sudoers.d/nominiatim
389 echo "/home/nominatim/Nominatim/vagrant/Install-on-${OS}.sh no $INSTALL_MODE" > /home/nominatim/vagrant.sh
392 OS: ${{ matrix.name }}
393 INSTALL_MODE: ${{ matrix.install_mode }}
395 - uses: actions/download-artifact@v3
398 path: /home/nominatim
400 - name: Install Nominatim
402 export USERNAME=nominatim
403 export USERHOME=/home/nominatim
405 export HAVE_SELINUX=no
406 tar xf nominatim-src.tar.bz2
408 working-directory: /home/nominatim
410 - name: Prepare import environment
412 mv Nominatim/test/testdb/apidb-test-data.pbf test.pbf
413 mv Nominatim/settings/flex-base.lua flex-base.lua
414 mv Nominatim/settings/import-extratags.lua import-extratags.lua
415 mv Nominatim/settings/taginfo.lua taginfo.lua
417 mkdir data-env-reverse
418 working-directory: /home/nominatim
420 - name: Prepare Database
422 nominatim import --prepare-database
423 working-directory: /home/nominatim/nominatim-project
425 - name: Create import user
427 sudo -u postgres createuser -S osm-import -P osm-import
428 working-directory: /home/nominatim/nominatim-project
430 - name: Grant import user rights
432 sudo -u postgres psql -c "GRANT INSERT, UPDATE ON ALL TABLES IN SCHEMA public TO \"osm-import\";"
433 working-directory: /home/nominatim/nominatim-project
437 NOMINATIM_DATABASE_DSN="pgsql:dbname=nominatim;user=osm-import;password=osm-import" nominatim import --continue import-from-file --osm-file ../test.pbf
438 working-directory: /home/nominatim/nominatim-project
440 - name: Check full import
441 run: nominatim admin --check-database
442 working-directory: /home/nominatim/nominatim-project