3 on: [ push, pull_request ]
10 - uses: actions/checkout@v3
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
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 sanic sanic-testing sanic-cors starlette
118 - name: Install latest pylint
119 run: pip3 install -U pylint asgi_lifespan
122 run: phpcs --report-width=120 .
123 working-directory: Nominatim
125 - name: Python linting
126 run: python3 -m pylint nominatim
127 working-directory: Nominatim
129 - name: PHP unit tests
131 working-directory: Nominatim/test/php
133 - name: Python unit tests
134 run: python3 -m pytest test/python
135 working-directory: Nominatim
139 python3 -m behave -DREMOVE_TEMPLATE=1 -DBUILDDIR=$GITHUB_WORKSPACE/build --format=progress3
140 working-directory: Nominatim/test/bdd
142 - name: Install mypy and typechecking info
143 run: pip3 install -U mypy osmium uvicorn types-PyYAML types-jinja2 types-psycopg2 types-psutil types-requests types-ujson types-Pygments typing-extensions
144 if: matrix.flavour != 'oldstuff'
146 - name: Python static typechecking
147 run: python3 -m mypy --strict nominatim
148 working-directory: Nominatim
149 if: matrix.flavour != 'oldstuff'
152 needs: create-archive
153 runs-on: ubuntu-20.04
156 - uses: actions/download-artifact@v3
160 - name: Unpack Nominatim
161 run: tar xf nominatim-src.tar.bz2
164 uses: shivammathur/setup-php@v2
168 - uses: ./Nominatim/.github/actions/setup-postgresql
170 postgresql-version: 13
173 - name: Install Postgresql server dev
174 run: sudo apt-get install postgresql-server-dev-13
176 - uses: ./Nominatim/.github/actions/build-nominatim
178 cmake-args: -DBUILD_MODULE=on
180 - name: Install test prerequsites
181 run: sudo apt-get install -y -qq python3-behave
183 - name: BDD tests (legacy tokenizer)
185 python3 -m behave -DREMOVE_TEMPLATE=1 -DBUILDDIR=$GITHUB_WORKSPACE/build -DTOKENIZER=legacy --format=progress3
186 working-directory: Nominatim/test/bdd
190 runs-on: ubuntu-latest
191 needs: create-archive
195 name: [Ubuntu-20, Ubuntu-22]
198 image: "ubuntu:20.04"
200 install_mode: install-apache
202 image: "ubuntu:22.04"
204 install_mode: install-apache
207 image: ${{ matrix.image }}
213 shell: sudo -Hu nominatim bash --noprofile --norc -eo pipefail {0}
216 - name: Prepare container (Ubuntu)
218 export APT_LISTCHANGES_FRONTEND=none
219 export DEBIAN_FRONTEND=noninteractive
221 apt-get install -y git sudo wget
222 ln -snf /usr/share/zoneinfo/$CONTAINER_TIMEZONE /etc/localtime && echo $CONTAINER_TIMEZONE > /etc/timezone
225 - name: Setup import user
228 echo 'nominatim ALL=(ALL:ALL) NOPASSWD: ALL' > /etc/sudoers.d/nominiatim
229 echo "/home/nominatim/Nominatim/vagrant/Install-on-${OS}.sh no $INSTALL_MODE" > /home/nominatim/vagrant.sh
232 OS: ${{ matrix.name }}
233 INSTALL_MODE: ${{ matrix.install_mode }}
235 - uses: actions/download-artifact@v3
238 path: /home/nominatim
240 - name: Install Nominatim
242 export USERNAME=nominatim
243 export USERHOME=/home/nominatim
245 export HAVE_SELINUX=no
246 tar xf nominatim-src.tar.bz2
248 working-directory: /home/nominatim
250 - name: Prepare import environment
252 mv Nominatim/test/testdb/apidb-test-data.pbf test.pbf
253 mv Nominatim/settings/flex-base.lua flex-base.lua
254 mv Nominatim/settings/import-extratags.lua import-extratags.lua
255 mv Nominatim/settings/taginfo.lua taginfo.lua
257 mkdir data-env-reverse
258 working-directory: /home/nominatim
260 - name: Print version
261 run: nominatim --version
262 working-directory: /home/nominatim/nominatim-project
264 - name: Print taginfo
266 working-directory: /home/nominatim
268 - name: Collect host OS information
269 run: nominatim admin --collect-os-info
270 working-directory: /home/nominatim/nominatim-project
273 run: nominatim import --osm-file ../test.pbf
274 working-directory: /home/nominatim/nominatim-project
276 - name: Import special phrases
277 run: nominatim special-phrases --import-from-wiki
278 working-directory: /home/nominatim/nominatim-project
280 - name: Check full import
281 run: nominatim admin --check-database
282 working-directory: /home/nominatim/nominatim-project
284 - name: Warm up database
285 run: nominatim admin --warm
286 working-directory: /home/nominatim/nominatim-project
288 - name: Prepare update (Ubuntu)
289 run: apt-get install -y python3-pip
294 pip3 install --user osmium
295 nominatim replication --init
296 NOMINATIM_REPLICATION_MAX_DIFF=1 nominatim replication --once
297 working-directory: /home/nominatim/nominatim-project
299 - name: Clean up database
300 run: nominatim refresh --postcodes --word-tokens
301 working-directory: /home/nominatim/nominatim-project
303 - name: Run reverse-only import
305 echo 'NOMINATIM_DATABASE_DSN="pgsql:dbname=reverse"' >> .env
306 nominatim import --osm-file ../test.pbf --reverse-only --no-updates
307 working-directory: /home/nominatim/data-env-reverse
309 - name: Check reverse-only import
310 run: nominatim admin --check-database
311 working-directory: /home/nominatim/data-env-reverse
313 - name: Clean up database (reverse-only import)
314 run: nominatim refresh --postcodes --word-tokens
315 working-directory: /home/nominatim/nominatim-project