3 on: [ push, pull_request ]
10 - uses: actions/checkout@v2
14 - uses: actions/cache@v2
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@v2
33 path: nominatim-src.tar.bz2
58 runs-on: ubuntu-${{ matrix.ubuntu }}.04
61 - uses: actions/download-artifact@v2
65 - name: Unpack Nominatim
66 run: tar xf nominatim-src.tar.bz2
69 uses: shivammathur/setup-php@v2
71 php-version: ${{ matrix.php }}
72 tools: phpunit, phpcs, composer
74 - uses: actions/setup-python@v2
77 if: matrix.ubuntu == 18
79 - uses: ./Nominatim/.github/actions/setup-postgresql
81 postgresql-version: ${{ matrix.postgresql }}
82 postgis-version: ${{ matrix.postgis }}
84 - uses: ./Nominatim/.github/actions/build-nominatim
86 ubuntu: ${{ matrix.ubuntu }}
88 - name: Install test prerequsites
89 run: sudo apt-get install -y -qq python3-pytest python3-behave
90 if: matrix.ubuntu == 20
92 - name: Install test prerequsites
93 run: pip3 install pylint pytest behave==1.2.6
94 if: ${{ (matrix.ubuntu == 18) || (matrix.ubuntu == 22) }}
96 - name: Install test prerequsites
97 run: sudo apt-get install -y -qq python3-pytest
98 if: matrix.ubuntu == 22
100 - name: Install latest pylint
101 run: pip3 install pylint
104 run: phpcs --report-width=120 .
105 working-directory: Nominatim
107 - name: Python linting
108 run: pylint nominatim
109 working-directory: Nominatim
111 - name: PHP unit tests
113 working-directory: Nominatim/test/php
114 if: ${{ (matrix.ubuntu == 20) || (matrix.ubuntu == 22) }}
116 - name: Python unit tests
117 run: $PYTEST test/python
118 working-directory: Nominatim
120 PYTEST: ${{ matrix.pytest }}
124 behave -DREMOVE_TEMPLATE=1 -DBUILDDIR=$GITHUB_WORKSPACE/build --format=progress3
125 working-directory: Nominatim/test/bdd
129 needs: create-archive
130 runs-on: ubuntu-20.04
133 - uses: actions/download-artifact@v2
137 - name: Unpack Nominatim
138 run: tar xf nominatim-src.tar.bz2
141 uses: shivammathur/setup-php@v2
145 - uses: ./Nominatim/.github/actions/setup-postgresql
147 postgresql-version: 13
150 - name: Install Postgresql server dev
151 run: sudo apt-get install postgresql-server-dev-13
153 - uses: ./Nominatim/.github/actions/build-nominatim
156 cmake-args: -DBUILD_MODULE=on
158 - name: Install test prerequsites
159 run: sudo apt-get install -y -qq python3-behave
161 - name: BDD tests (legacy tokenizer)
163 behave -DREMOVE_TEMPLATE=1 -DBUILDDIR=$GITHUB_WORKSPACE/build -DTOKENIZER=legacy --format=progress3
164 working-directory: Nominatim/test/bdd
168 runs-on: ubuntu-latest
169 needs: create-archive
173 name: [Ubuntu-18, Ubuntu-20, Ubuntu-22]
177 image: "ubuntu:18.04"
179 install_mode: install-nginx
182 image: "ubuntu:20.04"
184 install_mode: install-apache
187 image: "ubuntu:22.04"
189 install_mode: install-apache
192 image: ${{ matrix.image }}
198 shell: sudo -Hu nominatim bash --noprofile --norc -eo pipefail {0}
201 - name: Prepare container (Ubuntu)
203 export APT_LISTCHANGES_FRONTEND=none
204 export DEBIAN_FRONTEND=noninteractive
206 apt-get install -y git sudo wget
207 ln -snf /usr/share/zoneinfo/$CONTAINER_TIMEZONE /etc/localtime && echo $CONTAINER_TIMEZONE > /etc/timezone
209 if: matrix.flavour == 'ubuntu'
211 - name: Prepare container (CentOS)
214 dnf install -y sudo glibc-langpack-en
216 if: matrix.flavour == 'centos'
218 - name: Setup import user
221 echo 'nominatim ALL=(ALL:ALL) NOPASSWD: ALL' > /etc/sudoers.d/nominiatim
222 echo "/home/nominatim/Nominatim/vagrant/Install-on-${OS}.sh no $INSTALL_MODE" > /home/nominatim/vagrant.sh
225 OS: ${{ matrix.name }}
226 INSTALL_MODE: ${{ matrix.install_mode }}
228 - uses: actions/download-artifact@v2
231 path: /home/nominatim
233 - name: Install Nominatim
235 export USERNAME=nominatim
236 export USERHOME=/home/nominatim
238 export HAVE_SELINUX=no
239 tar xf nominatim-src.tar.bz2
241 working-directory: /home/nominatim
243 - name: Prepare import environment
245 mv Nominatim/test/testdb/apidb-test-data.pbf test.pbf
247 mkdir data-env-reverse
248 working-directory: /home/nominatim
250 - name: Prepare import environment (CentOS)
252 sudo ln -s /usr/local/bin/nominatim /usr/bin/nominatim
253 echo NOMINATIM_DATABASE_WEBUSER="apache" > nominatim-project/.env
254 cp nominatim-project/.env data-env-reverse/.env
255 working-directory: /home/nominatim
256 if: matrix.flavour == 'centos'
258 - name: Print version
259 run: nominatim --version
260 working-directory: /home/nominatim/nominatim-project
263 run: nominatim import --osm-file ../test.pbf
264 working-directory: /home/nominatim/nominatim-project
266 - name: Import special phrases
267 run: nominatim special-phrases --import-from-wiki
268 working-directory: /home/nominatim/nominatim-project
270 - name: Check full import
271 run: nominatim admin --check-database
272 working-directory: /home/nominatim/nominatim-project
274 - name: Warm up database
275 run: nominatim admin --warm
276 working-directory: /home/nominatim/nominatim-project
278 - name: Prepare update (Ubuntu)
279 run: apt-get install -y python3-pip
281 if: matrix.flavour == 'ubuntu'
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