diff --git a/.travis.yml b/.travis.yml new file mode 100644 index 0000000..cfd9c52 --- /dev/null +++ b/.travis.yml @@ -0,0 +1,52 @@ +language: c + +before_install: + - ./check-up-to-date-with-master.sh + - sudo apt-get -y install python-pip + + - sudo apt-get -y install python-software-properties + - sudo add-apt-repository -y ppa:cartodb/sci + - sudo add-apt-repository -y ppa:cartodb/postgresql-9.5 + - sudo add-apt-repository -y ppa:cartodb/gis + - sudo add-apt-repository -y ppa:cartodb/gis-testing + - sudo apt-get update + + - sudo apt-get -y install python-joblib=0.8.3-1-cdb1 + - sudo apt-get -y install python-numpy=1:1.6.1-6ubuntu1 + + # Install pysal + - sudo pip install -I pysal==1.11.2 + + - sudo apt-get -y install python-scipy=0.14.0-2-cdb6 + - sudo apt-get -y --no-install-recommends install python-sklearn-lib=0.14.1-3-cdb2 + - sudo apt-get -y --no-install-recommends install python-sklearn=0.14.1-3-cdb2 + - sudo apt-get -y --no-install-recommends install python-scikits-learn=0.14.1-3-cdb2 + + # Force instalation of libgeos-3.5.0 (presumably needed because of existing version of postgis) + - sudo apt-get -y install libgeos-3.5.0=3.5.0-1cdb2 + + # Install postgres db and build deps + - sudo /etc/init.d/postgresql stop # stop travis default instance + - sudo apt-get -y remove --purge postgresql-9.1 + - sudo apt-get -y remove --purge postgresql-9.2 + - sudo apt-get -y remove --purge postgresql-9.3 + - sudo apt-get -y remove --purge postgresql-9.4 + - sudo apt-get -y remove --purge postgis + - sudo apt-get -y autoremove + + - sudo apt-get -y install postgresql-9.5=9.5.2-2ubuntu1 + - sudo apt-get -y install postgresql-server-dev-9.5=9.5.2-2ubuntu1 + - sudo apt-get -y install postgresql-plpython-9.5=9.5.2-2ubuntu1 + - sudo apt-get -y install postgresql-9.5-postgis-2.2=2.2.2.0-cdb2 + - sudo apt-get -y install postgresql-9.5-postgis-scripts=2.2.2.0-cdb2 + + # configure it to accept local connections from postgres + - echo -e "# TYPE DATABASE USER ADDRESS METHOD \nlocal all postgres trust\nlocal all all trust\nhost all all 127.0.0.1/32 trust" \ + | sudo tee /etc/postgresql/9.5/main/pg_hba.conf + - sudo /etc/init.d/postgresql restart 9.5 + +install: + - sudo make install + +script: + - make test || { cat src/pg/test/regression.diffs; false; } diff --git a/README.md b/README.md index 0ff9090..ee72c18 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,4 @@ -# crankshaft +# crankshaft [![Build Status](https://travis-ci.org/CartoDB/crankshaft.svg?branch=develop)](https://travis-ci.org/CartoDB/crankshaft) CartoDB Spatial Analysis extension for PostgreSQL. diff --git a/check-up-to-date-with-master.sh b/check-up-to-date-with-master.sh new file mode 100755 index 0000000..af4b8b4 --- /dev/null +++ b/check-up-to-date-with-master.sh @@ -0,0 +1,16 @@ +#!/bin/bash + +# Add remote-master +git remote add -t master remote-master https://github.com/CartoDB/crankshaft.git + +# Fetch master reference +git fetch --depth=1 remote-master master + +# Compare HEAD with master +# NOTE: travis by default uses --depth=50 so we are actually checking that the tip +# of the branch is no more than 50 commits away from master as well. +git rev-list HEAD | grep $(git rev-parse remote-master/master) || + { echo "Your branch is not up to date with latest release"; + echo "Please update it by running the following:"; + echo " git fetch && git merge origin/develop"; + false; } diff --git a/src/pg/test/expected/01_install_test.out b/src/pg/test/expected/01_install_test.out index e84a48a..c8a763e 100644 --- a/src/pg/test/expected/01_install_test.out +++ b/src/pg/test/expected/01_install_test.out @@ -1,5 +1,18 @@ -- Install dependencies CREATE EXTENSION plpythonu; -CREATE EXTENSION postgis; +CREATE EXTENSION postgis VERSION '2.2.2'; +-- Create role publicuser if it does not exist +DO +$$ +BEGIN + IF NOT EXISTS ( + SELECT * + FROM pg_catalog.pg_user + WHERE usename = 'publicuser') THEN + + CREATE ROLE publicuser LOGIN; + END IF; +END +$$ LANGUAGE plpgsql; -- Install the extension CREATE EXTENSION crankshaft VERSION 'dev'; diff --git a/src/pg/test/sql/01_install_test.sql b/src/pg/test/sql/01_install_test.sql index bbce805..c90ea59 100644 --- a/src/pg/test/sql/01_install_test.sql +++ b/src/pg/test/sql/01_install_test.sql @@ -1,6 +1,20 @@ -- Install dependencies CREATE EXTENSION plpythonu; -CREATE EXTENSION postgis; +CREATE EXTENSION postgis VERSION '2.2.2'; + +-- Create role publicuser if it does not exist +DO +$$ +BEGIN + IF NOT EXISTS ( + SELECT * + FROM pg_catalog.pg_user + WHERE usename = 'publicuser') THEN + + CREATE ROLE publicuser LOGIN; + END IF; +END +$$ LANGUAGE plpgsql; -- Install the extension CREATE EXTENSION crankshaft VERSION 'dev';