tzj3cq
Last Updated: February 25, 2016
·
1.08K
· clkao
F0cc4b511c06b73afb23beb5695a83d6

smoking against different postgresql versions with travis-ci

If you are writing postgresql extensions, you might need to smoke against different versions of postgresql server. You can do this with the [pgdg apt repo], see plv8x for .travis.yml example

Basically it's something like:

before_install:
  - psql --version
  - sudo /etc/init.d/postgresql stop
  - sudo apt-get -y --purge remove postgresql libpq-dev libpq5 postgresql-client-common postgresql-common
  - sudo rm -rf /var/lib/postgresql
  - wget --quiet -O - https://www.postgresql.org/media/keys/ACCC4CF8.asc | sudo apt-key add -
  - sudo sh -c "echo deb http://apt.postgresql.org/pub/repos/apt/ precise-pgdg main $PGVERSION >> /etc/apt/sources.list.d/postgresql.list"
  - sudo apt-get update -qq
  - sudo apt-get -y -o Dpkg::Options::=--force-confdef -o Dpkg::Options::="--force-confnew" install postgresql-$PGVERSION postgresql-server-dev-$PGVERSION
  - sudo chmod 777 /etc/postgresql/$PGVERSION/main/pg_hba.conf
  - sudo echo "local   all         postgres                          trust" > /etc/postgresql/$PGVERSION/main/pg_hba.conf
  - sudo echo "local   all         all                               trust" >> /etc/postgresql/$PGVERSION/main/pg_hba.conf
  - sudo echo "host    all         all         127.0.0.1/32          trust" >> /etc/postgresql/$PGVERSION/main/pg_hba.conf
  - sudo echo "host    all         all         ::1/128               trust" >> /etc/postgresql/$PGVERSION/main/pg_hba.conf
  - sudo /etc/init.d/postgresql restart

before_script:
  - createuser -U postgres -s travis
  - psql -c 'create database test' -U postgres

script:
  - "TESTDBNAME=test npm run test"

language: node_js

env:
  - PGVERSION=9.2
  - PGVERSION=9.1
  - PGVERSION=9.0

node_js:
  - 0.10
Say Thanks
Respond