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
53 runs-on: ubuntu-${{ matrix.ubuntu }}.04
56 - uses: actions/download-artifact@v2
60 - name: Unpack Nominatim
61 run: tar xf nominatim-src.tar.bz2
64 uses: shivammathur/setup-php@v2
66 php-version: ${{ matrix.php }}
67 tools: phpunit, phpcs, composer
69 - uses: actions/setup-python@v2
72 if: matrix.ubuntu == 18
74 - uses: ./Nominatim/.github/actions/setup-postgresql
76 postgresql-version: ${{ matrix.postgresql }}
77 postgis-version: ${{ matrix.postgis }}
79 - uses: ./Nominatim/.github/actions/build-nominatim
81 ubuntu: ${{ matrix.ubuntu }}
83 - name: Install test prerequsites
84 run: sudo apt-get install -y -qq pylint python3-pytest python3-behave
85 if: matrix.ubuntu == 20
87 - name: Install test prerequsites
88 run: pip3 install pylint==2.6.0 pytest behave==1.2.6
89 if: matrix.ubuntu == 18
92 run: phpcs --report-width=120 .
93 working-directory: Nominatim
95 - name: Python linting
97 working-directory: Nominatim
99 - name: PHP unit tests
101 working-directory: Nominatim/test/php
102 if: matrix.ubuntu == 20
104 - name: Python unit tests
105 run: $PYTEST test/python
106 working-directory: Nominatim
108 PYTEST: ${{ matrix.pytest }}
112 behave -DREMOVE_TEMPLATE=1 -DBUILDDIR=$GITHUB_WORKSPACE/build --format=progress3
113 working-directory: Nominatim/test/bdd
117 needs: create-archive
128 runs-on: ubuntu-${{ matrix.ubuntu }}.04
131 - uses: actions/download-artifact@v2
135 - name: Unpack Nominatim
136 run: tar xf nominatim-src.tar.bz2
139 uses: shivammathur/setup-php@v2
141 php-version: ${{ matrix.php }}
143 tools: phpunit, phpcs, composer
145 - uses: actions/setup-python@v2
148 if: matrix.ubuntu == 18
150 - uses: ./Nominatim/.github/actions/setup-postgresql
152 postgresql-version: ${{ matrix.postgresql }}
153 postgis-version: ${{ matrix.postgis }}
155 - uses: ./Nominatim/.github/actions/build-nominatim
157 ubuntu: ${{ matrix.ubuntu }}
159 - name: Install test prerequsites
160 run: sudo apt-get install -y -qq python3-behave
161 if: matrix.ubuntu == 20
163 - name: Install test prerequsites
164 run: pip3 install behave==1.2.6
165 if: matrix.ubuntu == 18
167 - name: BDD tests (icu tokenizer)
169 behave -DREMOVE_TEMPLATE=1 -DBUILDDIR=$GITHUB_WORKSPACE/build -DTOKENIZER=icu --format=progress3
170 working-directory: Nominatim/test/bdd
174 runs-on: ubuntu-latest
175 needs: create-archive
179 name: [Ubuntu-18, Ubuntu-20]
183 image: "ubuntu:18.04"
185 install_mode: install-nginx
188 image: "ubuntu:20.04"
190 install_mode: install-apache
193 image: ${{ matrix.image }}
199 shell: sudo -Hu nominatim bash --noprofile --norc -eo pipefail {0}
202 - name: Prepare container (Ubuntu)
204 export APT_LISTCHANGES_FRONTEND=none
205 export DEBIAN_FRONTEND=noninteractive
207 apt-get install -y git sudo wget
208 ln -snf /usr/share/zoneinfo/$CONTAINER_TIMEZONE /etc/localtime && echo $CONTAINER_TIMEZONE > /etc/timezone
210 if: matrix.flavour == 'ubuntu'
212 - name: Prepare container (CentOS)
215 dnf install -y sudo glibc-langpack-en
217 if: matrix.flavour == 'centos'
219 - name: Setup import user
222 echo 'nominatim ALL=(ALL:ALL) NOPASSWD: ALL' > /etc/sudoers.d/nominiatim
223 echo "/home/nominatim/Nominatim/vagrant/Install-on-${OS}.sh no $INSTALL_MODE" > /home/nominatim/vagrant.sh
226 OS: ${{ matrix.name }}
227 INSTALL_MODE: ${{ matrix.install_mode }}
229 - uses: actions/download-artifact@v2
232 path: /home/nominatim
234 - name: Install Nominatim
236 export USERNAME=nominatim
237 export USERHOME=/home/nominatim
239 export HAVE_SELINUX=no
240 tar xf nominatim-src.tar.bz2
242 working-directory: /home/nominatim
244 - name: Prepare import environment
246 mv Nominatim/test/testdb/apidb-test-data.pbf test.pbf
248 mkdir data-env-reverse
249 working-directory: /home/nominatim
251 - name: Prepare import environment (CentOS)
253 sudo ln -s /usr/local/bin/nominatim /usr/bin/nominatim
254 echo NOMINATIM_DATABASE_WEBUSER="apache" > nominatim-project/.env
255 cp nominatim-project/.env data-env-reverse/.env
256 working-directory: /home/nominatim
257 if: matrix.flavour == 'centos'
259 - name: Print version
260 run: nominatim --version
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
282 if: matrix.flavour == 'ubuntu'
286 pip3 install --user osmium
287 nominatim replication --init
288 NOMINATIM_REPLICATION_MAX_DIFF=1 nominatim replication --once
289 working-directory: /home/nominatim/nominatim-project
291 - name: Clean up database
292 run: nominatim refresh --postcodes --word-tokens
293 working-directory: /home/nominatim/nominatim-project
295 - name: Run reverse-only import
297 echo 'NOMINATIM_DATABASE_DSN="pgsql:dbname=reverse"' >> .env
298 nominatim import --osm-file ../test.pbf --reverse-only --no-updates
299 working-directory: /home/nominatim/data-env-reverse
301 - name: Check reverse-only import
302 run: nominatim admin --check-database
303 working-directory: /home/nominatim/data-env-reverse
305 - name: Clean up database (reverse-only import)
306 run: nominatim refresh --postcodes --word-tokens
307 working-directory: /home/nominatim/nominatim-project