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 python3-pytest python3-behave
85 if: matrix.ubuntu == 20
87 - name: Install test prerequsites
88 run: pip3 install pytest behave==1.2.6
89 if: matrix.ubuntu == 18
91 - name: Install latest pylint
92 run: pip3 install pylint
95 run: phpcs --report-width=120 .
96 working-directory: Nominatim
98 - name: Python linting
100 working-directory: Nominatim
102 - name: PHP unit tests
104 working-directory: Nominatim/test/php
105 if: matrix.ubuntu == 20
107 - name: Python unit tests
108 run: $PYTEST test/python
109 working-directory: Nominatim
111 PYTEST: ${{ matrix.pytest }}
115 behave -DREMOVE_TEMPLATE=1 -DBUILDDIR=$GITHUB_WORKSPACE/build --format=progress3
116 working-directory: Nominatim/test/bdd
120 needs: create-archive
121 runs-on: ubuntu-20.04
124 - uses: actions/download-artifact@v2
128 - name: Unpack Nominatim
129 run: tar xf nominatim-src.tar.bz2
132 uses: shivammathur/setup-php@v2
136 - uses: ./Nominatim/.github/actions/setup-postgresql
138 postgresql-version: 13
141 - name: Install Postgresql server dev
142 run: sudo apt-get install postgresql-server-dev-13
144 - uses: ./Nominatim/.github/actions/build-nominatim
147 cmake-args: -DBUILD_MODULE=on
149 - name: Install test prerequsites
150 run: sudo apt-get install -y -qq python3-behave
152 - name: BDD tests (legacy tokenizer)
154 behave -DREMOVE_TEMPLATE=1 -DBUILDDIR=$GITHUB_WORKSPACE/build -DTOKENIZER=legacy --format=progress3
155 working-directory: Nominatim/test/bdd
159 runs-on: ubuntu-latest
160 needs: create-archive
164 name: [Ubuntu-18, Ubuntu-20]
168 image: "ubuntu:18.04"
170 install_mode: install-nginx
173 image: "ubuntu:20.04"
175 install_mode: install-apache
178 image: ${{ matrix.image }}
184 shell: sudo -Hu nominatim bash --noprofile --norc -eo pipefail {0}
187 - name: Prepare container (Ubuntu)
189 export APT_LISTCHANGES_FRONTEND=none
190 export DEBIAN_FRONTEND=noninteractive
192 apt-get install -y git sudo wget
193 ln -snf /usr/share/zoneinfo/$CONTAINER_TIMEZONE /etc/localtime && echo $CONTAINER_TIMEZONE > /etc/timezone
195 if: matrix.flavour == 'ubuntu'
197 - name: Prepare container (CentOS)
200 dnf install -y sudo glibc-langpack-en
202 if: matrix.flavour == 'centos'
204 - name: Setup import user
207 echo 'nominatim ALL=(ALL:ALL) NOPASSWD: ALL' > /etc/sudoers.d/nominiatim
208 echo "/home/nominatim/Nominatim/vagrant/Install-on-${OS}.sh no $INSTALL_MODE" > /home/nominatim/vagrant.sh
211 OS: ${{ matrix.name }}
212 INSTALL_MODE: ${{ matrix.install_mode }}
214 - uses: actions/download-artifact@v2
217 path: /home/nominatim
219 - name: Install Nominatim
221 export USERNAME=nominatim
222 export USERHOME=/home/nominatim
224 export HAVE_SELINUX=no
225 tar xf nominatim-src.tar.bz2
227 working-directory: /home/nominatim
229 - name: Prepare import environment
231 mv Nominatim/test/testdb/apidb-test-data.pbf test.pbf
233 mkdir data-env-reverse
234 working-directory: /home/nominatim
236 - name: Prepare import environment (CentOS)
238 sudo ln -s /usr/local/bin/nominatim /usr/bin/nominatim
239 echo NOMINATIM_DATABASE_WEBUSER="apache" > nominatim-project/.env
240 cp nominatim-project/.env data-env-reverse/.env
241 working-directory: /home/nominatim
242 if: matrix.flavour == 'centos'
244 - name: Print version
245 run: nominatim --version
246 working-directory: /home/nominatim/nominatim-project
249 run: nominatim import --osm-file ../test.pbf
250 working-directory: /home/nominatim/nominatim-project
252 - name: Import special phrases
253 run: nominatim special-phrases --import-from-wiki
254 working-directory: /home/nominatim/nominatim-project
256 - name: Check full import
257 run: nominatim admin --check-database
258 working-directory: /home/nominatim/nominatim-project
260 - name: Warm up database
261 run: nominatim admin --warm
262 working-directory: /home/nominatim/nominatim-project
264 - name: Prepare update (Ubuntu)
265 run: apt-get install -y python3-pip
267 if: matrix.flavour == 'ubuntu'
271 pip3 install --user osmium
272 nominatim replication --init
273 NOMINATIM_REPLICATION_MAX_DIFF=1 nominatim replication --once
274 working-directory: /home/nominatim/nominatim-project
276 - name: Clean up database
277 run: nominatim refresh --postcodes --word-tokens
278 working-directory: /home/nominatim/nominatim-project
280 - name: Run reverse-only import
282 echo 'NOMINATIM_DATABASE_DSN="pgsql:dbname=reverse"' >> .env
283 nominatim import --osm-file ../test.pbf --reverse-only --no-updates
284 working-directory: /home/nominatim/data-env-reverse
286 - name: Check reverse-only import
287 run: nominatim admin --check-database
288 working-directory: /home/nominatim/data-env-reverse
290 - name: Clean up database (reverse-only import)
291 run: nominatim refresh --postcodes --word-tokens
292 working-directory: /home/nominatim/nominatim-project