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@v4
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 prerequsites (behave from apt)
84 run: sudo apt-get install -y -qq python3-behave
85 if: matrix.flavour == 'ubuntu-20'
87 - name: Install test prerequsites (behave from pip)
88 run: pip3 install behave==1.2.6
89 if: (matrix.flavour == 'oldstuff') || (matrix.flavour == 'ubuntu-22')
91 - name: Install test prerequsites (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==0.21.1
97 if: matrix.flavour == 'ubuntu-20'
99 - name: Install test prerequsites (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 != 'oldstuff'
110 - name: Python linting
111 run: python3 -m pylint nominatim
112 working-directory: Nominatim
113 if: matrix.flavour != 'oldstuff'
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 nominatim
130 working-directory: Nominatim
131 if: matrix.flavour != 'oldstuff'
134 needs: create-archive
135 runs-on: ubuntu-20.04
138 - uses: actions/download-artifact@v4
142 - name: Unpack Nominatim
143 run: tar xf nominatim-src.tar.bz2
146 uses: shivammathur/setup-php@v2
150 - uses: ./Nominatim/.github/actions/setup-postgresql
152 postgresql-version: 13
155 - name: Install Postgresql server dev
156 run: sudo apt-get install postgresql-server-dev-13
158 - uses: ./Nominatim/.github/actions/build-nominatim
160 cmake-args: -DBUILD_MODULE=on
162 - name: Install test prerequsites
163 run: sudo apt-get install -y -qq python3-behave
165 - name: BDD tests (legacy tokenizer)
167 python3 -m behave -DREMOVE_TEMPLATE=1 -DBUILDDIR=$GITHUB_WORKSPACE/build -DAPI_ENGINE=php -DTOKENIZER=legacy --format=progress3
168 working-directory: Nominatim/test/bdd
172 needs: create-archive
173 runs-on: ubuntu-22.04
176 - uses: actions/download-artifact@v4
180 - name: Unpack Nominatim
181 run: tar xf nominatim-src.tar.bz2
183 - uses: ./Nominatim/.github/actions/setup-postgresql
185 postgresql-version: 15
189 uses: shivammathur/setup-php@v2
192 tools: phpunit:9, phpcs, composer
193 ini-values: opcache.jit=disable
195 GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
198 run: phpcs --report-width=120 .
199 working-directory: Nominatim
201 - name: PHP unit tests
203 working-directory: Nominatim/test/php
205 - uses: ./Nominatim/.github/actions/build-nominatim
209 - name: Install test prerequsites
210 run: sudo apt-get install -y -qq python3-behave
212 - name: BDD tests (php)
214 python3 -m behave -DREMOVE_TEMPLATE=1 -DBUILDDIR=$GITHUB_WORKSPACE/build -DAPI_ENGINE=php --format=progress3
215 working-directory: Nominatim/test/bdd
219 runs-on: ubuntu-latest
220 needs: create-archive
224 name: [Ubuntu-20, Ubuntu-22]
227 image: "ubuntu:20.04"
229 install_mode: install-apache
231 image: "ubuntu:22.04"
233 install_mode: install-apache
236 image: ${{ matrix.image }}
242 shell: sudo -Hu nominatim bash --noprofile --norc -eo pipefail {0}
245 - name: Prepare container (Ubuntu)
247 export APT_LISTCHANGES_FRONTEND=none
248 export DEBIAN_FRONTEND=noninteractive
250 apt-get install -y git sudo wget
251 ln -snf /usr/share/zoneinfo/$CONTAINER_TIMEZONE /etc/localtime && echo $CONTAINER_TIMEZONE > /etc/timezone
254 - name: Setup import user
257 echo 'nominatim ALL=(ALL:ALL) NOPASSWD: ALL' > /etc/sudoers.d/nominiatim
258 echo "/home/nominatim/Nominatim/vagrant/Install-on-${OS}.sh no $INSTALL_MODE" > /home/nominatim/vagrant.sh
261 OS: ${{ matrix.name }}
262 INSTALL_MODE: ${{ matrix.install_mode }}
264 - uses: actions/download-artifact@v4
267 path: /home/nominatim
269 - name: Install Nominatim
271 export USERNAME=nominatim
272 export USERHOME=/home/nominatim
274 export HAVE_SELINUX=no
275 tar xf nominatim-src.tar.bz2
277 working-directory: /home/nominatim
279 - name: Prepare import environment
281 mv Nominatim/test/testdb/apidb-test-data.pbf test.pbf
282 mv Nominatim/settings/flex-base.lua flex-base.lua
283 mv Nominatim/settings/import-extratags.lua import-extratags.lua
284 mv Nominatim/settings/taginfo.lua taginfo.lua
286 mkdir data-env-reverse
287 working-directory: /home/nominatim
289 - name: Print version
290 run: nominatim --version
291 working-directory: /home/nominatim/nominatim-project
293 - name: Print taginfo
295 working-directory: /home/nominatim
297 - name: Collect host OS information
298 run: nominatim admin --collect-os-info
299 working-directory: /home/nominatim/nominatim-project
302 run: nominatim import --osm-file ../test.pbf
303 working-directory: /home/nominatim/nominatim-project
305 - name: Import special phrases
306 run: nominatim special-phrases --import-from-wiki
307 working-directory: /home/nominatim/nominatim-project
309 - name: Check full import
310 run: nominatim admin --check-database
311 working-directory: /home/nominatim/nominatim-project
313 - name: Warm up database
314 run: nominatim admin --warm
315 working-directory: /home/nominatim/nominatim-project
317 - name: Prepare update (Ubuntu)
318 run: apt-get install -y python3-pip
323 pip3 install --user osmium
324 nominatim replication --init
325 NOMINATIM_REPLICATION_MAX_DIFF=1 nominatim replication --once
326 working-directory: /home/nominatim/nominatim-project
328 - name: Clean up database
329 run: nominatim refresh --postcodes --word-tokens
330 working-directory: /home/nominatim/nominatim-project
332 - name: Run reverse-only import
334 echo 'NOMINATIM_DATABASE_DSN="pgsql:dbname=reverse"' >> .env
335 nominatim import --osm-file ../test.pbf --reverse-only --no-updates
336 working-directory: /home/nominatim/data-env-reverse
338 - name: Check reverse-only import
339 run: nominatim admin --check-database
340 working-directory: /home/nominatim/data-env-reverse
342 - name: Clean up database (reverse-only import)
343 run: nominatim refresh --postcodes --word-tokens
344 working-directory: /home/nominatim/nominatim-project
346 install-no-superuser:
347 runs-on: ubuntu-latest
348 needs: create-archive
351 - uses: actions/download-artifact@v4
355 - name: Unpack Nominatim
356 run: tar xf nominatim-src.tar.bz2
358 - uses: ./Nominatim/.github/actions/setup-postgresql
360 postgresql-version: 16
363 - uses: ./Nominatim/.github/actions/build-nominatim
368 - name: Prepare import environment
370 mv Nominatim/test/testdb/apidb-test-data.pbf test.pbf
373 - name: Prepare Database
375 nominatim import --prepare-database
377 - name: Create import user
379 sudo -u postgres createuser osm-import
380 psql -d nominatim -c "ALTER USER \"osm-import\" WITH PASSWORD 'osm-import'"
381 psql -d nominatim -c 'GRANT CREATE ON SCHEMA public TO "osm-import"'
385 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
387 - name: Check full import
388 run: nominatim admin --check-database
391 runs-on: ubuntu-latest
393 - uses: codespell-project/actions-codespell@v2