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, phpcs, composer
76 ini-values: opcache.jit=disable
78 - uses: actions/setup-python@v4
81 if: matrix.flavour == 'oldstuff'
83 - uses: ./Nominatim/.github/actions/setup-postgresql
85 postgresql-version: ${{ matrix.postgresql }}
86 postgis-version: ${{ matrix.postgis }}
88 - uses: ./Nominatim/.github/actions/build-nominatim
90 flavour: ${{ matrix.flavour }}
91 lua: ${{ matrix.lua }}
93 - name: Install test prerequsites (behave from apt)
94 run: sudo apt-get install -y -qq python3-behave
95 if: matrix.flavour == 'ubuntu-20'
97 - name: Install test prerequsites (behave from pip)
98 run: pip3 install behave==1.2.6
99 if: (matrix.flavour == 'oldstuff') || (matrix.flavour == 'ubuntu-22')
101 - name: Install test prerequsites (from apt for Ununtu 2x)
102 run: sudo apt-get install -y -qq python3-pytest python3-pytest-asyncio uvicorn
103 if: matrix.flavour != 'oldstuff'
105 - name: Install newer pytest-asyncio
106 run: pip3 install -U pytest-asyncio
107 if: matrix.flavour == 'ubuntu-20'
109 - name: Install test prerequsites (from pip for Ubuntu 18)
110 run: pip3 install pytest pytest-asyncio uvicorn
111 if: matrix.flavour == 'oldstuff'
113 - name: Install Python webservers
114 run: pip3 install falcon sanic sanic-testing sanic-cors starlette
116 - name: Install latest pylint
117 run: pip3 install -U pylint asgi_lifespan
120 run: phpcs --report-width=120 .
121 working-directory: Nominatim
123 - name: Python linting
124 run: python3 -m pylint nominatim
125 working-directory: Nominatim
127 - name: PHP unit tests
129 working-directory: Nominatim/test/php
131 - name: Python unit tests
132 run: python3 -m pytest test/python
133 working-directory: Nominatim
137 python3 -m behave -DREMOVE_TEMPLATE=1 -DBUILDDIR=$GITHUB_WORKSPACE/build --format=progress3
138 working-directory: Nominatim/test/bdd
140 - name: Install mypy and typechecking info
141 run: pip3 install -U mypy osmium uvicorn types-PyYAML types-jinja2 types-psycopg2 types-psutil types-requests types-ujson typing-extensions
142 if: matrix.flavour != 'oldstuff'
144 - name: Python static typechecking
145 run: python3 -m mypy --strict nominatim
146 working-directory: Nominatim
147 if: matrix.flavour != 'oldstuff'
150 needs: create-archive
151 runs-on: ubuntu-20.04
154 - uses: actions/download-artifact@v3
158 - name: Unpack Nominatim
159 run: tar xf nominatim-src.tar.bz2
162 uses: shivammathur/setup-php@v2
166 - uses: ./Nominatim/.github/actions/setup-postgresql
168 postgresql-version: 13
171 - name: Install Postgresql server dev
172 run: sudo apt-get install postgresql-server-dev-13
174 - uses: ./Nominatim/.github/actions/build-nominatim
176 cmake-args: -DBUILD_MODULE=on
178 - name: Install test prerequsites
179 run: sudo apt-get install -y -qq python3-behave
181 - name: BDD tests (legacy tokenizer)
183 python3 -m behave -DREMOVE_TEMPLATE=1 -DBUILDDIR=$GITHUB_WORKSPACE/build -DTOKENIZER=legacy --format=progress3
184 working-directory: Nominatim/test/bdd
188 runs-on: ubuntu-latest
189 needs: create-archive
193 name: [Ubuntu-20, Ubuntu-22]
196 image: "ubuntu:20.04"
198 install_mode: install-apache
200 image: "ubuntu:22.04"
202 install_mode: install-apache
205 image: ${{ matrix.image }}
211 shell: sudo -Hu nominatim bash --noprofile --norc -eo pipefail {0}
214 - name: Prepare container (Ubuntu)
216 export APT_LISTCHANGES_FRONTEND=none
217 export DEBIAN_FRONTEND=noninteractive
219 apt-get install -y git sudo wget
220 ln -snf /usr/share/zoneinfo/$CONTAINER_TIMEZONE /etc/localtime && echo $CONTAINER_TIMEZONE > /etc/timezone
223 - name: Setup import user
226 echo 'nominatim ALL=(ALL:ALL) NOPASSWD: ALL' > /etc/sudoers.d/nominiatim
227 echo "/home/nominatim/Nominatim/vagrant/Install-on-${OS}.sh no $INSTALL_MODE" > /home/nominatim/vagrant.sh
230 OS: ${{ matrix.name }}
231 INSTALL_MODE: ${{ matrix.install_mode }}
233 - uses: actions/download-artifact@v3
236 path: /home/nominatim
238 - name: Install Nominatim
240 export USERNAME=nominatim
241 export USERHOME=/home/nominatim
243 export HAVE_SELINUX=no
244 tar xf nominatim-src.tar.bz2
246 working-directory: /home/nominatim
248 - name: Prepare import environment
250 mv Nominatim/test/testdb/apidb-test-data.pbf test.pbf
252 mkdir data-env-reverse
253 working-directory: /home/nominatim
255 - name: Print version
256 run: nominatim --version
257 working-directory: /home/nominatim/nominatim-project
259 - name: Collect host OS information
260 run: nominatim admin --collect-os-info
261 working-directory: /home/nominatim/nominatim-project
264 run: nominatim import --osm-file ../test.pbf
265 working-directory: /home/nominatim/nominatim-project
267 - name: Import special phrases
268 run: nominatim special-phrases --import-from-wiki
269 working-directory: /home/nominatim/nominatim-project
271 - name: Check full import
272 run: nominatim admin --check-database
273 working-directory: /home/nominatim/nominatim-project
275 - name: Warm up database
276 run: nominatim admin --warm
277 working-directory: /home/nominatim/nominatim-project
279 - name: Prepare update (Ubuntu)
280 run: apt-get install -y python3-pip
285 pip3 install --user osmium
286 nominatim replication --init
287 NOMINATIM_REPLICATION_MAX_DIFF=1 nominatim replication --once
288 working-directory: /home/nominatim/nominatim-project
290 - name: Clean up database
291 run: nominatim refresh --postcodes --word-tokens
292 working-directory: /home/nominatim/nominatim-project
294 - name: Run reverse-only import
296 echo 'NOMINATIM_DATABASE_DSN="pgsql:dbname=reverse"' >> .env
297 nominatim import --osm-file ../test.pbf --reverse-only --no-updates
298 working-directory: /home/nominatim/data-env-reverse
300 - name: Check reverse-only import
301 run: nominatim admin --check-database
302 working-directory: /home/nominatim/data-env-reverse
304 - name: Clean up database (reverse-only import)
305 run: nominatim refresh --postcodes --word-tokens
306 working-directory: /home/nominatim/nominatim-project