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 flake8
107 run: pip3 install -U flake8
108 if: matrix.flavour == 'ubuntu-22'
110 - name: Python linting
111 run: python3 -m flake8 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 export PATH=$GITHUB_WORKSPACE/build/osm2pgsql:$PATH
122 python3 -m behave -DREMOVE_TEMPLATE=1 --format=progress3
123 working-directory: Nominatim/test/bdd
125 - name: Install mypy and typechecking info
126 run: pip3 install -U mypy osmium uvicorn types-PyYAML types-jinja2 types-psycopg2 types-psutil types-requests types-ujson types-Pygments typing-extensions
127 if: matrix.flavour != 'oldstuff'
129 - name: Python static typechecking
130 run: python3 -m mypy --strict src
131 working-directory: Nominatim
132 if: matrix.flavour != 'oldstuff'
135 runs-on: ubuntu-latest
136 needs: create-archive
140 name: [Ubuntu-22, Ubuntu-24]
143 image: "ubuntu:22.04"
145 install_mode: install-apache
147 image: "ubuntu:24.04"
149 install_mode: install-apache
152 image: ${{ matrix.image }}
158 shell: sudo -Hu nominatim bash --noprofile --norc -eo pipefail {0}
161 - name: Prepare container (Ubuntu)
163 export APT_LISTCHANGES_FRONTEND=none
164 export DEBIAN_FRONTEND=noninteractive
166 apt-get install -y git sudo wget
167 ln -snf /usr/share/zoneinfo/$CONTAINER_TIMEZONE /etc/localtime && echo $CONTAINER_TIMEZONE > /etc/timezone
170 - name: Setup import user
173 echo 'nominatim ALL=(ALL:ALL) NOPASSWD: ALL' > /etc/sudoers.d/nominiatim
174 echo "/home/nominatim/Nominatim/vagrant/Install-on-${OS}.sh no $INSTALL_MODE" > /home/nominatim/vagrant.sh
177 OS: ${{ matrix.name }}
178 INSTALL_MODE: ${{ matrix.install_mode }}
180 - uses: actions/download-artifact@v4
183 path: /home/nominatim
185 - name: Install Nominatim
187 export USERNAME=nominatim
188 export USERHOME=/home/nominatim
190 export HAVE_SELINUX=no
191 tar xf nominatim-src.tar.bz2
193 working-directory: /home/nominatim
195 - name: Prepare import environment
197 mv Nominatim/test/testdb/apidb-test-data.pbf test.pbf
198 mv Nominatim/settings/flex-base.lua flex-base.lua
199 mv Nominatim/settings/import-extratags.lua import-extratags.lua
200 mv Nominatim/settings/taginfo.lua taginfo.lua
202 mkdir data-env-reverse
203 working-directory: /home/nominatim
205 - name: Add nominatim to path
207 sudo ln -s /home/nominatim/nominatim-venv/bin/nominatim /usr/local/bin/nominatim
208 if: matrix.ubuntu == 24
210 - name: Need lua binary
212 sudo apt-get install -y lua5.4 lua-dkjson
213 if: matrix.ubuntu == 24
215 - name: Print version
216 run: nominatim --version
217 working-directory: /home/nominatim/nominatim-project
219 - name: Print taginfo
221 working-directory: /home/nominatim
223 - name: Collect host OS information
224 run: nominatim admin --collect-os-info
225 working-directory: /home/nominatim/nominatim-project
228 run: nominatim import --osm-file ../test.pbf
229 working-directory: /home/nominatim/nominatim-project
231 - name: Import special phrases
232 run: nominatim special-phrases --import-from-wiki
233 working-directory: /home/nominatim/nominatim-project
235 - name: Check full import
236 run: nominatim admin --check-database
237 working-directory: /home/nominatim/nominatim-project
239 - name: Warm up database
240 run: nominatim admin --warm
241 working-directory: /home/nominatim/nominatim-project
243 - name: Prepare update (Ubuntu)
244 run: apt-get install -y python3-pip
247 - name: Install osmium (Ubuntu 22)
249 pip3 install --user osmium
250 if: matrix.ubuntu == 22
252 - name: Install osmium (Ubuntu 24)
254 /home/nominatim/nominatim-venv/bin/pip install osmium
255 if: matrix.ubuntu == 24
259 nominatim replication --init
260 NOMINATIM_REPLICATION_MAX_DIFF=1 nominatim replication --once
261 working-directory: /home/nominatim/nominatim-project
263 - name: Clean up database
264 run: nominatim refresh --postcodes --word-tokens
265 working-directory: /home/nominatim/nominatim-project
267 - name: Run reverse-only import
269 echo 'NOMINATIM_DATABASE_DSN="pgsql:dbname=reverse"' >> .env
270 nominatim import --osm-file ../test.pbf --reverse-only --no-updates
271 working-directory: /home/nominatim/data-env-reverse
273 - name: Check reverse-only import
274 run: nominatim admin --check-database
275 working-directory: /home/nominatim/data-env-reverse
277 - name: Clean up database (reverse-only import)
278 run: nominatim refresh --postcodes --word-tokens
279 working-directory: /home/nominatim/nominatim-project
281 install-no-superuser:
282 runs-on: ubuntu-latest
283 needs: create-archive
286 - uses: actions/download-artifact@v4
290 - name: Unpack Nominatim
291 run: tar xf nominatim-src.tar.bz2
293 - uses: ./Nominatim/.github/actions/setup-postgresql
295 postgresql-version: 16
298 - uses: ./Nominatim/.github/actions/build-nominatim
303 - name: Prepare import environment
305 mv Nominatim/test/testdb/apidb-test-data.pbf test.pbf
308 - name: Prepare Database
310 nominatim import --prepare-database
312 - name: Create import user
314 sudo -u postgres createuser osm-import
315 psql -d nominatim -c "ALTER USER \"osm-import\" WITH PASSWORD 'osm-import'"
316 psql -d nominatim -c 'GRANT CREATE ON SCHEMA public TO "osm-import"'
320 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
322 - name: Check full import
323 run: nominatim admin --check-database
326 runs-on: ubuntu-24.04
327 needs: create-archive
330 - uses: actions/download-artifact@v4
334 - name: Unpack Nominatim
335 run: tar xf nominatim-src.tar.bz2
337 - uses: ./Nominatim/.github/actions/setup-postgresql
339 postgresql-version: 17
342 - name: Install Python dependencies
344 sudo apt-get install --no-install-recommends virtualenv osm2pgsql
346 - name: Install Nominatim master version
350 ../master/bin/pip install packaging/nominatim-db
352 - name: Install Nominatim from pypi
355 ./release/bin/pip install nominatim-db
357 - name: Import Nominatim database using release
359 ./release/bin/nominatim import --osm-file Nominatim/test/testdb/apidb-test-data.pbf
360 ./release/bin/nominatim add-data --file Nominatim/test/testdb/additional_api_test.data.osm
362 - name: Migrate to master version
364 ./master/bin/nominatim admin --migrate
365 ./release/bin/nominatim add-data --file Nominatim/test/testdb/additional_api_test.data.osm
368 runs-on: ubuntu-latest
370 - uses: codespell-project/actions-codespell@v2