First attempt at getting travis ci working

This commit is contained in:
Timothy Warren 2014-10-27 16:07:07 -04:00
parent 145007797b
commit dae1d11530
6 changed files with 47 additions and 3 deletions

13
.travis.yml Normal file
View File

@ -0,0 +1,13 @@
language: node_js
node_js:
- "0.11"
- "0.10"
- "0.8"
before_script:
- psql -c 'DROP DATABASE IF EXISTS test;' -U postgres
- psql -c 'create database test;' -U postgres
- mysql -e 'create database IF NOT EXISTS test;'
- mysql -Uroot test < ./tests/sql/mysql.sql
- psql -f ./tests/sql/pgsql.sql

View File

@ -21,6 +21,7 @@
"grunt-contrib-nodeunit": "^0.4.1", "grunt-contrib-nodeunit": "^0.4.1",
"grunt-istanbul": "^0.3.0", "grunt-istanbul": "^0.3.0",
"grunt-jsdoc": ">=0.6.1", "grunt-jsdoc": ">=0.6.1",
"grunt-cli":"",
"jsdoc": "^3.3.0-alpha9", "jsdoc": "^3.3.0-alpha9",
"mysql": "^2.5.2", "mysql": "^2.5.2",
"mysql2": "^0.12.5", "mysql2": "^0.12.5",

View File

@ -1,5 +1,7 @@
'use strict'; 'use strict';
var configFile = (process.env.CI) ? '../config-travis.json' : '../config.json';
// Load a fresh version of the test base // Load a fresh version of the test base
delete require.cache[require.resolve('../query-builder-base')]; delete require.cache[require.resolve('../query-builder-base')];
var testBase = require('../query-builder-base'); var testBase = require('../query-builder-base');
@ -7,7 +9,7 @@ var tests = testBase.tests;
// Load the test config file // Load the test config file
var adapterName = 'mysql2'; var adapterName = 'mysql2';
var config = require('../config.json')[adapterName]; var config = require(configFile)[adapterName];
// Set up the connection // Set up the connection
var mysql2 = require(adapterName); var mysql2 = require(adapterName);

View File

@ -1,5 +1,7 @@
'use strict'; 'use strict';
var configFile = (process.env.CI) ? '../config-travis.json' : '../config.json';
// Load the test base // Load the test base
delete require.cache[require.resolve('../query-builder-base')]; delete require.cache[require.resolve('../query-builder-base')];
var testBase = require('../query-builder-base'); var testBase = require('../query-builder-base');
@ -7,7 +9,7 @@ var tests = testBase.tests;
// Load the test config file // Load the test config file
var adapterName = 'mysql'; var adapterName = 'mysql';
var config = require('../config.json')[adapterName]; var config = require(configFile)[adapterName];
// Set up the connection // Set up the connection
var mysql = require(adapterName); var mysql = require(adapterName);

View File

@ -1,5 +1,7 @@
'use strict'; 'use strict';
var configFile = (process.env.CI) ? '../config-travis.json' : '../config.json';
// Load the test base // Load the test base
delete require.cache[require.resolve('../query-builder-base')]; delete require.cache[require.resolve('../query-builder-base')];
var testBase = require('../query-builder-base'); var testBase = require('../query-builder-base');
@ -7,7 +9,7 @@ var tests = testBase.tests;
// Load the test config file // Load the test config file
var adapterName = 'pg'; var adapterName = 'pg';
var config = require('../config.json')[adapterName]; var config = require(configFile)[adapterName];
// Set up the connection // Set up the connection
var pg = require(adapterName); var pg = require(adapterName);

24
tests/config-travis.json Normal file
View File

@ -0,0 +1,24 @@
{
"mysql": {
"driver": "mysql",
"conn": {
"host": "localhost",
"user": "root",
"password": "",
"database": "test"
}
},
"mysql2": {
"driver": "mysql",
"conn": {
"host": "localhost",
"user": "root",
"password": "",
"database": "test"
}
},
"pg": {
"driver": "pg",
"conn": "postgres://postgres@localhost/test"
}
}