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
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
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 prerequsites
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 prerequsites
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-20, Ubuntu-22]
233 image: "ubuntu:20.04"
235 install_mode: install-apache
237 image: "ubuntu:22.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: Print version
296 run: nominatim --version
297 working-directory: /home/nominatim/nominatim-project
299 - name: Print taginfo
301 working-directory: /home/nominatim
303 - name: Collect host OS information
304 run: nominatim admin --collect-os-info
305 working-directory: /home/nominatim/nominatim-project
308 run: nominatim import --osm-file ../test.pbf
309 working-directory: /home/nominatim/nominatim-project
311 - name: Import special phrases
312 run: nominatim special-phrases --import-from-wiki
313 working-directory: /home/nominatim/nominatim-project
315 - name: Check full import
316 run: nominatim admin --check-database
317 working-directory: /home/nominatim/nominatim-project
319 - name: Warm up database
320 run: nominatim admin --warm
321 working-directory: /home/nominatim/nominatim-project
323 - name: Prepare update (Ubuntu)
324 run: apt-get install -y python3-pip
329 pip3 install --user osmium
330 nominatim replication --init
331 NOMINATIM_REPLICATION_MAX_DIFF=1 nominatim replication --once
332 working-directory: /home/nominatim/nominatim-project
334 - name: Clean up database
335 run: nominatim refresh --postcodes --word-tokens
336 working-directory: /home/nominatim/nominatim-project
338 - name: Run reverse-only import
340 echo 'NOMINATIM_DATABASE_DSN="pgsql:dbname=reverse"' >> .env
341 nominatim import --osm-file ../test.pbf --reverse-only --no-updates
342 working-directory: /home/nominatim/data-env-reverse
344 - name: Check reverse-only import
345 run: nominatim admin --check-database
346 working-directory: /home/nominatim/data-env-reverse
348 - name: Clean up database (reverse-only import)
349 run: nominatim refresh --postcodes --word-tokens
350 working-directory: /home/nominatim/nominatim-project
352 install-no-superuser:
353 runs-on: ubuntu-latest
354 needs: create-archive
357 - uses: actions/download-artifact@v4
361 - name: Unpack Nominatim
362 run: tar xf nominatim-src.tar.bz2
364 - uses: ./Nominatim/.github/actions/setup-postgresql
366 postgresql-version: 16
369 - uses: ./Nominatim/.github/actions/build-nominatim
374 - name: Prepare import environment
376 mv Nominatim/test/testdb/apidb-test-data.pbf test.pbf
379 - name: Prepare Database
381 nominatim import --prepare-database
383 - name: Create import user
385 sudo -u postgres createuser osm-import
386 psql -d nominatim -c "ALTER USER \"osm-import\" WITH PASSWORD 'osm-import'"
387 psql -d nominatim -c 'GRANT CREATE ON SCHEMA public TO "osm-import"'
391 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
393 - name: Check full import
394 run: nominatim admin --check-database
397 runs-on: ubuntu-latest
399 - uses: codespell-project/actions-codespell@v2