]> git.openstreetmap.org Git - nominatim.git/blob - .github/workflows/ci-tests.yml
9bdf1790dcccc7e91969a7c4f7797172b4822309
[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
23             - name: Setup PHP
24               uses: shivammathur/setup-php@v2
25               with:
26                   php-version: '7.4'
27                   tools: phpunit, phpcs
28
29             - name: Get Date
30               id: get-date
31               run: |
32                   echo "::set-output name=date::$(/bin/date -u "+%Y%W")"
33               shell: bash
34
35             - uses: actions/cache@v2
36               with:
37                   path: |
38                      data/country_osm_grid.sql.gz
39                      monaco-latest.osm.pbf
40                   key: nominatim-data-${{ steps.get-date.outputs.date }}
41
42             - uses: ./.github/actions/setup-postgresql
43               with:
44                   postgresql-version: ${{ matrix.postgresql }}
45                   postgis-version: ${{ matrix.postgis }}
46             - uses: ./.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
54             - name: Python linting
55               run: pylint --extension-pkg-whitelist=osmium nominatim
56
57             - name: PHP unit tests
58               run: phpunit ./
59               working-directory: test/php
60
61             - name: Python unit tests
62               run: py.test-3 test/python
63
64             - name: BDD tests
65               run: behave -DREMOVE_TEMPLATE=1 --format=progress3
66               working-directory: test/bdd
67
68     import:
69         runs-on: ubuntu-20.04
70
71         steps:
72             - uses: actions/checkout@v2
73               with:
74                   submodules: true
75
76             - name: Get Date
77               id: get-date
78               run: |
79                   echo "::set-output name=date::$(/bin/date -u "+%Y%W")"
80               shell: bash
81
82             - uses: actions/cache@v2
83               with:
84                   path: |
85                      data/country_osm_grid.sql.gz
86                      monaco-latest.osm.pbf
87                   key: nominatim-data-${{ steps.get-date.outputs.date }}
88
89             - uses: ./.github/actions/setup-postgresql
90               with:
91                   postgresql-version: 13
92                   postgis-version: 3
93             - uses: ./.github/actions/build-nominatim
94
95             - name: Download import data
96               run: |
97                   if [ ! -f monaco-latest.osm.pbf ]; then
98                       wget --no-verbose https://download.geofabrik.de/europe/monaco-latest.osm.pbf
99                   fi
100               shell: bash
101
102             - name: Import
103               run: ./nominatim import --osm-file ../monaco-latest.osm.pbf
104               working-directory: build
105
106             - name: Import special phrases
107               run: ./nominatim special-phrases --from-wiki | psql -d nominatim
108               working-directory: build
109
110             - name: Check import
111               run: ./nominatim check-database
112               working-directory: build
113
114             - name: Run update
115               run: |
116                    ./nominatim replication --init
117                    ./nominatim replication --once
118               working-directory: build
119
120             - name: Run reverse-only import
121               run : |
122                   dropdb nominatim
123                   php ./nominatim import --osm-file ../monaco-latest.osm.pbf --reverse-only
124               working-directory: build