]> git.openstreetmap.org Git - nominatim.git/blob - .github/workflows/ci-tests.yml
remove default parameter for namedtuple
[nominatim.git] / .github / workflows / ci-tests.yml
1 name: CI Tests
2
3 on: [ push, pull_request ]
4
5 jobs:
6     tests:
7         strategy:
8             matrix:
9                 ubuntu: [18, 20]
10                 include:
11                     - ubuntu: 18
12                       postgresql: 9.5
13                       postgis: 2.5
14                       pytest: pytest
15                     - ubuntu: 20
16                       postgresql: 13
17                       postgis: 3
18                       pytest: py.test-3
19
20         runs-on: ubuntu-${{ matrix.ubuntu }}.04
21
22         steps:
23             - uses: actions/checkout@v2
24               with:
25                   submodules: true
26                   path: Nominatim
27
28             - name: Setup PHP
29               uses: shivammathur/setup-php@v2
30               with:
31                   php-version: '7.4'
32                   tools: phpunit, phpcs, composer
33
34             - uses: actions/setup-python@v2
35               with:
36                 python-version: 3.6
37               if: matrix.ubuntu == 18
38
39             - name: Get Date
40               id: get-date
41               run: |
42                   echo "::set-output name=date::$(/bin/date -u "+%Y%W")"
43               shell: bash
44
45             - uses: actions/cache@v2
46               with:
47                   path: |
48                      country_grid.sql.gz
49                   key: nominatim-country-data-${{ steps.get-date.outputs.date }}
50
51             - uses: ./Nominatim/.github/actions/setup-postgresql
52               with:
53                   postgresql-version: ${{ matrix.postgresql }}
54                   postgis-version: ${{ matrix.postgis }}
55
56             - uses: ./Nominatim/.github/actions/build-nominatim
57               with:
58                   ubuntu: ${{ matrix.ubuntu }}
59
60             - name: Install test prerequsites
61               run: sudo apt-get install -y -qq php-codesniffer pylint python3-pytest python3-behave python3-pytest-cov php-codecoverage php-xdebug
62               if: matrix.ubuntu == 20
63
64             - name: Install test prerequsites
65               run: |
66                    sudo apt-get install -y -qq php-codesniffer php-codecoverage php-xdebug
67                    pip3 install pylint==2.6.0 pytest pytest-cov behave==1.2.6
68               if: matrix.ubuntu == 18
69
70             - name: PHP linting
71               run: phpcs --report-width=120 .
72               working-directory: Nominatim
73
74             - name: Python linting
75               run: pylint nominatim
76               working-directory: Nominatim
77
78             - name: PHP unit tests
79               run: phpunit --coverage-clover ../../coverage-php.xml ./
80               working-directory: Nominatim/test/php
81
82             - name: Python unit tests
83               run: $PYTEST --cov=nominatim --cov-report=xml test/python
84               working-directory: Nominatim
85               env:
86                 PYTEST: ${{ matrix.pytest }}
87
88             - name: BDD tests
89               run: |
90                   mkdir cov
91                   behave -DREMOVE_TEMPLATE=1 -DBUILDDIR=$GITHUB_WORKSPACE/build --format=progress3 -DPHPCOV=./cov
92                   composer require phpunit/phpcov:7.0.2
93                   vendor/bin/phpcov merge --clover ../../coverage-bdd.xml ./cov
94               working-directory: Nominatim/test/bdd
95
96             - name: BDD tests (legacy_icu tokenizer)
97               run: |
98                   behave -DREMOVE_TEMPLATE=1 -DBUILDDIR=$GITHUB_WORKSPACE/build -DTOKENIZER=legacy_icu --format=progress3
99               working-directory: Nominatim/test/bdd
100
101             - name: Upload coverage to Codecov
102               uses: codecov/codecov-action@v1
103               with:
104                 files: ./Nominatim/coverage*.xml
105                 directory: ./
106                 name: codecov-umbrella
107                 fail_ci_if_error: false
108                 path_to_write_report: ./coverage/codecov_report.txt
109                 verbose: true
110
111     import:
112         strategy:
113             matrix:
114                 ubuntu: [18, 20]
115                 include:
116                     - ubuntu: 18
117                       postgresql: 9.5
118                       postgis: 2.5
119                     - ubuntu: 20
120                       postgresql: 13
121                       postgis: 3
122
123         runs-on: ubuntu-${{ matrix.ubuntu }}.04
124
125         steps:
126             - uses: actions/checkout@v2
127               with:
128                   submodules: true
129                   path: Nominatim
130
131             - name: Get Date
132               id: get-date
133               run: |
134                   echo "::set-output name=date::$(/bin/date -u "+%Y%W")"
135               shell: bash
136
137             - uses: actions/cache@v2
138               with:
139                   path: |
140                      country_grid.sql.gz
141                   key: nominatim-country-data-${{ steps.get-date.outputs.date }}
142
143             - uses: actions/cache@v2
144               with:
145                   path: |
146                      monaco-latest.osm.pbf
147                   key: nominatim-test-data-${{ steps.get-date.outputs.date }}
148
149             - uses: actions/setup-python@v2
150               with:
151                 python-version: 3.6
152               if: matrix.ubuntu == 18
153
154             - uses: ./Nominatim/.github/actions/setup-postgresql
155               with:
156                   postgresql-version: ${{ matrix.postgresql }}
157                   postgis-version: ${{ matrix.postgis }}
158             - uses: ./Nominatim/.github/actions/build-nominatim
159               with:
160                   ubuntu: ${{ matrix.ubuntu }}
161
162             - name: Clean installation
163               run: rm -rf Nominatim build
164               shell: bash
165
166             - name: Prepare import environment
167               run: |
168                   if [ ! -f monaco-latest.osm.pbf ]; then
169                       wget --no-verbose https://download.geofabrik.de/europe/monaco-latest.osm.pbf
170                   fi
171                   mkdir data-env
172                   cd data-env
173               shell: bash
174
175             - name: Import
176               run: nominatim import --osm-file ../monaco-latest.osm.pbf
177               shell: bash
178               working-directory: data-env
179
180             - name: Import special phrases
181               run: nominatim special-phrases --import-from-wiki
182               working-directory: data-env
183
184             - name: Check full import
185               run: nominatim admin --check-database
186               working-directory: data-env
187
188             - name: Warm up database
189               run: nominatim admin --warm
190               working-directory: data-env
191
192             - name: Run update
193               run: |
194                    nominatim replication --init
195                    nominatim replication --once
196               working-directory: data-env
197
198             - name: Run reverse-only import
199               run : nominatim import --osm-file ../monaco-latest.osm.pbf --reverse-only --no-updates
200               working-directory: data-env
201               env:
202                   NOMINATIM_DATABASE_DSN: pgsql:dbname=reverse
203
204             - name: Check reverse import
205               run: nominatim admin --check-database
206               working-directory: data-env