3 on: [ push, pull_request ]
10 - uses: actions/checkout@v3
14 - uses: actions/cache@v3
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@v3
33 path: nominatim-src.tar.bz2
55 runs-on: ubuntu-${{ matrix.ubuntu }}.04
58 - uses: actions/download-artifact@v3
62 - name: Unpack Nominatim
63 run: tar xf nominatim-src.tar.bz2
66 uses: shivammathur/setup-php@v2
68 php-version: ${{ matrix.php }}
69 tools: phpunit, phpcs, composer
70 ini-values: opcache.jit=disable
72 - uses: actions/setup-python@v4
75 if: matrix.ubuntu == 18
77 - uses: ./Nominatim/.github/actions/setup-postgresql
79 postgresql-version: ${{ matrix.postgresql }}
80 postgis-version: ${{ matrix.postgis }}
82 - uses: ./Nominatim/.github/actions/build-nominatim
84 ubuntu: ${{ matrix.ubuntu }}
86 - name: Install test prerequsites (behave from apt)
87 run: sudo apt-get install -y -qq python3-behave
88 if: matrix.ubuntu == 20
90 - name: Install test prerequsites (behave from pip)
91 run: pip3 install behave==1.2.6
92 if: ${{ (matrix.ubuntu == 18) || (matrix.ubuntu == 22) }}
94 - name: Install test prerequsites (from apt for Ununtu 2x)
95 run: sudo apt-get install -y -qq python3-pytest uvicorn
96 if: matrix.ubuntu >= 20
98 - name: Install test prerequsites (from pip for Ubuntu 18)
99 run: pip3 install pytest uvicorn
100 if: matrix.ubuntu == 18
102 - name: Install Python webservers
103 run: pip3 install falcon sanic sanic-testing starlette
105 - name: Install latest pylint/mypy
106 run: pip3 install -U pylint mypy types-PyYAML types-jinja2 types-psycopg2 types-psutil types-requests typing-extensions asgi_lifespan sqlalchemy2-stubs
109 run: phpcs --report-width=120 .
110 working-directory: Nominatim
112 - name: Python linting
113 run: python3 -m pylint nominatim
114 working-directory: Nominatim
116 - name: PHP unit tests
118 working-directory: Nominatim/test/php
119 if: ${{ (matrix.ubuntu == 20) || (matrix.ubuntu == 22) }}
121 - name: Python unit tests
122 run: python3 -m pytest test/python
123 working-directory: Nominatim
127 python3 -m behave -DREMOVE_TEMPLATE=1 -DBUILDDIR=$GITHUB_WORKSPACE/build --format=progress3
128 working-directory: Nominatim/test/bdd
130 - name: Install newer Python packages (for typechecking info)
131 run: pip3 install -U osmium uvicorn
132 if: matrix.ubuntu >= 20
134 - name: Python static typechecking
135 run: python3 -m mypy --strict nominatim
136 working-directory: Nominatim
137 if: matrix.ubuntu >= 20
140 needs: create-archive
141 runs-on: ubuntu-20.04
144 - uses: actions/download-artifact@v3
148 - name: Unpack Nominatim
149 run: tar xf nominatim-src.tar.bz2
152 uses: shivammathur/setup-php@v2
156 - uses: ./Nominatim/.github/actions/setup-postgresql
158 postgresql-version: 13
161 - name: Install Postgresql server dev
162 run: sudo apt-get install postgresql-server-dev-13
164 - uses: ./Nominatim/.github/actions/build-nominatim
167 cmake-args: -DBUILD_MODULE=on
169 - name: Install test prerequsites
170 run: sudo apt-get install -y -qq python3-behave
172 - name: BDD tests (legacy tokenizer)
174 python3 -m behave -DREMOVE_TEMPLATE=1 -DBUILDDIR=$GITHUB_WORKSPACE/build -DTOKENIZER=legacy --format=progress3
175 working-directory: Nominatim/test/bdd
179 runs-on: ubuntu-latest
180 needs: create-archive
184 name: [Ubuntu-20, Ubuntu-22]
187 image: "ubuntu:20.04"
189 install_mode: install-apache
191 image: "ubuntu:22.04"
193 install_mode: install-apache
196 image: ${{ matrix.image }}
202 shell: sudo -Hu nominatim bash --noprofile --norc -eo pipefail {0}
205 - name: Prepare container (Ubuntu)
207 export APT_LISTCHANGES_FRONTEND=none
208 export DEBIAN_FRONTEND=noninteractive
210 apt-get install -y git sudo wget
211 ln -snf /usr/share/zoneinfo/$CONTAINER_TIMEZONE /etc/localtime && echo $CONTAINER_TIMEZONE > /etc/timezone
214 - name: Setup import user
217 echo 'nominatim ALL=(ALL:ALL) NOPASSWD: ALL' > /etc/sudoers.d/nominiatim
218 echo "/home/nominatim/Nominatim/vagrant/Install-on-${OS}.sh no $INSTALL_MODE" > /home/nominatim/vagrant.sh
221 OS: ${{ matrix.name }}
222 INSTALL_MODE: ${{ matrix.install_mode }}
224 - uses: actions/download-artifact@v3
227 path: /home/nominatim
229 - name: Install Nominatim
231 export USERNAME=nominatim
232 export USERHOME=/home/nominatim
234 export HAVE_SELINUX=no
235 tar xf nominatim-src.tar.bz2
237 working-directory: /home/nominatim
239 - name: Prepare import environment
241 mv Nominatim/test/testdb/apidb-test-data.pbf test.pbf
243 mkdir data-env-reverse
244 working-directory: /home/nominatim
246 - name: Print version
247 run: nominatim --version
248 working-directory: /home/nominatim/nominatim-project
250 - name: Collect host OS information
251 run: nominatim admin --collect-os-info
252 working-directory: /home/nominatim/nominatim-project
255 run: nominatim import --osm-file ../test.pbf
256 working-directory: /home/nominatim/nominatim-project
258 - name: Import special phrases
259 run: nominatim special-phrases --import-from-wiki
260 working-directory: /home/nominatim/nominatim-project
262 - name: Check full import
263 run: nominatim admin --check-database
264 working-directory: /home/nominatim/nominatim-project
266 - name: Warm up database
267 run: nominatim admin --warm
268 working-directory: /home/nominatim/nominatim-project
270 - name: Prepare update (Ubuntu)
271 run: apt-get install -y python3-pip
276 pip3 install --user osmium
277 nominatim replication --init
278 NOMINATIM_REPLICATION_MAX_DIFF=1 nominatim replication --once
279 working-directory: /home/nominatim/nominatim-project
281 - name: Clean up database
282 run: nominatim refresh --postcodes --word-tokens
283 working-directory: /home/nominatim/nominatim-project
285 - name: Run reverse-only import
287 echo 'NOMINATIM_DATABASE_DSN="pgsql:dbname=reverse"' >> .env
288 nominatim import --osm-file ../test.pbf --reverse-only --no-updates
289 working-directory: /home/nominatim/data-env-reverse
291 - name: Check reverse-only import
292 run: nominatim admin --check-database
293 working-directory: /home/nominatim/data-env-reverse
295 - name: Clean up database (reverse-only import)
296 run: nominatim refresh --postcodes --word-tokens
297 working-directory: /home/nominatim/nominatim-project