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
308 - name: Prepare Database
310 nominatim import --prepare-database
311 working-directory: /home/nominatim/nominatim-project
313 - name: Create import user
315 sudo -u postgres createuser -S osm-import -P osm-import
316 working-directory: /home/nominatim/nominatim-project
318 - name: Grant import user rights
320 sudo -u postgres psql -c "GRANT INSERT, UPDATE ON ALL TABLES IN SCHEMA public TO \"osm-import\";"
321 working-directory: /home/nominatim/nominatim-project
325 NOMINATIM_DATABASE_DSN="pgsql:dbname=nominatim;user=osm-import;password=osm-import" nominatim import --continue import-from-file --osm-file ../test.pbf
326 working-directory: /home/nominatim/nominatim-project
328 - name: Import special phrases
329 run: nominatim special-phrases --import-from-wiki
330 working-directory: /home/nominatim/nominatim-project
332 - name: Check full import
333 run: nominatim admin --check-database
334 working-directory: /home/nominatim/nominatim-project
336 - name: Warm up database
337 run: nominatim admin --warm
338 working-directory: /home/nominatim/nominatim-project
340 - name: Prepare update (Ubuntu)
341 run: apt-get install -y python3-pip
346 pip3 install --user osmium
347 nominatim replication --init
348 NOMINATIM_REPLICATION_MAX_DIFF=1 nominatim replication --once
349 working-directory: /home/nominatim/nominatim-project
351 - name: Clean up database
352 run: nominatim refresh --postcodes --word-tokens
353 working-directory: /home/nominatim/nominatim-project
355 - name: Run reverse-only import
357 echo 'NOMINATIM_DATABASE_DSN="pgsql:dbname=reverse"' >> .env
358 nominatim import --osm-file ../test.pbf --reverse-only --no-updates
359 working-directory: /home/nominatim/data-env-reverse
361 - name: Check reverse-only import
362 run: nominatim admin --check-database
363 working-directory: /home/nominatim/data-env-reverse
365 - name: Clean up database (reverse-only import)
366 run: nominatim refresh --postcodes --word-tokens
367 working-directory: /home/nominatim/nominatim-project