Skip to content

Commit

Permalink
[test] configure Travis CI
Browse files Browse the repository at this point in the history
  • Loading branch information
dunn committed Sep 4, 2016
1 parent 67a7020 commit 440e045
Show file tree
Hide file tree
Showing 4 changed files with 61 additions and 12 deletions.
28 changes: 25 additions & 3 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,12 +1,34 @@
# Build config for travis-ci.org
---
sudo: true

language: node_js
node_js:
- 5.5
- 6

addons:
mariadb: '5.5'

env:
global:
- DB_ROOT_PASS="$(openssl rand -hex 20)"
- APPUSER="$USER"
- secure: 'Sv6f1+ih/ov7TtiPSm8Abp+2DG8dSrQLkp6cConq5qEfaEEeQJhSzcNS2xu0flMCyD1ERVWZKuYke6rDJefaZA9fQrJS+YzJtkcSttHTOdY01VDIa2sofH//hE9ydP5Zfqm6Ru9UyTYkapUGrOPanxgtWMfja2GbeIdxsFlkZuf8mnBq42kNk8lj4M/Pg4i9mOKTuvmwdXgzgFVoS2ZeTEd4+59ik8RaVUssm6EJ1VOPOrTRAJ3lMqADuV41qi6J0piv/SDxFBHJTrGpKGH6EEud3pZgOirFBvD0udhIARiPu+RtSgsmC9Jtndl9PWEAxUHJJlgdk7MVUgP2klK0zukPintRQZTLKZyFiiw6Ftqo5XhYmV8AjjUN7VNH2QqhSf2x4yGclt7c/ETokdHjkA1ZqkEwSS1IlY8E59BBEtpF4kmRCq7bHB/g4Nh0gXdzpqjqG0tEL1bvRzJ3GiyV5BibfVo7/iV07l8ACjZLnCjzzMuhFju9q6mvOFsNjJZpwJtc1vsSdBVLvGexZnroKa8C7l+X/Up/ZZ5S9KWaAsoM7+bdlqqCjUAP4DYUg0DONKb3779tDUBMb3U0d3pww554r9sz0R/j8NpT5K7CsT4L0+5cVDM/pjK8WdXXk6BfOr69JgcpBGk7PpSjJaiW4AnpIklPRarXW+fDQdxq9gs='
- secure: 'lXaGJ8MDC3PQwu3LbBBNd2Ae/ig5RWD693iu4Xwft8ZNEy3/hypqTTE1gizbn3oDM2Q8s2Qkm0yY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qfGJYq8Wtelu0o8bSwSdFEUE4y656/sY4pOGpXpE/jZ091kFCQQTHb2bjXl8asKeA7FBkSJKbbaJeyQ56y3PMmn7OqPDMtzOKTtK9MDrK0fiaZUDgEMp7AOzHMViFX3vSH/u1rX+3UfkYCeKW52bK4xiGQKpsmNIK3BCqIjJfX17qW5GOgSjsAnfWTT81rdcydpf0rxI3JWse65ZMAHudNn/2k='
- secure: 'y+crCYO9hfMVE8PYe3hTpxsLQzg0zc4AWPyUClmdHUA+VvH3pPw7gtJNpO+D51IrR82pDMBrDcUH1KaEcAsN2rKDG5yLbwrt7/n2nnzFfnvUY0tA/MyR+gcu/lrjNid8VpttW5C0GF2BPkzRSy+MKfa47Iodu7OTndr3ie8KRJpjJ+R8AnSU+wIRyCe+aE5ttMHKEx7TC3ItjtGrUuwZL0lJv0OBYenRzU1QhZBR5+0Wh0yHpOdHcwhQGuutjyYC1g4iDEBygBUTWK69nEIFknUv46gAAOXk53cj9IFTeMhnUL/SFepelxMVI8Z5YrzFS0S6hQp8zliO5iv6f1H0xT6V2plngBKLP+ZzUkJdzAU1RB2Ukj3VBsEAR3PZir9nVnf+OxZhmDqiaI1uaDtCWOGA4tzeYa6jtbbrOY/7ouTCzxCHJwZia7rpH4cIHTgluVypm9wMxMcxdEB0noowEnn2miaQYB/4/FP5KNnqMC7mjT/RXDQd3LTgospLMmZDDPC26lnW841pAEA/RjbdDOhlBrN4IDSP7Jv4gYXhSHwuxEzH26LciWy/4AKz/tuQhw3Gzw3epHBYUo3iH/GQ02OTSTXmJ5Dyuv3PfZYCe0nY0J4p8yEM8otGX3qd9nAKYjEnnXta6AvSZr5nL99MHQzLtEySYsr/mPFC2SEjSMw='

install:
- "wget https://dl.google.com/closure-compiler/compiler-latest.zip"
- "unzip -n compiler-latest.zip"
- wget https://dl.google.com/closure-compiler/compiler-latest.zip
- unzip -n compiler-latest.zip
- "[ ${CONSUMER_KEY} ] && ./bin/travis/install.sh"

script:
# TODO: Enable checkTypes after adding more types to externs.js
- "cat *.js | java -jar closure-compiler-*.jar --language_in=ECMASCRIPT6 --warning_level=VERBOSE --jscomp_off=checkTypes
--externs=externs/externs.js --externs=externs/core.js --externs=externs/process.js
--externs=externs/underscore-1.5.1.js > /dev/null"
- "[ ${CONSUMER_KEY} ] && npm test"

after_failure:
- "[ ${CONSUMER_KEY} ] && cat bt.log"
18 changes: 10 additions & 8 deletions bin/setup.sh
Original file line number Diff line number Diff line change
Expand Up @@ -25,19 +25,21 @@ export DEBIAN_FRONTEND=noninteractive

DB_PASS=$(openssl rand -hex 20)

# Set up the nodesource Node repo to get the latest.
curl -s https://deb.nodesource.com/gpgkey/nodesource.gpg.key | apt-key add -
sudo tee /etc/apt/sources.list.d/nodesource.list <<EOAPT
if [[ -z "$CI" ]]; then
# Set up the nodesource Node repo to get the latest.
curl -s https://deb.nodesource.com/gpgkey/nodesource.gpg.key | apt-key add -
sudo tee /etc/apt/sources.list.d/nodesource.list <<EOAPT
deb https://deb.nodesource.com/node_5.x trusty main
deb-src https://deb.nodesource.com/node_5.x trusty main
EOAPT

apt-get update
apt-get install -y -o Dpkg::Options::="--force-confdef" -o Dpkg::Options::="--force-confold" \
mariadb-client-5.5 mariadb-server-5.5 git nginx gnupg curl build-essential \
nodejs mailutils postfix
apt-get update
apt-get install -y -o Dpkg::Options::="--force-confdef" -o Dpkg::Options::="--force-confold" \
mariadb-client-5.5 mariadb-server-5.5 git nginx gnupg curl build-essential \
nodejs mailutils postfix

ln -sf nodejs /usr/bin/node
ln -sf nodejs /usr/bin/node
fi

SEQUELIZE_CONFIG=/etc/blocktogether/sequelize.json
if grep -q __PASSWORD__ $SEQUELIZE_CONFIG ; then
Expand Down
23 changes: 23 additions & 0 deletions bin/travis/install.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
#!/bin/bash

set -e

cd "$(dirname ${BASH_SOURCE[0]})/../../"

sudo install -o "$USER" -d /etc/blocktogether
sudo install -o "$USER" -d /data/blocktogether

cp -a ./config/* /etc/blocktogether/
sed "s/__CONSUMER_KEY__/$CONSUMER_KEY/" ./config/development.json > /etc/blocktogether/config.json
sed -i "s/__CONSUMER_SECRET__/$CONSUMER_SECRET/" /etc/blocktogether/config.json

mysqladmin -u root password "$DB_ROOT_PASS"
sudo ./bin/setup.sh

npm install

./node_modules/.bin/sequelize --config /etc/blocktogether/sequelize.json db:migrate

./run-dev.sh > bt.log 2>&1 &

until curl localhost:3000; do echo "Waiting for service..."; sleep 1; done
4 changes: 3 additions & 1 deletion test/integration/signup_logon_test.js
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ casper.test.begin('Sign up and log on', 6, function(test) {
return this.fill(
'form[id="oauth_form"]',
// NB: must use single quotes
{ 'session[username_or_email]': user , 'session[password]': pass }, true);
{ 'session[username_or_email]': user, 'session[password]': pass }, true);
});

casper.waitForSelector('.container-fluid', function() {
Expand All @@ -50,7 +50,9 @@ casper.test.begin('Sign up and log on', 6, function(test) {
test.assertEqual(checks, [false, false, false, true], 'new account has default settings');

this.click('#block_new_accounts');
});

casper.waitForSelector('.saved', function() {
this.reload(function() {
var checks = this.evaluate(checkBoxes);
test.assertEqual(checks, [true, false, false, true], 'block_new_accounts was saved');
Expand Down

0 comments on commit 440e045

Please sign in to comment.