Skip to content

Guide for developers

Josh edited this page Sep 8, 2016 · 9 revisions

Building

Assuming git, [Vagrant] vagrant-install and [VirtualBox] virtualbox-install installed:

 host> git clone https://github.com/snowplow/sql-runner
 host> cd sql-runner
 host> vagrant up && vagrant ssh
guest> cd /opt/gopath/src/github.com/snowplow/sql-runner
guest> godep go build

Testing

Assuming Building complete:

  1. Edit your pg_hba.conf file:
  • guest> sudo sed -i -re 's/^local\s*all\s*postgres\s*peer/local all postgres trust/' /etc/postgresql/9.4/main/pg_hba.conf
  1. Restart Postgresql:
  • guest> sudo service postgresql restart
  1. Set an empty password:
  • guest> psql -c "alter role postgres password '';" -U postgres
  1. Create required tables:
  • guest> psql -c "create database sql_runner_tests_1;" -U postgres
  • guest> psql -c "create database sql_runner_tests_2;" -U postgres

You can now run an integration test:

guest> ./sql-runner -playbook ./integration/resources/good-postgres.yml -var test_date=`date "+%Y_%m_%d"`

Publishing

Assuming Travis travis is green and versions updated:

 host> vagrant push

This will build an individual artifact for Windows, OSX and Linux all in 64 bit. All artifacts are stored in the dist/ directory.

Clone this wiki locally