Merge pull request #762 from TKYK93/update-readme #326
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: | |
- 8 | |
- 11 | |
- 17 | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Setup Java ${{ matrix.java }} | |
uses: actions/setup-java@v3 | |
with: | |
distribution: 'temurin' | |
java-version: ${{ matrix.java }} | |
cache: 'maven' | |
- name: Compile project, run tests | |
run: | | |
mvn --no-transfer-progress test | |
import: | |
name: Import OSM data from Nominatim into Photon | |
runs-on: ubuntu-22.04 | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Setup Java 11 | |
uses: actions/setup-java@v3 | |
with: | |
distribution: 'temurin' | |
java-version: 11 | |
cache: 'maven' | |
- name: Compile project | |
run: | | |
mvn --no-transfer-progress package -Dmaven.test.skip=true | |
- uses: actions/checkout@v3 | |
with: | |
repository: osm-search/Nominatim | |
submodules: true | |
path: Nominatim | |
- name: Get Date | |
run: echo "cache_key=$(/bin/date -u "+%Y%W")" >> $GITHUB_ENV | |
shell: bash | |
- uses: actions/cache@v3 | |
with: | |
path: | | |
Nominatim/data/country_osm_grid.sql.gz | |
monaco-latest.osm.pbf | |
key: nominatim-test-data-${{ env.cache_key }} | |
- name: Install prerequisits | |
run: | | |
sudo apt-get update -qq | |
sudo apt-get install -y -qq libboost-system-dev libboost-filesystem-dev libexpat1-dev zlib1g-dev libbz2-dev libpq-dev libproj-dev liblua5.3-dev lua5.3 python3-psycopg2 python3-pyosmium python3-dotenv python3-psutil python3-jinja2 python3-icu python3-datrie postgresql-14-postgis-3 postgresql-client-14 postgresql-14 postgresql-14-postgis-3-scripts nlohmann-json3-dev | |
pip3 install sqlalchemy GeoAlchemy2 psycopg | |
shell: bash | |
- name: Setup database | |
run: | | |
echo 'fsync = off' | sudo tee /etc/postgresql/14/main/conf.d/local.conf | |
echo 'synchronous_commit = off' | sudo tee -a /etc/postgresql/14/main/conf.d/local.conf | |
echo 'full_page_writes = off' | sudo tee -a /etc/postgresql/14/main/conf.d/local.conf | |
echo 'shared_buffers = 512MB' | sudo tee -a /etc/postgresql/14/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: mkdir build && cd build && cmake -DBUILD_MODULE=off ../Nominatim && make -j2 && sudo make install | |
shell: bash | |
- 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: | | |
export NOMINATIM_TOKENIZER=icu | |
nominatim import --osm-file ../monaco-latest.osm.pbf --reverse-only | |
nominatim admin --check-database | |
shell: bash | |
working-directory: data-env | |
- name: Import Photon | |
run: | | |
java -jar target/photon-*.jar -nominatim-import -database nominatim -user runner -password foobar | |
- name: Update Nominatim | |
run: | | |
nominatim replication --init | |
nominatim replication --no-index --once | |
shell: bash | |
working-directory: data-env | |
env: | |
NOMINATIM_REPLICATION_MAX_DIFF: 10 | |
- name: Update Photon | |
run: | | |
java -jar target/photon-*.jar -nominatim-update -database nominatim -user runner -password foobar |