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: ./Nominatim/.github/actions/setup-postgresql
65 postgresql-version: ${{ matrix.postgresql }}
67 - uses: ./Nominatim/.github/actions/build-nominatim
69 dependencies: ${{ matrix.dependencies }}
71 - name: Compile osm2pgsql
73 sudo apt-get install -y -qq libboost-system-dev libboost-filesystem-dev libexpat1-dev zlib1g-dev libbz2-dev libpq-dev libproj-dev libicu-dev liblua${LUA_VERSION}-dev lua-dkjson nlohmann-json3-dev
76 git clone https://github.com/osm2pgsql-dev/osm2pgsql
83 rm -rf osm2pgsql-build
84 if: matrix.ubuntu == '20'
86 LUA_VERSION: ${{ matrix.lua }}
88 - name: Install test prerequisites
89 run: ./venv/bin/pip install behave==1.2.6
91 - name: Install test prerequisites (apt)
92 run: sudo apt-get install -y -qq python3-pytest python3-pytest-asyncio uvicorn python3-falcon python3-aiosqlite python3-pyosmium
93 if: matrix.dependencies == 'apt'
95 - name: Install test prerequisites (pip)
96 run: ./venv/bin/pip install pytest-asyncio falcon starlette asgi_lifespan aiosqlite osmium uvicorn
97 if: matrix.dependencies == 'pip'
99 - name: Install latest flake8
100 run: ./venv/bin/pip install -U flake8
102 - name: Python linting
103 run: ../venv/bin/python -m flake8 src
104 working-directory: Nominatim
106 - name: Install mypy and typechecking info
107 run: ./venv/bin/pip install -U mypy types-PyYAML types-jinja2 types-psutil types-requests types-ujson types-Pygments typing-extensions
108 if: matrix.dependencies == 'pip'
110 - name: Python static typechecking
111 run: ../venv/bin/python -m mypy --strict --python-version 3.8 src
112 working-directory: Nominatim
113 if: matrix.dependencies == 'pip'
115 - name: Python unit tests
116 run: ../venv/bin/python -m pytest test/python
117 working-directory: Nominatim
121 ../../../venv/bin/python -m behave -DREMOVE_TEMPLATE=1 --format=progress3
122 working-directory: Nominatim/test/bdd
125 runs-on: ubuntu-latest
126 needs: create-archive
130 name: [Ubuntu-22, Ubuntu-24]
133 image: "ubuntu:22.04"
135 install_mode: install-apache
137 image: "ubuntu:24.04"
139 install_mode: install-apache
142 image: ${{ matrix.image }}
148 shell: sudo -Hu nominatim bash --noprofile --norc -eo pipefail {0}
151 - name: Prepare container (Ubuntu)
153 export APT_LISTCHANGES_FRONTEND=none
154 export DEBIAN_FRONTEND=noninteractive
156 apt-get install -y git sudo wget
157 ln -snf /usr/share/zoneinfo/$CONTAINER_TIMEZONE /etc/localtime && echo $CONTAINER_TIMEZONE > /etc/timezone
160 - name: Setup import user
163 echo 'nominatim ALL=(ALL:ALL) NOPASSWD: ALL' > /etc/sudoers.d/nominiatim
164 echo "/home/nominatim/Nominatim/vagrant/Install-on-${OS}.sh no $INSTALL_MODE" > /home/nominatim/vagrant.sh
167 OS: ${{ matrix.name }}
168 INSTALL_MODE: ${{ matrix.install_mode }}
170 - uses: actions/download-artifact@v4
173 path: /home/nominatim
175 - name: Install Nominatim
177 export USERNAME=nominatim
178 export USERHOME=/home/nominatim
180 export HAVE_SELINUX=no
181 tar xf nominatim-src.tar.bz2
183 working-directory: /home/nominatim
185 - name: Prepare import environment
187 mv Nominatim/test/testdb/apidb-test-data.pbf test.pbf
188 mv Nominatim/settings/flex-base.lua flex-base.lua
189 mv Nominatim/settings/import-extratags.lua import-extratags.lua
190 mv Nominatim/settings/taginfo.lua taginfo.lua
192 mkdir data-env-reverse
193 working-directory: /home/nominatim
195 - name: Add nominatim to path
197 sudo ln -s /home/nominatim/nominatim-venv/bin/nominatim /usr/local/bin/nominatim
199 - name: Need lua binary
201 sudo apt-get install -y lua5.4 lua-dkjson
203 - name: Print version
204 run: nominatim --version
205 working-directory: /home/nominatim/nominatim-project
207 - name: Print taginfo
209 working-directory: /home/nominatim
211 - name: Collect host OS information
212 run: nominatim admin --collect-os-info
213 working-directory: /home/nominatim/nominatim-project
216 run: nominatim import --osm-file ../test.pbf
217 working-directory: /home/nominatim/nominatim-project
219 - name: Import special phrases
220 run: nominatim special-phrases --import-from-wiki
221 working-directory: /home/nominatim/nominatim-project
223 - name: Check full import
224 run: nominatim admin --check-database
225 working-directory: /home/nominatim/nominatim-project
227 - name: Warm up database
228 run: nominatim admin --warm
229 working-directory: /home/nominatim/nominatim-project
231 - name: Install osmium
233 /home/nominatim/nominatim-venv/bin/pip install osmium
237 nominatim replication --init
238 NOMINATIM_REPLICATION_MAX_DIFF=1 nominatim replication --once
239 working-directory: /home/nominatim/nominatim-project
241 - name: Clean up database
242 run: nominatim refresh --postcodes --word-tokens
243 working-directory: /home/nominatim/nominatim-project
245 - name: Run reverse-only import
247 echo 'NOMINATIM_DATABASE_DSN="pgsql:dbname=reverse"' >> .env
248 nominatim import --osm-file ../test.pbf --reverse-only --no-updates
249 working-directory: /home/nominatim/data-env-reverse
251 - name: Check reverse-only import
252 run: nominatim admin --check-database
253 working-directory: /home/nominatim/data-env-reverse
255 - name: Clean up database (reverse-only import)
256 run: nominatim refresh --postcodes --word-tokens
257 working-directory: /home/nominatim/nominatim-project
259 install-no-superuser:
260 runs-on: ubuntu-24.04
261 needs: create-archive
264 - uses: actions/download-artifact@v4
268 - name: Unpack Nominatim
269 run: tar xf nominatim-src.tar.bz2
271 - uses: ./Nominatim/.github/actions/setup-postgresql
273 postgresql-version: 16
275 - uses: ./Nominatim/.github/actions/build-nominatim
277 - name: Prepare import environment
279 mv Nominatim/test/testdb/apidb-test-data.pbf test.pbf
282 - name: Prepare Database
284 ./venv/bin/nominatim import --prepare-database
286 - name: Create import user
288 sudo -u postgres createuser osm-import
289 psql -d nominatim -c "ALTER USER \"osm-import\" WITH PASSWORD 'osm-import'"
290 psql -d nominatim -c 'GRANT CREATE ON SCHEMA public TO "osm-import"'
294 NOMINATIM_DATABASE_DSN="pgsql:host=127.0.0.1;dbname=nominatim;user=osm-import;password=osm-import" ./venv/bin/nominatim import --continue import-from-file --osm-file test.pbf
296 - name: Check full import
297 run: ./venv/bin/nominatim admin --check-database
300 runs-on: ubuntu-24.04
301 needs: create-archive
304 - uses: actions/download-artifact@v4
308 - name: Unpack Nominatim
309 run: tar xf nominatim-src.tar.bz2
311 - uses: ./Nominatim/.github/actions/setup-postgresql
313 postgresql-version: 17
315 - name: Install Python dependencies
317 sudo apt-get install --no-install-recommends virtualenv osm2pgsql
319 - name: Install Nominatim master version
323 ../master/bin/pip install packaging/nominatim-db
325 - name: Install Nominatim from pypi
328 ./release/bin/pip install nominatim-db
330 - name: Import Nominatim database using release
332 ./release/bin/nominatim import --osm-file Nominatim/test/testdb/apidb-test-data.pbf
333 ./release/bin/nominatim add-data --file Nominatim/test/testdb/additional_api_test.data.osm
335 - name: Migrate to master version
337 ./master/bin/nominatim admin --migrate
338 ./release/bin/nominatim add-data --file Nominatim/test/testdb/additional_api_test.data.osm
341 runs-on: ubuntu-latest
343 - uses: codespell-project/actions-codespell@v2