]> git.openstreetmap.org Git - nominatim.git/blob - .github/workflows/ci-tests.yml
8dd19aa4621c057cd11c726531dd4ab007f3607e
[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                      {{ github.workspace }}/data/country_osm_grid.sql.gz
39                      {{ github.workspace }}/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: |
50                    sudo apt-get install -y -qq php-codesniffer python3-tidylib php-symfony-dotenv
51                    sudo pip3 install behave
52
53             - name: PHP linting
54               run: phpcs --report-width=120 .
55
56             - name: PHP unit tests
57               run: phpunit ./
58               working-directory: test/php
59
60             - name: BDD tests
61               run: behave -DREMOVE_TEMPLATE=1 --format=progress3
62               working-directory: test/bdd
63
64     import:
65         runs-on: ubuntu-20.04
66
67         steps:
68             - uses: actions/checkout@v2
69               with:
70                   submodules: true
71
72             - name: Get Date
73               id: get-date
74               run: |
75                   echo "::set-output name=date::$(/bin/date -u "+%Y%W")"
76               shell: bash
77
78             - uses: actions/cache@v2
79               with:
80                   path: |
81                      {{ github.workspace }}/data/country_osm_grid.sql.gz
82                      {{ github.workspace }}/monaco-latest.osm.pbf
83                   key: nominatim-data-${{ steps.get-date.outputs.date }}
84
85             - uses: ./.github/actions/setup-postgresql
86               with:
87                   postgresql-version: 13
88                   postgis-version: 3
89             - uses: ./.github/actions/build-nominatim
90
91             - name: Create configuration
92               run: |
93                    echo "NOMINATIM_PYOSMIUM_BINARY=/usr/lib/python3-pyosmium/pyosmium-get-changes" >> .env
94               working-directory: build
95
96             - name: Download import data
97               run: |
98                   if [ ! -f monaco-latest.osm.pbf ]; then
99                       wget --no-verbose https://download.geofabrik.de/europe/monaco-latest.osm.pbf
100                   fi
101               shell: bash
102
103             - name: Import
104               run: ./nominatim import --osm-file ../monaco-latest.osm.pbf
105               working-directory: build
106
107             - name: Import special phrases
108               run: ./nominatim special-phrases --from-wiki | psql -d nominatim
109               working-directory: build
110
111             - name: Check import
112               run: ./nominatim check-database
113               working-directory: build
114
115             - name: Run update
116               run: |
117                    ./nominatim replication --init
118                    ./nominatim replication --once
119               working-directory: build
120
121             - name: Run reverse-only import
122               run : |
123                   dropdb nominatim
124                   php ./nominatim import --osm-file ../monaco-latest.osm.pbf --reverse-only
125               working-directory: build