-
Notifications
You must be signed in to change notification settings - Fork 449
259 lines (236 loc) · 11.3 KB
/
ci.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
name: CI
on:
push:
pull_request:
workflow_dispatch:
jobs:
docker:
name: Build and test docker image
strategy:
matrix:
nominatim:
- version: "4.3"
update_command: docker exec -i nominatim sudo -u nominatim nominatim replication --project-dir /nominatim --once
postgres_version: 14
user_agent: mediagis/nominatim-docker-action:4.3
- version: "4.4"
update_command: docker exec -i nominatim sudo -u nominatim nominatim replication --project-dir /nominatim --once
postgres_version: 14
user_agent: mediagis/nominatim-docker-action:4.4
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Set up QEMU
uses: docker/setup-qemu-action@v2
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2
- name: Build docker image
run: docker build -t nominatim .
working-directory: ${{ matrix.nominatim.version }}
- name: Check import with PBF_URL and update
working-directory: .github/workflows
run: |-
# get the data from four days ago to make sure there really are updates to apply
four_days_ago=`date --date="4 days ago" +%y%m%d`
docker run -i --rm \
-e PBF_URL=http://download.geofabrik.de/europe/monaco-${four_days_ago}.osm.pbf \
-e REPLICATION_URL=http://download.geofabrik.de/europe/monaco-updates/ \
-e USER_AGENT=${{matrix.nominatim.user_agent}} \
-p 8001:8080 \
--name nominatim \
nominatim &
sleep 120
./assert-non-empty-json "http://localhost:8001/search.php?q=avenue%20pasteur"
${{ matrix.nominatim.update_command }}
./assert-non-empty-json "http://localhost:8001/search.php?q=avenue%20pasteur"
docker stop nominatim
- name: Check import with volume mount
working-directory: .github/workflows
run: |-
docker run -i --rm \
-e PBF_URL=http://download.geofabrik.de/europe/monaco-latest.osm.pbf \
-e REPLICATION_URL=http://download.geofabrik.de/europe/monaco-updates/ \
-e USER_AGENT=${{matrix.nominatim.user_agent}} \
-v nominatim-data:/var/lib/postgresql/${{ matrix.nominatim.postgres_version }}/main \
-p 8002:8080 \
nominatim &
sleep 120
./assert-non-empty-json "http://localhost:8002/search.php?q=avenue%20pasteur"
- name: Check import with bind-mount
working-directory: .github/workflows
run: |-
# get the data from four days ago to make sure there really are updates to apply
four_days_ago=`date --date="4 days ago" +%y%m%d`
docker run -i --rm \
-e PBF_URL=http://download.geofabrik.de/europe/monaco-${four_days_ago}.osm.pbf \
-e REPLICATION_URL=http://download.geofabrik.de/europe/monaco-updates/ \
-e USER_AGENT=${{matrix.nominatim.user_agent}} \
-v /tmp/nominatim-data:/var/lib/postgresql/${{ matrix.nominatim.postgres_version }}/main \
-p 8003:8080 \
--name nominatim \
nominatim &
sleep 120
./assert-non-empty-json "http://localhost:8003/search.php?q=avenue%20pasteur"
docker stop nominatim
- name: Check container restart and update with bind-mount
working-directory: .github/workflows
run: |-
# import to bind mount is done by previous step
four_days_ago=`date --date="4 days ago" +%y%m%d`
docker run -i --rm \
-e PBF_URL=http://download.geofabrik.de/europe/monaco-${four_days_ago}.osm.pbf \
-e REPLICATION_URL=http://download.geofabrik.de/europe/monaco-updates/ \
-e USER_AGENT=${{matrix.nominatim.user_agent}} \
-v /tmp/nominatim-data:/var/lib/postgresql/${{ matrix.nominatim.postgres_version }}/main \
-p 8004:8080 \
--name nominatim \
nominatim &
sleep 5
./assert-non-empty-json "http://localhost:8004/search.php?q=avenue%20pasteur"
${{ matrix.nominatim.update_command }}
./assert-non-empty-json "http://localhost:8004/search.php?q=avenue%20pasteur"
docker stop nominatim
- name: Check UPDATE_MODE=once with volume
if: matrix.nominatim.version != '4.0'
working-directory: .github/workflows
run: |-
# get the data from four days ago to make sure there really are updates to apply
four_days_ago=`date --date="4 days ago" +%y%m%d`
docker run -i --rm \
-e PBF_URL=http://download.geofabrik.de/europe/monaco-${four_days_ago}.osm.pbf \
-e REPLICATION_URL=http://download.geofabrik.de/europe/monaco-updates/ \
-e UPDATE_MODE=once \
-e USER_AGENT=${{matrix.nominatim.user_agent}} \
-v nominatim-update-volume:/var/lib/postgresql/${{ matrix.nominatim.postgres_version }}/main \
-p 8004:8080 \
--name nominatim \
nominatim &
sleep 120
./assert-non-empty-json "http://localhost:8004/search.php?q=avenue%20pasteur"
echo "check replication log for Update completed. Count:"
docker exec -i nominatim grep -c 'Update completed.' /var/log/replication.log
docker stop nominatim
- name: Check UPDATE_MODE=continuous with bind-mount
if: matrix.nominatim.version != '4.0'
working-directory: .github/workflows
run: |-
# get the data from few days ago to make sure there really are updates to apply
days_ago=`date --date="4 days ago" +%y%m%d`
docker run -i --rm \
-e PBF_URL=http://download.geofabrik.de/europe/monaco-${days_ago}.osm.pbf \
-e REPLICATION_URL=http://download.geofabrik.de/europe/monaco-updates/ \
-e UPDATE_MODE=continuous \
-e USER_AGENT=${{matrix.nominatim.user_agent}} \
-v /tmp/nominatim-update-bindmount:/var/lib/postgresql/${{ matrix.nominatim.postgres_version }}/main \
-p 8004:8080 \
--name nominatim \
nominatim &
sleep 120
./assert-non-empty-json "http://localhost:8004/search.php?q=avenue%20pasteur"
echo "check replication log for Update completed. Count:"
docker exec -i nominatim grep -c 'Update completed.' /var/log/replication.log
docker stop nominatim
- name: Check import full style
working-directory: .github/workflows
run: |-
docker run -i --rm \
-e PBF_URL=http://download.geofabrik.de/europe/monaco-latest.osm.pbf \
-e REPLICATION_URL=http://download.geofabrik.de/europe/monaco-updates/ \
-e IMPORT_STYLE=full \
-e USER_AGENT=${{matrix.nominatim.user_agent}} \
-p 8005:8080 \
nominatim &
sleep 120
./assert-non-empty-json "http://localhost:8005/search.php?q=hotel%20de%20paris"
- name: Check import admin style
working-directory: .github/workflows
run: |-
docker run -i --rm \
-e PBF_URL=http://download.geofabrik.de/europe/monaco-latest.osm.pbf \
-e REPLICATION_URL=http://download.geofabrik.de/europe/monaco-updates/ \
-e IMPORT_STYLE=admin \
-e USER_AGENT=${{matrix.nominatim.user_agent}} \
-p 8006:8080 \
nominatim &
sleep 120
./assert-empty-json "http://localhost:8006/search.php?q=hotel%20de%20paris"
- name: Check import with PBF_PATH
working-directory: .github/workflows
run: |-
wget --cut-dirs=1 -nH -xP /tmp/data http://download.geofabrik.de/europe/monaco-latest.osm.pbf
docker run -i --rm \
-e PBF_PATH=/nominatim/data/monaco-latest.osm.pbf \
-e REPLICATION_URL=http://download.geofabrik.de/europe/monaco-updates/ \
-e USER_AGENT=${{matrix.nominatim.user_agent}} \
-v nominatim7-data:/var/lib/postgresql/${{ matrix.nominatim.postgres_version }}/main \
-v /tmp/data:/nominatim/data \
-p 8007:8080 \
--name nominatim \
nominatim &
sleep 120
./assert-non-empty-json "http://localhost:8007/search.php?q=avenue%20pasteur"
docker stop nominatim
docker volume rm nominatim7-data
- name: Check when REPLICATION_URL is blank
working-directory: .github/workflows
run: |-
docker run -i --rm \
-e PBF_URL=http://download.geofabrik.de/europe/monaco-latest.osm.pbf \
-e USER_AGENT=${{matrix.nominatim.user_agent}} \
-p 8008:8080 \
nominatim &
sleep 120
./assert-non-empty-json "http://localhost:8008/search.php?q=avenue%20pasteur"
- name: Check when using FREEZE
working-directory: .github/workflows
run: |-
docker run -i --rm \
-e PBF_URL=http://download.geofabrik.de/europe/monaco-latest.osm.pbf \
-e USER_AGENT=${{matrix.nominatim.user_agent}} \
-e FREEZE="true" \
-p 8009:8080 \
nominatim &
sleep 120
./assert-non-empty-json "http://localhost:8009/search.php?q=avenue%20pasteur"
- name: Check GB postcode import
working-directory: .github/workflows
run: |-
docker run -i --rm \
-e PBF_URL=https://download.geofabrik.de/europe/great-britain/england/rutland-latest.osm.pbf \
-e USER_AGENT=${{matrix.nominatim.user_agent}} \
-e IMPORT_GB_POSTCODES="true" \
-p 8010:8080 \
nominatim &
sleep 600
./assert-non-empty-json "http://localhost:8010/search.php?postalcode=LE15+8TX"
./assert-non-empty-json "http://localhost:8010/search.php?postalcode=PE9+3SY"
./assert-non-empty-json "http://localhost:8010/search.php?postalcode=PE9+4ES"
- name: Check when using REVERSE_ONLY
working-directory: .github/workflows
run: |-
docker run -i --rm \
-e PBF_URL=http://download.geofabrik.de/europe/monaco-latest.osm.pbf \
-e USER_AGENT=${{matrix.nominatim.user_agent}} \
-e REVERSE_ONLY="true" \
-p 8011:8080 \
nominatim &
sleep 120
./assert-reverse-only "http://localhost:8011/search.php?q=avenue%20pasteur"
./assert-non-empty-json "http://localhost:8011/reverse.php?lat=43.734&lon=7.42&format=jsonv2"
- name: Login to DockerHub
if: ${{ github.ref == 'refs/heads/master' && github.repository_owner == 'mediagis' }}
uses: docker/[email protected]
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Set container date tag
run: |
echo "DATE_TAG=$(date +%Y-%m-%dT%H-%M)" >> $GITHUB_ENV
- name: Build and push production docker image to Dockerhub
if: ${{ github.ref == 'refs/heads/master' && github.repository_owner == 'mediagis' }}
run: |-
docker buildx build --platform linux/amd64,linux/arm64 --push \
-t mediagis/nominatim:${{ matrix.nominatim.version }} \
-t mediagis/nominatim:${{ matrix.nominatim.version }}-${DATE_TAG} .
working-directory: ${{ matrix.nominatim.version }}