2020-04-09 19:03:40 +08:00
|
|
|
sudo: false
|
|
|
|
|
|
|
|
language: node_js
|
|
|
|
|
2019-04-10 19:06:39 +08:00
|
|
|
services:
|
2020-04-09 19:03:40 +08:00
|
|
|
- redis-server
|
|
|
|
|
|
|
|
env:
|
|
|
|
global:
|
|
|
|
- PGUSER=postgres
|
|
|
|
- PGDATABASE=postgres
|
|
|
|
- PGOPTIONS='-c client_min_messages=NOTICE'
|
|
|
|
|
|
|
|
jobs:
|
|
|
|
include:
|
|
|
|
- env: POSTGRESQL_VERSION="10" POSTGIS_VERSION="2.4"
|
|
|
|
dist: xenial
|
|
|
|
- env: POSTGRESQL_VERSION="11" POSTGIS_VERSION="2.5"
|
|
|
|
dist: xenial
|
|
|
|
- env: POSTGRESQL_VERSION="12" POSTGIS_VERSION="3"
|
|
|
|
dist: bionic
|
|
|
|
|
|
|
|
node_js:
|
2020-05-14 19:00:23 +08:00
|
|
|
- "12"
|
2020-04-09 19:03:40 +08:00
|
|
|
|
|
|
|
install:
|
|
|
|
- npm ci
|
|
|
|
|
|
|
|
script:
|
2020-05-14 22:15:20 +08:00
|
|
|
# Ensure dev dependencies are installed
|
|
|
|
- sudo apt-get install -y libpangocairo-1.0-0 libpango1.0-dev pkg-config
|
|
|
|
|
|
|
|
# Remove old packages
|
|
|
|
- sudo apt-get remove postgresql-$POSTGRESQL_VERSION postgresql-client-$POSTGRESQL_VERSION postgresql-server-dev-$POSTGRESQL_VERSION postgresql-common postgresql-client-common postgresql-$POSTGRESQL_VERSION-postgis-$POSTGIS_VERSION postgresql-$POSTGRESQL_VERSION-postgis-$POSTGIS_VERSION-scripts postgis
|
|
|
|
|
|
|
|
# Install CARTO packages
|
2020-04-09 19:03:40 +08:00
|
|
|
- if [[ $POSTGRESQL_VERSION == '10' ]]; then sudo add-apt-repository -y ppa:cartodb/gis; fi;
|
|
|
|
- sudo add-apt-repository -y ppa:cartodb/postgresql-$POSTGRESQL_VERSION
|
|
|
|
- sudo apt-get -q update
|
2020-05-14 22:15:20 +08:00
|
|
|
# We use -t $TRAVIS_DIST to give preference to our ppa's (which are called as the ${dist}), instead of
|
|
|
|
# pgdg repos (which are called ${dist}-pgdg. Nasty but it works.
|
|
|
|
- sudo apt-get install -y --allow-unauthenticated --no-install-recommends --no-install-suggests postgresql-$POSTGRESQL_VERSION postgresql-client-$POSTGRESQL_VERSION postgresql-server-dev-$POSTGRESQL_VERSION postgresql-common postgresql-$POSTGRESQL_VERSION-postgis-$POSTGIS_VERSION postgresql-$POSTGRESQL_VERSION-postgis-$POSTGIS_VERSION-scripts postgis -t $TRAVIS_DIST
|
|
|
|
# For pre12, install plpython2. For PG12 install plpython3
|
|
|
|
- if [[ $POSTGRESQL_VERSION != '12' ]]; then sudo apt-get install -y postgresql-plpython-$POSTGRESQL_VERSION python python-redis -t $TRAVIS_DIST; else sudo apt-get install -y postgresql-plpython3-12 python3 python3-redis -t $TRAVIS_DIST; fi;
|
|
|
|
|
|
|
|
# Remove old clusters and create the new one
|
|
|
|
- for i in $(pg_lsclusters | tail -n +2 | awk '{print $1}'); do sudo pg_dropcluster --stop $i main; done;
|
2020-04-09 19:03:40 +08:00
|
|
|
- sudo rm -rf /etc/postgresql/$POSTGRESQL_VERSION /var/lib/postgresql/$POSTGRESQL_VERSION /var/ramfs/postgresql/$POSTGRESQL_VERSION
|
|
|
|
- sudo pg_createcluster -u postgres $POSTGRESQL_VERSION main --start -p 5432 -- --auth-local trust
|
|
|
|
|
|
|
|
- git clone https://github.com/CartoDB/cartodb-postgresql.git
|
|
|
|
- cd cartodb-postgresql && make && sudo make install && cd ..
|
|
|
|
|
|
|
|
- createdb template_postgis
|
|
|
|
- psql -c "CREATE EXTENSION postgis" template_postgis
|
|
|
|
- if [[ $POSTGRESQL_VERSION == '12' ]]; then psql -c "CREATE EXTENSION postgis_raster" template_postgis; fi;
|
|
|
|
|
|
|
|
- cp config/environments/test.js.example config/environments/test.js
|
|
|
|
- npm test
|
|
|
|
|
|
|
|
after_failure:
|
|
|
|
- pg_lsclusters
|
|
|
|
- sudo cat /var/log/postgresql/postgresql-$POSTGRESQL_VERSION-main.log
|