]> git.openstreetmap.org Git - nominatim.git/blob - .github/workflows/ci-tests.yml
dd97aefa12fb9c24296047296890248832490728
[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: Get Date
24               id: get-date
25               run: |
26                   echo "::set-output name=date::$(/bin/date -u "+%Y%W")"
27               shell: bash
28
29             - uses: actions/cache@v2
30               with:
31                   path: |
32                       data/country_osm_grid.sql.gz
33                       monaco-latest.osm.pbf
34                   key: nominatim-data-${{ steps.get-date.outputs.date }}
35
36             - uses: ./.github/actions/setup-postgresql
37               with:
38                   postgresql-version: ${{ matrix.postgresql }}
39                   postgis-version: ${{ matrix.postgis }}
40             - uses: ./.github/actions/build-nominatim
41
42             - name: Install test prerequsites
43               run: |
44                    sudo apt-get install -y -qq php-codesniffer python3-tidylib
45                    sudo pip3 install behave nose
46
47             - name: PHP linting
48               run: phpcs --report-width=120 .
49
50             - name: PHP unit tests
51               run: phpunit ./
52               working-directory: test/php
53
54             - name: BDD tests
55               run: behave -DREMOVE_TEMPLATE=1 --format=progress3 db osm2pgsql
56               working-directory: test/bdd
57
58     import:
59         runs-on: ubuntu-20.04
60
61         steps:
62             - uses: actions/checkout@v2
63               with:
64                   submodules: true
65
66             - name: Get Date
67               id: get-date
68               run: |
69                   echo "::set-output name=date::$(/bin/date -u "+%Y%W")"
70               shell: bash
71
72             - uses: actions/cache@v2
73               with:
74                   path: |
75                       data/country_osm_grid.sql.gz
76                       monaco-latest.osm.pbf
77                   key: nominatim-data-${{ steps.get-date.outputs.date }}
78
79             - uses: ./.github/actions/setup-postgresql
80               with:
81                   postgresql-version: 13
82                   postgis-version: 3
83             - uses: ./.github/actions/build-nominatim
84
85             - name: Create configuration
86               run: |
87                    echo '<?php' > settings/local.php
88                    echo " @define('CONST_Pyosmium_Binary', '/usr/lib/python3-pyosmium/pyosmium-get-changes');" >> settings/local.php
89               working-directory: build
90
91             - name: Download import data
92               run: |
93                   if [ ! -f monaco-latest.osm.pbf ]; then
94                       wget --no-verbose https://download.geofabrik.de/europe/monaco-latest.osm.pbf
95                   fi
96               shell: bash
97
98             - name: Import
99               run: php ./utils/setup.php --osm-file ../monaco-latest.osm.pbf --osm2pgsql-cache 500 --all
100               working-directory: build
101
102             - name: Import special phrases
103               run: php ./utils/specialphrases.php --wiki-import | psql -d nominatim
104               working-directory: build
105
106             - name: Check import
107               run: php ./utils/check_import_finished.php
108               working-directory: build
109
110             - name: Run update
111               run: |
112                    php ./utils/update.php --init-updates
113                    php ./utils/update.php --import-osmosis
114               working-directory: build
115
116             - name: Run reverse-only import
117               run : |
118                   dropdb nominatim
119                   php ./utils/setup.php --osm-file ../monaco-latest.osm.pbf --reverse-only --all
120               working-directory: build