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
189 mkdir data-env-reverse
190 working-directory: /home/nominatim
192 - name: Add nominatim to path
194 sudo ln -s /home/nominatim/nominatim-venv/bin/nominatim /usr/local/bin/nominatim
196 - name: Need lua binary
198 sudo apt-get install -y lua5.4 lua-dkjson
200 - name: Print version
201 run: nominatim --version
202 working-directory: /home/nominatim/nominatim-project
204 - name: Print taginfo
205 run: lua ./nominatim-venv/lib/*/site-packages/nominatim_db/resources/lib-lua/taginfo.lua
206 working-directory: /home/nominatim
208 - name: Collect host OS information
209 run: nominatim admin --collect-os-info
210 working-directory: /home/nominatim/nominatim-project
213 run: nominatim import --osm-file ../test.pbf
214 working-directory: /home/nominatim/nominatim-project
216 - name: Import special phrases
217 run: nominatim special-phrases --import-from-wiki
218 working-directory: /home/nominatim/nominatim-project
220 - name: Check full import
221 run: nominatim admin --check-database
222 working-directory: /home/nominatim/nominatim-project
224 - name: Warm up database
225 run: nominatim admin --warm
226 working-directory: /home/nominatim/nominatim-project
228 - name: Install osmium
230 /home/nominatim/nominatim-venv/bin/pip install osmium
234 nominatim replication --init
235 NOMINATIM_REPLICATION_MAX_DIFF=1 nominatim replication --once
236 working-directory: /home/nominatim/nominatim-project
238 - name: Clean up database
239 run: nominatim refresh --postcodes --word-tokens
240 working-directory: /home/nominatim/nominatim-project
242 - name: Run reverse-only import
244 echo 'NOMINATIM_DATABASE_DSN="pgsql:dbname=reverse"' >> .env
245 nominatim import --osm-file ../test.pbf --reverse-only --no-updates
246 working-directory: /home/nominatim/data-env-reverse
248 - name: Check reverse-only import
249 run: nominatim admin --check-database
250 working-directory: /home/nominatim/data-env-reverse
252 - name: Clean up database (reverse-only import)
253 run: nominatim refresh --postcodes --word-tokens
254 working-directory: /home/nominatim/nominatim-project
256 install-no-superuser:
257 runs-on: ubuntu-24.04
258 needs: create-archive
261 - uses: actions/download-artifact@v4
265 - name: Unpack Nominatim
266 run: tar xf nominatim-src.tar.bz2
268 - uses: ./Nominatim/.github/actions/setup-postgresql
270 postgresql-version: 16
272 - uses: ./Nominatim/.github/actions/build-nominatim
274 - name: Prepare import environment
276 mv Nominatim/test/testdb/apidb-test-data.pbf test.pbf
279 - name: Prepare Database
281 ./venv/bin/nominatim import --prepare-database
283 - name: Create import user
285 sudo -u postgres createuser osm-import
286 psql -d nominatim -c "ALTER USER \"osm-import\" WITH PASSWORD 'osm-import'"
287 psql -d nominatim -c 'GRANT CREATE ON SCHEMA public TO "osm-import"'
291 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
293 - name: Check full import
294 run: ./venv/bin/nominatim admin --check-database
297 runs-on: ubuntu-24.04
298 needs: create-archive
301 - uses: actions/download-artifact@v4
305 - name: Unpack Nominatim
306 run: tar xf nominatim-src.tar.bz2
308 - uses: ./Nominatim/.github/actions/setup-postgresql
310 postgresql-version: 17
312 - name: Install Python dependencies
314 sudo apt-get install --no-install-recommends virtualenv osm2pgsql
316 - name: Install Nominatim master version
320 ../master/bin/pip install packaging/nominatim-db
322 - name: Install Nominatim from pypi
325 ./release/bin/pip install nominatim-db
327 - name: Import Nominatim database using release
329 ./release/bin/nominatim import --osm-file Nominatim/test/testdb/apidb-test-data.pbf
330 ./release/bin/nominatim add-data --file Nominatim/test/testdb/additional_api_test.data.osm
332 - name: Migrate to master version
334 ./master/bin/nominatim admin --migrate
335 ./release/bin/nominatim add-data --file Nominatim/test/testdb/additional_api_test.data.osm
338 runs-on: ubuntu-latest
340 - uses: codespell-project/actions-codespell@v2