]> git.openstreetmap.org Git - nominatim.git/blob - .github/workflows/vagrant-scripts.yml
5b2df2f41ccda0469226acc8b95895837df20159
[nominatim.git] / .github / workflows / vagrant-scripts.yml
1 name: Install scripts
2
3 on: [ push, pull_request ]
4
5 jobs:
6     create-archive:
7         runs-on: ubuntu-latest
8
9         steps:
10             - uses: actions/checkout@v2
11               with:
12                 submodules: true
13
14             - name: Get Date
15               id: get-date
16               run: |
17                   echo "::set-output name=date::$(/bin/date -u "+%Y%W")"
18               shell: bash
19
20             - uses: actions/cache@v2
21               with:
22                   path: |
23                      data/country_grid.sql.gz
24                   key: nominatim-country-data-${{ steps.get-date.outputs.date }}
25
26             - name: Package tarball
27               run: |
28                   if [ ! -f data/country_grid.sql.gz ]; then
29                       wget --no-verbose -O data/country_grid.sql.gz https://www.nominatim.org/data/country_grid.sql.gz
30                   fi
31                   cd ..
32                   tar cjf nominatim-src.tar.bz2 Nominatim
33                   mv nominatim-src.tar.bz2 Nominatim
34
35             - name: 'Upload Artifact'
36               uses: actions/upload-artifact@v2
37               with:
38                   name: full-source
39                   path: nominatim-src.tar.bz2
40                   retention-days: 1
41
42
43     ubuntu:
44         runs-on: ubuntu-latest
45         needs: create-archive
46
47         strategy:
48             matrix:
49                 ubuntu: [18, 20]
50                 include:
51                     - ubuntu: 18
52                       install_mode:
53                     - ubuntu: 20
54                       install_mode: install-apache
55
56         container:
57             image: ubuntu:${{ matrix.ubuntu }}.04
58
59         defaults:
60             run:
61                 shell: sudo -Hu nominatim bash --noprofile --norc -eo pipefail {0}
62
63         steps:
64             - name: Prepare container
65               run: |
66                   export APT_LISTCHANGES_FRONTEND=none
67                   export DEBIAN_FRONTEND=noninteractive
68                   apt-get update -qq
69                   apt-get install -y git sudo wget
70                   ln -snf /usr/share/zoneinfo/$CONTAINER_TIMEZONE /etc/localtime && echo $CONTAINER_TIMEZONE > /etc/timezone
71               shell: bash
72
73             - name: Setup import user
74               run: |
75                   useradd -m nominatim -G sudo
76                   echo '%sudo   ALL=(ALL:ALL) NOPASSWD: ALL' > /etc/sudoers.d/nopasswd
77                   echo "/home/nominatim/Nominatim/vagrant/Install-on-Ubuntu-$UBUNTU.sh no $INSTALL_MODE" > /home/nominatim/vagrant.sh
78               shell: bash
79               env:
80                 UBUNTU: ${{ matrix.ubuntu }}
81                 INSTALL_MODE: ${{ matrix.install_mode }}
82
83             - uses: actions/download-artifact@v2
84               with:
85                   name: full-source
86                   path: /home/nominatim
87
88             - name: Get Date
89               id: get-date
90               run: |
91                   echo "::set-output name=date::$(/bin/date -u "+%Y%W")"
92               shell: bash
93
94             - name: Install Nominatim
95               run: |
96                 export USERNAME=nominatim
97                 export USERHOME=/home/nominatim
98                 export NOSYSTEMD=yes
99                 tar xf nominatim-src.tar.bz2
100                 . vagrant.sh
101               working-directory: /home/nominatim
102
103             - uses: actions/cache@v2
104               with:
105                   path: |
106                      monaco-latest.osm.pbf
107                   key: nominatim-test-data-${{ steps.get-date.outputs.date }}
108
109             - name: Prepare import environment
110               run: |
111                   if [ ! -f monaco-latest.osm.pbf ]; then
112                       wget --no-verbose https://download.geofabrik.de/europe/monaco-latest.osm.pbf
113                   fi
114                   mkdir data-env data-env-reverse
115                   chown nominatim. data-env data-env-reverse
116               shell: bash
117
118             - name: Import
119               run: nominatim import --osm-file ../monaco-latest.osm.pbf
120               working-directory: data-env
121
122             - name: Import special phrases
123               run: nominatim special-phrases --import-from-wiki
124               working-directory: data-env
125
126             - name: Check full import
127               run: nominatim admin --check-database
128               working-directory: data-env
129
130             - name: Warm up database
131               run: nominatim admin --warm
132               working-directory: data-env
133
134             - name: Run update
135               run: |
136                   sudo apt-get install -y python3-pip
137                   pip3 install --user osmium
138                   nominatim replication --init
139                   NOMINATIM_REPLICATION_MAX_DIFF=1 nominatim replication --once
140               working-directory: data-env
141
142             - name: Run reverse-only import
143               run : |
144                   echo 'NOMINATIM_DATABASE_DSN="pgsql:dbname=reverse"' > .env
145                   nominatim import --osm-file ../monaco-latest.osm.pbf --reverse-only --no-updates
146               working-directory: data-env-reverse
147               env:
148                   NOMINATIM_DATABASE_DSN: pgsql:dbname=reverse
149
150             - name: Check reverse import
151               run: nominatim admin --check-database
152               working-directory: data-env-reverse