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: ["ubuntu-20", "ubuntu-24"]
53 runs-on: ubuntu-${{ matrix.ubuntu }}.04
56 - uses: actions/download-artifact@v4
60 - name: Unpack Nominatim
61 run: tar xf nominatim-src.tar.bz2
63 - uses: actions/setup-python@v5
66 if: matrix.flavour == 'oldstuff'
68 - uses: ./Nominatim/.github/actions/setup-postgresql
70 postgresql-version: ${{ matrix.postgresql }}
71 postgis-version: ${{ matrix.postgis }}
73 - uses: ./Nominatim/.github/actions/build-nominatim
75 flavour: ${{ matrix.flavour }}
76 lua: ${{ matrix.lua }}
78 - name: Install test prerequisites
79 run: pip3 install behave==1.2.6
81 - name: Install test prerequisites
82 run: sudo apt-get install -y -qq python3-pytest python3-pytest-asyncio uvicorn
84 - name: Install newer pytest-asyncio
85 run: pip3 install -U pytest-asyncio
86 if: matrix.flavour == 'ubuntu-20'
88 - name: Install Python webservers
89 run: pip3 install falcon starlette asgi_lifespan
91 - name: Install latest flake8
92 run: pip3 install -U flake8
94 - name: Python linting
95 run: python3 -m flake8 src
96 working-directory: Nominatim
98 - name: Python unit tests
99 run: python3 -m pytest test/python
100 working-directory: Nominatim
104 export PATH=$GITHUB_WORKSPACE/build/osm2pgsql:$PATH
105 python3 -m behave -DREMOVE_TEMPLATE=1 --format=progress3
106 working-directory: Nominatim/test/bdd
108 - name: Install mypy and typechecking info
109 run: pip3 install -U mypy osmium uvicorn types-PyYAML types-jinja2 types-psycopg2 types-psutil types-requests types-ujson types-Pygments typing-extensions
111 - name: Python static typechecking
112 run: python3 -m mypy --strict --python-version 3.8 src
113 working-directory: Nominatim
116 runs-on: ubuntu-latest
117 needs: create-archive
121 name: [Ubuntu-22, Ubuntu-24]
124 image: "ubuntu:22.04"
126 install_mode: install-apache
128 image: "ubuntu:24.04"
130 install_mode: install-apache
133 image: ${{ matrix.image }}
139 shell: sudo -Hu nominatim bash --noprofile --norc -eo pipefail {0}
142 - name: Prepare container (Ubuntu)
144 export APT_LISTCHANGES_FRONTEND=none
145 export DEBIAN_FRONTEND=noninteractive
147 apt-get install -y git sudo wget
148 ln -snf /usr/share/zoneinfo/$CONTAINER_TIMEZONE /etc/localtime && echo $CONTAINER_TIMEZONE > /etc/timezone
151 - name: Setup import user
154 echo 'nominatim ALL=(ALL:ALL) NOPASSWD: ALL' > /etc/sudoers.d/nominiatim
155 echo "/home/nominatim/Nominatim/vagrant/Install-on-${OS}.sh no $INSTALL_MODE" > /home/nominatim/vagrant.sh
158 OS: ${{ matrix.name }}
159 INSTALL_MODE: ${{ matrix.install_mode }}
161 - uses: actions/download-artifact@v4
164 path: /home/nominatim
166 - name: Install Nominatim
168 export USERNAME=nominatim
169 export USERHOME=/home/nominatim
171 export HAVE_SELINUX=no
172 tar xf nominatim-src.tar.bz2
174 working-directory: /home/nominatim
176 - name: Prepare import environment
178 mv Nominatim/test/testdb/apidb-test-data.pbf test.pbf
179 mv Nominatim/settings/flex-base.lua flex-base.lua
180 mv Nominatim/settings/import-extratags.lua import-extratags.lua
181 mv Nominatim/settings/taginfo.lua taginfo.lua
183 mkdir data-env-reverse
184 working-directory: /home/nominatim
186 - name: Add nominatim to path
188 sudo ln -s /home/nominatim/nominatim-venv/bin/nominatim /usr/local/bin/nominatim
189 if: matrix.ubuntu == 24
191 - name: Need lua binary
193 sudo apt-get install -y lua5.4 lua-dkjson
194 if: matrix.ubuntu == 24
196 - name: Print version
197 run: nominatim --version
198 working-directory: /home/nominatim/nominatim-project
200 - name: Print taginfo
202 working-directory: /home/nominatim
204 - name: Collect host OS information
205 run: nominatim admin --collect-os-info
206 working-directory: /home/nominatim/nominatim-project
209 run: nominatim import --osm-file ../test.pbf
210 working-directory: /home/nominatim/nominatim-project
212 - name: Import special phrases
213 run: nominatim special-phrases --import-from-wiki
214 working-directory: /home/nominatim/nominatim-project
216 - name: Check full import
217 run: nominatim admin --check-database
218 working-directory: /home/nominatim/nominatim-project
220 - name: Warm up database
221 run: nominatim admin --warm
222 working-directory: /home/nominatim/nominatim-project
224 - name: Prepare update (Ubuntu)
225 run: apt-get install -y python3-pip
228 - name: Install osmium (Ubuntu 22)
230 pip3 install --user osmium
231 if: matrix.ubuntu == 22
233 - name: Install osmium (Ubuntu 24)
235 /home/nominatim/nominatim-venv/bin/pip install osmium
236 if: matrix.ubuntu == 24
240 nominatim replication --init
241 NOMINATIM_REPLICATION_MAX_DIFF=1 nominatim replication --once
242 working-directory: /home/nominatim/nominatim-project
244 - name: Clean up database
245 run: nominatim refresh --postcodes --word-tokens
246 working-directory: /home/nominatim/nominatim-project
248 - name: Run reverse-only import
250 echo 'NOMINATIM_DATABASE_DSN="pgsql:dbname=reverse"' >> .env
251 nominatim import --osm-file ../test.pbf --reverse-only --no-updates
252 working-directory: /home/nominatim/data-env-reverse
254 - name: Check reverse-only import
255 run: nominatim admin --check-database
256 working-directory: /home/nominatim/data-env-reverse
258 - name: Clean up database (reverse-only import)
259 run: nominatim refresh --postcodes --word-tokens
260 working-directory: /home/nominatim/nominatim-project
262 install-no-superuser:
263 runs-on: ubuntu-latest
264 needs: create-archive
267 - uses: actions/download-artifact@v4
271 - name: Unpack Nominatim
272 run: tar xf nominatim-src.tar.bz2
274 - uses: ./Nominatim/.github/actions/setup-postgresql
276 postgresql-version: 16
279 - uses: ./Nominatim/.github/actions/build-nominatim
284 - name: Prepare import environment
286 mv Nominatim/test/testdb/apidb-test-data.pbf test.pbf
289 - name: Prepare Database
291 nominatim import --prepare-database
293 - name: Create import user
295 sudo -u postgres createuser osm-import
296 psql -d nominatim -c "ALTER USER \"osm-import\" WITH PASSWORD 'osm-import'"
297 psql -d nominatim -c 'GRANT CREATE ON SCHEMA public TO "osm-import"'
301 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
303 - name: Check full import
304 run: nominatim admin --check-database
307 runs-on: ubuntu-24.04
308 needs: create-archive
311 - uses: actions/download-artifact@v4
315 - name: Unpack Nominatim
316 run: tar xf nominatim-src.tar.bz2
318 - uses: ./Nominatim/.github/actions/setup-postgresql
320 postgresql-version: 17
323 - name: Install Python dependencies
325 sudo apt-get install --no-install-recommends virtualenv osm2pgsql
327 - name: Install Nominatim master version
331 ../master/bin/pip install packaging/nominatim-db
333 - name: Install Nominatim from pypi
336 ./release/bin/pip install nominatim-db
338 - name: Import Nominatim database using release
340 ./release/bin/nominatim import --osm-file Nominatim/test/testdb/apidb-test-data.pbf
341 ./release/bin/nominatim add-data --file Nominatim/test/testdb/additional_api_test.data.osm
343 - name: Migrate to master version
345 ./master/bin/nominatim admin --migrate
346 ./release/bin/nominatim add-data --file Nominatim/test/testdb/additional_api_test.data.osm
349 runs-on: ubuntu-latest
351 - uses: codespell-project/actions-codespell@v2