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 }}
68 tools: phpunit, phpcs, composer
70 - uses: actions/setup-python@v2
73 if: matrix.ubuntu == 18
75 - uses: ./Nominatim/.github/actions/setup-postgresql
77 postgresql-version: ${{ matrix.postgresql }}
78 postgis-version: ${{ matrix.postgis }}
80 - uses: ./Nominatim/.github/actions/build-nominatim
82 ubuntu: ${{ matrix.ubuntu }}
84 - name: Install test prerequsites
85 run: sudo apt-get install -y -qq pylint python3-pytest python3-behave python3-pytest-cov php-codecoverage
86 if: matrix.ubuntu == 20
88 - name: Install test prerequsites
89 run: pip3 install pylint==2.6.0 pytest pytest-cov behave==1.2.6
90 if: matrix.ubuntu == 18
93 run: phpcs --report-width=120 .
94 working-directory: Nominatim
96 - name: Python linting
98 working-directory: Nominatim
100 - name: PHP unit tests
101 run: phpunit --coverage-clover ../../coverage-php.xml ./
102 working-directory: Nominatim/test/php
103 if: matrix.ubuntu == 20
105 - name: Python unit tests
106 run: $PYTEST --cov=nominatim --cov-report=xml test/python
107 working-directory: Nominatim
109 PYTEST: ${{ matrix.pytest }}
114 behave -DREMOVE_TEMPLATE=1 -DBUILDDIR=$GITHUB_WORKSPACE/build --format=progress3 -DPHPCOV=./cov
115 composer require phpunit/phpcov:7.0.2
116 vendor/bin/phpcov merge --clover ../../coverage-bdd.xml ./cov
117 working-directory: Nominatim/test/bdd
118 if: matrix.ubuntu == 20
122 behave -DREMOVE_TEMPLATE=1 -DBUILDDIR=$GITHUB_WORKSPACE/build --format=progress3
123 working-directory: Nominatim/test/bdd
124 if: matrix.ubuntu == 18
126 - name: Upload coverage to Codecov
127 uses: codecov/codecov-action@v1
129 files: ./Nominatim/coverage*.xml
131 name: codecov-umbrella
132 fail_ci_if_error: false
133 path_to_write_report: ./coverage/codecov_report.txt
135 if: matrix.ubuntu == 20
139 needs: create-archive
150 runs-on: ubuntu-${{ matrix.ubuntu }}.04
153 - uses: actions/download-artifact@v2
157 - name: Unpack Nominatim
158 run: tar xf nominatim-src.tar.bz2
161 uses: shivammathur/setup-php@v2
163 php-version: ${{ matrix.php }}
165 tools: phpunit, phpcs, composer
167 - uses: actions/setup-python@v2
170 if: matrix.ubuntu == 18
172 - uses: ./Nominatim/.github/actions/setup-postgresql
174 postgresql-version: ${{ matrix.postgresql }}
175 postgis-version: ${{ matrix.postgis }}
177 - uses: ./Nominatim/.github/actions/build-nominatim
179 ubuntu: ${{ matrix.ubuntu }}
181 - name: Install test prerequsites
182 run: sudo apt-get install -y -qq python3-behave
183 if: matrix.ubuntu == 20
185 - name: Install test prerequsites
186 run: pip3 install behave==1.2.6
187 if: matrix.ubuntu == 18
189 - name: BDD tests (icu tokenizer)
191 behave -DREMOVE_TEMPLATE=1 -DBUILDDIR=$GITHUB_WORKSPACE/build -DTOKENIZER=icu --format=progress3
192 working-directory: Nominatim/test/bdd
196 runs-on: ubuntu-latest
197 needs: create-archive
201 name: [Ubuntu-18, Ubuntu-20, Centos-8]
205 image: "ubuntu:18.04"
207 install_mode: install-nginx
210 image: "ubuntu:20.04"
212 install_mode: install-apache
218 image: ${{ matrix.image }}
224 shell: sudo -Hu nominatim bash --noprofile --norc -eo pipefail {0}
227 - name: Prepare container (Ubuntu)
229 export APT_LISTCHANGES_FRONTEND=none
230 export DEBIAN_FRONTEND=noninteractive
232 apt-get install -y git sudo wget
233 ln -snf /usr/share/zoneinfo/$CONTAINER_TIMEZONE /etc/localtime && echo $CONTAINER_TIMEZONE > /etc/timezone
235 if: matrix.flavour == 'ubuntu'
237 - name: Prepare container (CentOS)
240 dnf install -y sudo glibc-langpack-en
242 if: matrix.flavour == 'centos'
244 - name: Setup import user
247 echo 'nominatim ALL=(ALL:ALL) NOPASSWD: ALL' > /etc/sudoers.d/nominiatim
248 echo "/home/nominatim/Nominatim/vagrant/Install-on-${OS}.sh no $INSTALL_MODE" > /home/nominatim/vagrant.sh
251 OS: ${{ matrix.name }}
252 INSTALL_MODE: ${{ matrix.install_mode }}
254 - uses: actions/download-artifact@v2
257 path: /home/nominatim
259 - name: Install Nominatim
261 export USERNAME=nominatim
262 export USERHOME=/home/nominatim
264 export HAVE_SELINUX=no
265 tar xf nominatim-src.tar.bz2
267 working-directory: /home/nominatim
269 - name: Prepare import environment
271 mv Nominatim/test/testdb/apidb-test-data.pbf test.pbf
273 mkdir data-env-reverse
274 working-directory: /home/nominatim
276 - name: Prepare import environment (CentOS)
278 sudo ln -s /usr/local/bin/nominatim /usr/bin/nominatim
279 echo NOMINATIM_DATABASE_WEBUSER="apache" > nominatim-project/.env
280 cp nominatim-project/.env data-env-reverse/.env
281 working-directory: /home/nominatim
282 if: matrix.flavour == 'centos'
285 run: nominatim import --osm-file ../test.pbf
286 working-directory: /home/nominatim/nominatim-project
288 - name: Import special phrases
289 run: nominatim special-phrases --import-from-wiki
290 working-directory: /home/nominatim/nominatim-project
292 - name: Check full import
293 run: nominatim admin --check-database
294 working-directory: /home/nominatim/nominatim-project
296 - name: Warm up database
297 run: nominatim admin --warm
298 working-directory: /home/nominatim/nominatim-project
300 - name: Prepare update (Ubuntu)
301 run: apt-get install -y python3-pip
303 if: matrix.flavour == 'ubuntu'
307 pip3 install --user osmium
308 nominatim replication --init
309 NOMINATIM_REPLICATION_MAX_DIFF=1 nominatim replication --once
310 working-directory: /home/nominatim/nominatim-project
312 - name: Run reverse-only import
314 echo 'NOMINATIM_DATABASE_DSN="pgsql:dbname=reverse"' >> .env
315 nominatim import --osm-file ../test.pbf --reverse-only --no-updates
316 working-directory: /home/nominatim/data-env-reverse
318 - name: Check reverse import
319 run: nominatim admin --check-database
320 working-directory: /home/nominatim/data-env-reverse