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: BDD tests (icu tokenizer)
128 behave -DREMOVE_TEMPLATE=1 -DBUILDDIR=$GITHUB_WORKSPACE/build -DTOKENIZER=icu --format=progress3
129 working-directory: Nominatim/test/bdd
131 - name: Upload coverage to Codecov
132 uses: codecov/codecov-action@v1
134 files: ./Nominatim/coverage*.xml
136 name: codecov-umbrella
137 fail_ci_if_error: false
138 path_to_write_report: ./coverage/codecov_report.txt
140 if: matrix.ubuntu == 20
144 runs-on: ubuntu-latest
145 needs: create-archive
149 name: [Ubuntu-18, Ubuntu-20, Centos-8]
153 image: "ubuntu:18.04"
155 install_mode: install-nginx
158 image: "ubuntu:20.04"
160 install_mode: install-apache
166 image: ${{ matrix.image }}
172 shell: sudo -Hu nominatim bash --noprofile --norc -eo pipefail {0}
175 - name: Prepare container (Ubuntu)
177 export APT_LISTCHANGES_FRONTEND=none
178 export DEBIAN_FRONTEND=noninteractive
180 apt-get install -y git sudo wget
181 ln -snf /usr/share/zoneinfo/$CONTAINER_TIMEZONE /etc/localtime && echo $CONTAINER_TIMEZONE > /etc/timezone
183 if: matrix.flavour == 'ubuntu'
185 - name: Prepare container (CentOS)
190 if: matrix.flavour == 'centos'
192 - name: Setup import user
195 echo 'nominatim ALL=(ALL:ALL) NOPASSWD: ALL' > /etc/sudoers.d/nominiatim
196 echo "/home/nominatim/Nominatim/vagrant/Install-on-${OS}.sh no $INSTALL_MODE" > /home/nominatim/vagrant.sh
199 OS: ${{ matrix.name }}
200 INSTALL_MODE: ${{ matrix.install_mode }}
202 - uses: actions/download-artifact@v2
205 path: /home/nominatim
207 - name: Install Nominatim
209 export USERNAME=nominatim
210 export USERHOME=/home/nominatim
212 export HAVE_SELINUX=no
213 tar xf nominatim-src.tar.bz2
215 working-directory: /home/nominatim
217 - name: Prepare import environment
219 mv Nominatim/test/testdb/apidb-test-data.pbf test.pbf
221 mkdir data-env-reverse
222 working-directory: /home/nominatim
224 - name: Prepare import environment (CentOS)
226 sudo ln -s /usr/local/bin/nominatim /usr/bin/nominatim
227 echo NOMINATIM_DATABASE_WEBUSER="apache" > nominatim-project/.env
228 cp nominatim-project/.env data-env-reverse/.env
229 working-directory: /home/nominatim
230 if: matrix.flavour == 'centos'
233 run: nominatim import --osm-file ../test.pbf
234 working-directory: /home/nominatim/nominatim-project
236 - name: Import special phrases
237 run: nominatim special-phrases --import-from-wiki
238 working-directory: /home/nominatim/nominatim-project
240 - name: Check full import
241 run: nominatim admin --check-database
242 working-directory: /home/nominatim/nominatim-project
244 - name: Warm up database
245 run: nominatim admin --warm
246 working-directory: /home/nominatim/nominatim-project
248 - name: Prepare update (Ubuntu)
249 run: apt-get install -y python3-pip
251 if: matrix.flavour == 'ubuntu'
255 pip3 install --user osmium
256 nominatim replication --init
257 NOMINATIM_REPLICATION_MAX_DIFF=1 nominatim replication --once
258 working-directory: /home/nominatim/nominatim-project
260 - name: Run reverse-only import
262 echo 'NOMINATIM_DATABASE_DSN="pgsql:dbname=reverse"' >> .env
263 nominatim import --osm-file ../test.pbf --reverse-only --no-updates
264 working-directory: /home/nominatim/data-env-reverse
266 - name: Check reverse import
267 run: nominatim admin --check-database
268 working-directory: /home/nominatim/data-env-reverse