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
73 ini-values: opcache.jit=disable
75 - uses: actions/setup-python@v2
78 if: matrix.ubuntu == 18
80 - uses: ./Nominatim/.github/actions/setup-postgresql
82 postgresql-version: ${{ matrix.postgresql }}
83 postgis-version: ${{ matrix.postgis }}
85 - uses: ./Nominatim/.github/actions/build-nominatim
87 ubuntu: ${{ matrix.ubuntu }}
89 - name: Install test prerequsites
90 run: sudo apt-get install -y -qq python3-pytest python3-behave
91 if: matrix.ubuntu == 20
93 - name: Install test prerequsites
94 run: pip3 install pylint pytest behave==1.2.6
95 if: ${{ (matrix.ubuntu == 18) || (matrix.ubuntu == 22) }}
97 - name: Install test prerequsites
98 run: sudo apt-get install -y -qq python3-pytest
99 if: matrix.ubuntu == 22
101 - name: Install latest pylint
102 run: pip3 install pylint mypy types-PyYAML types-jinja2 types-psycopg2
105 run: phpcs --report-width=120 .
106 working-directory: Nominatim
108 - name: Python linting
109 run: pylint nominatim
110 working-directory: Nominatim
112 - name: Python static typechecking
114 working-directory: Nominatim
117 - name: PHP unit tests
119 working-directory: Nominatim/test/php
120 if: ${{ (matrix.ubuntu == 20) || (matrix.ubuntu == 22) }}
122 - name: Python unit tests
123 run: $PYTEST test/python
124 working-directory: Nominatim
126 PYTEST: ${{ matrix.pytest }}
130 behave -DREMOVE_TEMPLATE=1 -DBUILDDIR=$GITHUB_WORKSPACE/build --format=progress3
131 working-directory: Nominatim/test/bdd
135 needs: create-archive
136 runs-on: ubuntu-20.04
139 - uses: actions/download-artifact@v2
143 - name: Unpack Nominatim
144 run: tar xf nominatim-src.tar.bz2
147 uses: shivammathur/setup-php@v2
151 - uses: ./Nominatim/.github/actions/setup-postgresql
153 postgresql-version: 13
156 - name: Install Postgresql server dev
157 run: sudo apt-get install postgresql-server-dev-13
159 - uses: ./Nominatim/.github/actions/build-nominatim
162 cmake-args: -DBUILD_MODULE=on
164 - name: Install test prerequsites
165 run: sudo apt-get install -y -qq python3-behave
167 - name: BDD tests (legacy tokenizer)
169 behave -DREMOVE_TEMPLATE=1 -DBUILDDIR=$GITHUB_WORKSPACE/build -DTOKENIZER=legacy --format=progress3
170 working-directory: Nominatim/test/bdd
174 runs-on: ubuntu-latest
175 needs: create-archive
179 name: [Ubuntu-18, Ubuntu-20, Ubuntu-22]
183 image: "ubuntu:18.04"
185 install_mode: install-nginx
188 image: "ubuntu:20.04"
190 install_mode: install-apache
193 image: "ubuntu:22.04"
195 install_mode: install-apache
198 image: ${{ matrix.image }}
204 shell: sudo -Hu nominatim bash --noprofile --norc -eo pipefail {0}
207 - name: Prepare container (Ubuntu)
209 export APT_LISTCHANGES_FRONTEND=none
210 export DEBIAN_FRONTEND=noninteractive
212 apt-get install -y git sudo wget
213 ln -snf /usr/share/zoneinfo/$CONTAINER_TIMEZONE /etc/localtime && echo $CONTAINER_TIMEZONE > /etc/timezone
215 if: matrix.flavour == 'ubuntu'
217 - name: Prepare container (CentOS)
220 dnf install -y sudo glibc-langpack-en
222 if: matrix.flavour == 'centos'
224 - name: Setup import user
227 echo 'nominatim ALL=(ALL:ALL) NOPASSWD: ALL' > /etc/sudoers.d/nominiatim
228 echo "/home/nominatim/Nominatim/vagrant/Install-on-${OS}.sh no $INSTALL_MODE" > /home/nominatim/vagrant.sh
231 OS: ${{ matrix.name }}
232 INSTALL_MODE: ${{ matrix.install_mode }}
234 - uses: actions/download-artifact@v2
237 path: /home/nominatim
239 - name: Install Nominatim
241 export USERNAME=nominatim
242 export USERHOME=/home/nominatim
244 export HAVE_SELINUX=no
245 tar xf nominatim-src.tar.bz2
247 working-directory: /home/nominatim
249 - name: Prepare import environment
251 mv Nominatim/test/testdb/apidb-test-data.pbf test.pbf
253 mkdir data-env-reverse
254 working-directory: /home/nominatim
256 - name: Prepare import environment (CentOS)
258 sudo ln -s /usr/local/bin/nominatim /usr/bin/nominatim
259 echo NOMINATIM_DATABASE_WEBUSER="apache" > nominatim-project/.env
260 cp nominatim-project/.env data-env-reverse/.env
261 working-directory: /home/nominatim
262 if: matrix.flavour == 'centos'
264 - name: Print version
265 run: nominatim --version
266 working-directory: /home/nominatim/nominatim-project
269 run: nominatim import --osm-file ../test.pbf
270 working-directory: /home/nominatim/nominatim-project
272 - name: Import special phrases
273 run: nominatim special-phrases --import-from-wiki
274 working-directory: /home/nominatim/nominatim-project
276 - name: Check full import
277 run: nominatim admin --check-database
278 working-directory: /home/nominatim/nominatim-project
280 - name: Warm up database
281 run: nominatim admin --warm
282 working-directory: /home/nominatim/nominatim-project
284 - name: Prepare update (Ubuntu)
285 run: apt-get install -y python3-pip
287 if: matrix.flavour == 'ubuntu'
291 pip3 install --user osmium
292 nominatim replication --init
293 NOMINATIM_REPLICATION_MAX_DIFF=1 nominatim replication --once
294 working-directory: /home/nominatim/nominatim-project
296 - name: Clean up database
297 run: nominatim refresh --postcodes --word-tokens
298 working-directory: /home/nominatim/nominatim-project
300 - name: Run reverse-only import
302 echo 'NOMINATIM_DATABASE_DSN="pgsql:dbname=reverse"' >> .env
303 nominatim import --osm-file ../test.pbf --reverse-only --no-updates
304 working-directory: /home/nominatim/data-env-reverse
306 - name: Check reverse-only import
307 run: nominatim admin --check-database
308 working-directory: /home/nominatim/data-env-reverse
310 - name: Clean up database (reverse-only import)
311 run: nominatim refresh --postcodes --word-tokens
312 working-directory: /home/nominatim/nominatim-project