]> git.openstreetmap.org Git - nominatim.git/blob - .github/workflows/ci-tests.yml
Merge pull request #2160 from lonvia/introduce-project-dir
[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: |
104                   mkdir data-env
105                   cd data-env
106                   ../build/nominatim import --osm-file ../monaco-latest.osm.pbf
107               shell: bash
108
109             - name: Import special phrases
110               run: ../build/nominatim special-phrases --from-wiki | psql -d nominatim
111               working-directory: data-env
112
113             - name: Check import
114               run: ../build/nominatim check-database
115               working-directory: data-env
116
117             - name: Run update
118               run: |
119                    ../build/nominatim replication --init
120                    ../build/nominatim replication --once
121               working-directory: data-env
122
123             - name: Run reverse-only import
124               run : |
125                   echo 'NOMINATIM_DATABASE_DSN="pgsql:dbname=reverse"' > .env
126                   ../build/nominatim import --osm-file ../monaco-latest.osm.pbf --reverse-only
127               working-directory: data-env