.travis.yml 3.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061
  1. language: go
  2. go:
  3. - 1.1
  4. - 1.2
  5. - 1.3
  6. - 1.4
  7. - tip
  8. before_install:
  9. - psql --version
  10. - sudo /etc/init.d/postgresql stop
  11. - sudo apt-get -y --purge remove postgresql libpq-dev libpq5 postgresql-client-common postgresql-common
  12. - sudo rm -rf /var/lib/postgresql
  13. - wget --quiet -O - https://www.postgresql.org/media/keys/ACCC4CF8.asc | sudo apt-key add -
  14. - sudo sh -c "echo deb http://apt.postgresql.org/pub/repos/apt/ $(lsb_release -cs)-pgdg main $PGVERSION >> /etc/apt/sources.list.d/postgresql.list"
  15. - sudo apt-get update -qq
  16. - sudo apt-get -y -o Dpkg::Options::=--force-confdef -o Dpkg::Options::="--force-confnew" install postgresql-$PGVERSION postgresql-server-dev-$PGVERSION postgresql-contrib-$PGVERSION
  17. - sudo chmod 777 /etc/postgresql/$PGVERSION/main/pg_hba.conf
  18. - echo "local all postgres trust" > /etc/postgresql/$PGVERSION/main/pg_hba.conf
  19. - echo "local all all trust" >> /etc/postgresql/$PGVERSION/main/pg_hba.conf
  20. - echo "hostnossl all pqgossltest 127.0.0.1/32 reject" >> /etc/postgresql/$PGVERSION/main/pg_hba.conf
  21. - echo "hostnossl all pqgosslcert 127.0.0.1/32 reject" >> /etc/postgresql/$PGVERSION/main/pg_hba.conf
  22. - echo "hostssl all pqgossltest 127.0.0.1/32 trust" >> /etc/postgresql/$PGVERSION/main/pg_hba.conf
  23. - echo "hostssl all pqgosslcert 127.0.0.1/32 cert" >> /etc/postgresql/$PGVERSION/main/pg_hba.conf
  24. - echo "host all all 127.0.0.1/32 trust" >> /etc/postgresql/$PGVERSION/main/pg_hba.conf
  25. - echo "hostnossl all pqgossltest ::1/128 reject" >> /etc/postgresql/$PGVERSION/main/pg_hba.conf
  26. - echo "hostnossl all pqgosslcert ::1/128 reject" >> /etc/postgresql/$PGVERSION/main/pg_hba.conf
  27. - echo "hostssl all pqgossltest ::1/128 trust" >> /etc/postgresql/$PGVERSION/main/pg_hba.conf
  28. - echo "hostssl all pqgosslcert ::1/128 cert" >> /etc/postgresql/$PGVERSION/main/pg_hba.conf
  29. - echo "host all all ::1/128 trust" >> /etc/postgresql/$PGVERSION/main/pg_hba.conf
  30. - sudo install -o postgres -g postgres -m 600 -t /var/lib/postgresql/$PGVERSION/main/ certs/server.key certs/server.crt certs/root.crt
  31. - sudo bash -c "[[ '${PGVERSION}' < '9.2' ]] || (echo \"ssl_cert_file = 'server.crt'\" >> /etc/postgresql/$PGVERSION/main/postgresql.conf)"
  32. - sudo bash -c "[[ '${PGVERSION}' < '9.2' ]] || (echo \"ssl_key_file = 'server.key'\" >> /etc/postgresql/$PGVERSION/main/postgresql.conf)"
  33. - sudo bash -c "[[ '${PGVERSION}' < '9.2' ]] || (echo \"ssl_ca_file = 'root.crt'\" >> /etc/postgresql/$PGVERSION/main/postgresql.conf)"
  34. - sudo sh -c "echo 127.0.0.1 postgres >> /etc/hosts"
  35. - sudo ls -l /var/lib/postgresql/$PGVERSION/main/
  36. - sudo cat /etc/postgresql/$PGVERSION/main/postgresql.conf
  37. - sudo chmod 600 $PQSSLCERTTEST_PATH/postgresql.key
  38. - sudo /etc/init.d/postgresql restart
  39. env:
  40. global:
  41. - PGUSER=postgres
  42. - PQGOSSLTESTS=1
  43. - PQSSLCERTTEST_PATH=$PWD/certs
  44. matrix:
  45. - PGVERSION=9.4
  46. - PGVERSION=9.3
  47. - PGVERSION=9.2
  48. - PGVERSION=9.1
  49. - PGVERSION=9.0
  50. - PGVERSION=8.4
  51. script:
  52. - go test -v ./...
  53. before_script:
  54. - psql -c 'create database pqgotest' -U postgres
  55. - psql -c 'create user pqgossltest' -U postgres
  56. - psql -c 'create user pqgosslcert' -U postgres