]> git.openstreetmap.org Git - nominatim.git/blob - .github/workflows/ci-tests.yml
51ab377bae88f6845428e41eabeb7604020d77b2
[nominatim.git] / .github / workflows / ci-tests.yml
1 name: CI Tests
2
3 on: [ push, pull_request ]
4
5 jobs:
6     tests:
7         runs-on: ubuntu-20.04
8
9         strategy:
10             matrix:
11                 postgresql: [9.5, 13]
12                 include:
13                     - postgresql: 9.5
14                       postgis: 2.5
15                     - postgresql: 13
16                       postgis: 3
17
18         steps:
19             - uses: actions/checkout@v2
20               with:
21                   submodules: true
22                   path: Nominatim
23
24             - name: Setup PHP
25               uses: shivammathur/setup-php@v2
26               with:
27                   php-version: '7.4'
28                   tools: phpunit, phpcs
29
30             - name: Get Date
31               id: get-date
32               run: |
33                   echo "::set-output name=date::$(/bin/date -u "+%Y%W")"
34               shell: bash
35
36             - uses: actions/cache@v2
37               with:
38                   path: |
39                      country_grid.sql.gz
40                   key: nominatim-country-data-${{ steps.get-date.outputs.date }}
41
42             - uses: ./Nominatim/.github/actions/setup-postgresql
43               with:
44                   postgresql-version: ${{ matrix.postgresql }}
45                   postgis-version: ${{ matrix.postgis }}
46             - uses: ./Nominatim/.github/actions/build-nominatim
47
48             - name: Install test prerequsites
49               run: sudo apt-get install -y -qq php-codesniffer pylint python3-pytest python3-behave
50
51             - name: PHP linting
52               run: phpcs --report-width=120 .
53               working-directory: Nominatim
54
55             - name: Python linting
56               run: pylint --extension-pkg-whitelist=osmium nominatim
57               working-directory: Nominatim
58
59             - name: PHP unit tests
60               run: phpunit ./
61               working-directory: Nominatim/test/php
62
63             - name: Python unit tests
64               run: py.test-3 test/python
65               working-directory: Nominatim
66
67             - name: BDD tests
68               run: behave -DREMOVE_TEMPLATE=1 -DBUILDDIR=$GITHUB_WORKSPACE/build --format=progress3
69               working-directory: Nominatim/test/bdd
70
71     import:
72         strategy:
73             matrix:
74                 ubuntu: [18, 20]
75                 include:
76                     - ubuntu: 18
77                       postgresql: 9.5
78                       postgis: 2.5
79                     - ubuntu: 20
80                       postgresql: 13
81                       postgis: 3
82
83         runs-on: ubuntu-${{ matrix.ubuntu }}.04
84
85         steps:
86             - uses: actions/checkout@v2
87               with:
88                   submodules: true
89                   path: Nominatim
90
91             - name: Get Date
92               id: get-date
93               run: |
94                   echo "::set-output name=date::$(/bin/date -u "+%Y%W")"
95               shell: bash
96
97             - uses: actions/cache@v2
98               with:
99                   path: |
100                      country_grid.sql.gz
101                   key: nominatim-country-data-${{ steps.get-date.outputs.date }}
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             - uses: actions/setup-python@v2
110               with:
111                 python-version: 3.5
112               if: matrix.ubuntu == 18
113
114             - uses: ./Nominatim/.github/actions/setup-postgresql
115               with:
116                   postgresql-version: ${{ matrix.postgresql }}
117                   postgis-version: ${{ matrix.postgis }}
118             - uses: ./Nominatim/.github/actions/build-nominatim
119
120             - name: Install extra dependencies for Ubuntu 18
121               run: |
122                 sudo apt-get install libicu-dev
123                 pip3 install python-dotenv psycopg2==2.7.7 jinja2==2.8 psutil==5.4.2 pyicu osmium
124               shell: bash
125               if: matrix.ubuntu == 18
126
127             - name: Clean installation
128               run: rm -rf Nominatim build
129               shell: bash
130
131             - name: Prepare import environment
132               run: |
133                   if [ ! -f monaco-latest.osm.pbf ]; then
134                       wget --no-verbose https://download.geofabrik.de/europe/monaco-latest.osm.pbf
135                   fi
136                   mkdir data-env
137                   cd data-env
138               shell: bash
139
140             - name: Import
141               run: nominatim import --osm-file ../monaco-latest.osm.pbf
142               shell: bash
143               working-directory: data-env
144
145             - name: Import special phrases
146               run: nominatim special-phrases --import-from-wiki
147               working-directory: data-env
148
149             - name: Check import
150               run: nominatim admin --check-database
151               working-directory: data-env
152
153             - name: Warm up database
154               run: nominatim admin --warm
155               working-directory: data-env
156
157             - name: Run update
158               run: |
159                    nominatim replication --init
160                    nominatim replication --once
161               working-directory: data-env
162
163             - name: Run reverse-only import
164               run : nominatim import --osm-file ../monaco-latest.osm.pbf --reverse-only
165               working-directory: data-env
166               env:
167                   NOMINATIM_DATABASE_DSN: pgsql:dbname=reverse