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