Add caching of address information for Nominatim export #414
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: CI | |
on: | |
push: | |
pull_request: | |
jobs: | |
build: | |
name: Compile project and run tests (Java ${{ matrix.java }}) | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
java: | |
- 11 | |
- 17 | |
- 21 | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Setup Java ${{ matrix.java }} | |
uses: actions/setup-java@v4 | |
with: | |
distribution: 'temurin' | |
java-version: ${{ matrix.java }} | |
cache: 'gradle' | |
- name: Compile project, run tests | |
run: ./gradlew build --no-daemon | |
import: | |
name: Import OSM data from Nominatim into Photon | |
runs-on: ubuntu-24.04 | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Setup Java 21 | |
uses: actions/setup-java@v4 | |
with: | |
distribution: 'temurin' | |
java-version: 21 | |
cache: 'gradle' | |
- name: Compile project | |
run: ./gradlew app:es_embedded:assemble --no-daemon | |
- uses: actions/checkout@v4 | |
with: | |
repository: osm-search/Nominatim | |
path: Nominatim | |
- name: Get Date | |
run: echo "cache_key=$(/bin/date -u "+%Y%W")" >> $GITHUB_ENV | |
shell: bash | |
- uses: actions/cache@v4 | |
with: | |
path: | | |
Nominatim/data/country_osm_grid.sql.gz | |
monaco-latest.osm.pbf | |
key: nominatim-test-data-${{ env.cache_key }} | |
- name: Install prerequisites | |
run: | | |
sudo apt-get update -qq | |
sudo apt-get install -y -qq osm2pgsql postgresql-postgis virtualenv pkg-config libicu-dev | |
shell: bash | |
- name: Setup database | |
run: | | |
echo 'fsync = off' | sudo tee /etc/postgresql/16/main/conf.d/local.conf | |
echo 'synchronous_commit = off' | sudo tee -a /etc/postgresql/16/main/conf.d/local.conf | |
echo 'full_page_writes = off' | sudo tee -a /etc/postgresql/16/main/conf.d/local.conf | |
echo 'shared_buffers = 512MB' | sudo tee -a /etc/postgresql/16/main/conf.d/local.conf | |
sudo systemctl start postgresql | |
sudo -u postgres createuser -S www-data | |
sudo -u postgres createuser -s runner | |
psql -d postgres -c "ALTER USER runner PASSWORD 'foobar'" | |
psql --version | |
psql -d postgres -c "SELECT version()" | |
shell: bash | |
- name: Download dependencies | |
run: | | |
if [ ! -f Nominatim/data/country_osm_grid.sql.gz ]; then | |
wget --no-verbose -O Nominatim/data/country_osm_grid.sql.gz https://www.nominatim.org/data/country_grid.sql.gz | |
fi | |
shell: bash | |
- name: Build Nominatim | |
run: | | |
virtualenv ~/venv | |
~/venv/bin/pip install packaging/nominatim-db | |
shell: bash | |
working-directory: Nominatim | |
- name: Prepare import environment | |
run: | | |
if [ ! -f monaco-latest.osm.pbf ]; then | |
wget --no-verbose https://download.geofabrik.de/europe/monaco-latest.osm.pbf | |
fi | |
mkdir data-env | |
shell: bash | |
- name: Import Nominatim | |
run: | | |
~/venv/bin/nominatim import --osm-file ../monaco-latest.osm.pbf --reverse-only | |
~/venv/bin/nominatim admin --check-database | |
shell: bash | |
working-directory: data-env | |
- name: Import Photon | |
run: | | |
PHOTON_VERSION=`grep 'version =' buildSrc/shared.gradle | head -n 1 | sed "s:.*= '::;s:'.*::"` | |
java -jar target/photon-${PHOTON_VERSION}.jar -nominatim-import -database nominatim -user runner -password foobar | |
java -jar target/photon-${PHOTON_VERSION}.jar -nominatim-update-init-for runner -database nominatim -user runner -password foobar | |
- name: Update Nominatim | |
run: | | |
~/venv/bin/pip install osmium | |
~/venv/bin/nominatim replication --init | |
~/venv/bin/nominatim replication --once | |
shell: bash | |
working-directory: data-env | |
env: | |
NOMINATIM_REPLICATION_MAX_DIFF: 10 | |
- name: Update Photon | |
run: | | |
PHOTON_VERSION=`grep 'version =' buildSrc/shared.gradle | head -n 1 | sed "s:.*= '::;s:'.*::"` | |
java -jar target/photon-${PHOTON_VERSION}.jar -nominatim-update -database nominatim -user runner -password foobar |