]> git.openstreetmap.org Git - nominatim.git/commitdiff
switch CI to github acitons
authorSarah Hoffmann <lonvia@denofr.de>
Tue, 27 Oct 2020 20:49:06 +0000 (21:49 +0100)
committerSarah Hoffmann <lonvia@denofr.de>
Wed, 28 Oct 2020 08:29:22 +0000 (09:29 +0100)
.github/actions/build-nominatim/action.yml [new file with mode: 0644]
.github/workflows/ci-tests.yml [new file with mode: 0644]
.travis.yml [deleted file]
vagrant/Install-on-Travis-CI.sh [deleted file]

diff --git a/.github/actions/build-nominatim/action.yml b/.github/actions/build-nominatim/action.yml
new file mode 100644 (file)
index 0000000..44c19a2
--- /dev/null
@@ -0,0 +1,25 @@
+name: 'Build Nominatim'
+
+runs:
+    using: "composite"
+
+    steps:
+            - name: Install prerequisits
+              run: sudo apt-get install -y -qq libboost-system-dev libboost-filesystem-dev libexpat1-dev zlib1g-dev libbz2-dev libpq-dev libproj-dev postgresql-13-postgis-3 postgresql-13-postgis-3-scripts postgresql-server-dev-13 python3-psycopg2 python3-pyosmium
+              shell: bash
+
+            - name: Configure
+              run: mkdir build && cd build && cmake ..
+              shell: bash
+
+            - name: Build
+              run: |
+                  make -j2 all
+                  ./utils/setup.php --setup-website
+              shell: bash
+              working-directory: build
+
+            - name: Download dependencies
+              run: wget -O data/country_osm_grid.sql.gz https://www.nominatim.org/data/country_grid.sql.gz
+              shell: bash
+
diff --git a/.github/workflows/ci-tests.yml b/.github/workflows/ci-tests.yml
new file mode 100644 (file)
index 0000000..c0db57b
--- /dev/null
@@ -0,0 +1,81 @@
+name: CI Tests
+
+on: [ push, pull_request ]
+
+jobs:
+    tests:
+        runs-on: ubuntu-20.04
+
+        steps:
+            - uses: actions/checkout@v2
+              with:
+                  submodules: true
+
+            - uses: ./.github/actions/build-nominatim
+
+            - name: Install test prerequsites
+              run: |
+                   sudo apt-get install -y -qq php-codesniffer python3-tidylib
+                   sudo pip3 install behave nose
+
+            - name: PHP linting
+              run: phpcs --report-width=120 .
+
+            - name: Setup database
+              run: |
+                  sudo systemctl start postgresql
+                  sudo -u postgres createuser -S www-data
+                  sudo -u postgres createuser -s runner
+              shell: bash
+
+            - name: PHP unit tests
+              run: phpunit ./
+              working-directory: test/php
+
+            - name: BDD tests
+              run: behave -DREMOVE_TEMPLATE=1 --format=progress3 db osm2pgsql
+              working-directory: test/bdd
+
+    import:
+        runs-on: ubuntu-20.04
+
+        steps:
+            - uses: actions/checkout@v2
+              with:
+                  submodules: true
+
+            - uses: ./.github/actions/build-nominatim
+
+            - name: Download test extract
+              run: wget --no-verbose https://download.geofabrik.de/europe/monaco-latest.osm.pbf
+
+            - name: Setup database
+              run: |
+                  sudo systemctl start postgresql
+                  sudo -u postgres createuser -S www-data
+                  sudo -u postgres createuser -s runner
+              shell: bash
+
+            - name: Create configuartion
+              run: |
+                   echo '<?php' > settings/local.php
+                   echo " @define('CONST_Pyosmium_Binary', '/usr/lib/python3-pyosmium/pyosmium-get-changes');" >> settings/local.php
+              working-directory: build
+
+            - name: Import
+              run: php ./utils/setup.php --osm-file ../monaco-latest.osm.pbf --osm2pgsql-cache 500 --all
+              working-directory: build
+
+            - name: Import special phrases
+              run: php ./utils/specialphrases.php --wiki-import | psql -d nominatim
+              working-directory: build
+
+            - name: Check import
+              run: php ./utils/check_import_finished.php
+              working-directory: build
+
+            - name: Run update
+              run: |
+                   php ./utils/update.php --init-updates
+                   php ./utils/update.php --import-osmosis
+              working-directory: build
diff --git a/.travis.yml b/.travis.yml
deleted file mode 100644 (file)
index b16d810..0000000
+++ /dev/null
@@ -1,40 +0,0 @@
----
-os: linux
-dist: focal
-addons:
-  postgresql: "12"
-  apt:
-    packages:
-      - postgresql-server-dev-12
-      - postgresql-12-postgis-3
-git:
-  depth: 3
-env:
-  - TEST_SUITE=tests
-  - TEST_SUITE=monaco
-before_install:
-  - phpenv global 7.4
-install:
-  - vagrant/Install-on-Travis-CI.sh
-before_script:
-  - psql -U postgres -c "create extension postgis"
-script:
-  - cd $TRAVIS_BUILD_DIR/
-  - if [[ $TEST_SUITE == "tests" ]]; then phpcs --report-width=120 . ; fi
-  - cd $TRAVIS_BUILD_DIR/test/php
-  - if [[ $TEST_SUITE == "tests" ]]; then /usr/bin/phpunit ./ ; fi
-  - cd $TRAVIS_BUILD_DIR/build
-  - /usr/bin/env php ./utils/setup.php --setup-website
-  - cd $TRAVIS_BUILD_DIR/test/bdd
-  - # behave --format=progress3 api
-  - if [[ $TEST_SUITE == "tests" ]]; then behave -DREMOVE_TEMPLATE=1 --format=progress3 db ; fi
-  - if [[ $TEST_SUITE == "tests" ]]; then behave --format=progress3 osm2pgsql ; fi
-  - cd $TRAVIS_BUILD_DIR/build
-  - if [[ $TEST_SUITE == "monaco" ]]; then wget --no-verbose --output-document=../data/monaco.osm.pbf http://download.geofabrik.de/europe/monaco-latest.osm.pbf; fi
-  - if [[ $TEST_SUITE == "monaco" ]]; then /usr/bin/env php ./utils/setup.php --osm-file ../data/monaco.osm.pbf --osm2pgsql-cache 1000 --all 2>&1 | grep -v 'ETA (seconds)'; fi
-  - if [[ $TEST_SUITE == "monaco" ]]; then /usr/bin/env php ./utils/specialphrases.php --wiki-import | psql -d test_api_nominatim >/dev/null; fi
-  - if [[ $TEST_SUITE == "monaco" ]]; then /usr/bin/env php ./utils/check_import_finished.php; fi
-  - if [[ $TEST_SUITE == "monaco" ]]; then /usr/bin/env php ./utils/update.php --init-updates; fi
-  - if [[ $TEST_SUITE == "monaco" ]]; then /usr/bin/env php ./utils/update.php --import-osmosis; fi
-notifications:
-  email: false
diff --git a/vagrant/Install-on-Travis-CI.sh b/vagrant/Install-on-Travis-CI.sh
deleted file mode 100755 (executable)
index 9c1fe36..0000000
+++ /dev/null
@@ -1,56 +0,0 @@
-#!/bin/bash
-
-# This script runs in a travis-ci.org virtual machine
-# https://docs.travis-ci.com/user/reference/focal/
-# Ubuntu 20 (focal)
-# user 'travis'
-# $TRAVIS_BUILD_DIR is /home/travis/build/openstreetmap/Nominatim/, for others see
-#   https://docs.travis-ci.com/user/environment-variables/#Default-Environment-Variables
-# Postgres 12 installed and started. role 'travis' already superuser
-# Python 3.8
-# Travis has a 4 MB, 10000 line output limit, so where possible we run script --quiet
-
-
-sudo apt-get update -qq
-
-sudo apt-get install -y -qq build-essential cmake g++ libboost-dev libboost-system-dev \
-                            libboost-filesystem-dev libexpat1-dev zlib1g-dev \
-                            libbz2-dev libpq-dev libproj-dev \
-                            postgresql-server-dev-12 postgresql-12-postgis-3 \
-                            postgresql-contrib postgresql-12-postgis-3-scripts \
-                            php php-pgsql \
-                            php-intl python3-setuptools python3-dev python3-pip \
-                            python3-psycopg2 python3-tidylib git
-
-sudo apt-get install -y -qq php-cgi
-
-pip3 install --quiet behave nose osmium
-
-# https://github.com/squizlabs/PHP_CodeSniffer
-composer global require "squizlabs/php_codesniffer=*"
-sudo ln -s /home/travis/.config/composer/vendor/bin/phpcs /usr/bin/
-
-composer global require "phpunit/phpunit=7.*"
-sudo ln -s /home/travis/.config/composer/vendor/bin/phpunit /usr/bin/
-
-sudo -u postgres createuser -S www-data
-
-# Make sure that system servers can read from the home directory:
-chmod a+x $HOME
-chmod a+x $TRAVIS_BUILD_DIR
-
-wget -O $TRAVIS_BUILD_DIR/data/country_osm_grid.sql.gz https://www.nominatim.org/data/country_grid.sql.gz
-
-mkdir build
-cd build
-cmake $TRAVIS_BUILD_DIR
-make
-
-
-tee settings/local.php << EOF
-<?php
- @define('CONST_Database_DSN', 'pgsql:dbname=test_api_nominatim');
- @define('CONST_Wikipedia_Data_Path', CONST_BasePath.'/test/testdb');
- @define('CONST_Replication_Max_Diff_size', '3');
-EOF
-