Skip to content

Commit

Permalink
heavy refactor of travis.yml after all the fuckery today
Browse files Browse the repository at this point in the history
  • Loading branch information
lathonez committed Jan 5, 2016
1 parent 21f5300 commit fb045f6
Show file tree
Hide file tree
Showing 2 changed files with 71 additions and 46 deletions.
99 changes: 53 additions & 46 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,64 +1,71 @@
#
# Configuration
#

language: android

android:
components:
- android-22
- build-tools-23.0.1
- platform-tools

env:
- CXX=g++-4.8
- CXX=g++-4.8

notifications:
email: true

addons:
apt:
sources:
- ubuntu-toolchain-r-test
- ubuntu-toolchain-r-test
packages:
- g++-4.8
- g++-4.8

sudo: required
services:

branches:
only:
- master

#
# Build Lifecycle:
#

before_install:
- openssl aes-256-cbc -K $encrypted_a2f47a5da016_key -iv $encrypted_a2f47a5da016_iv
-in .travis/travis_rsa.pem.enc -out .travis/travis_rsa.pem -d
# upgrade node manually as we're building on android language and can't pick it ourselves
- rm -rf /home/travis/.nvm
- curl -sL https://deb.nodesource.com/setup_4.x | sudo -E bash -
- sudo apt-get install -y nodejs
- sudo npm update -g npm
- npm --version
- node --version
# end upgrade node manually
- export CHROME_BIN=chromium-browser
- export DISPLAY=:99.0
- sh -e /etc/init.d/xvfb start
- rm -rf /home/travis/.nvm #
- curl -sL https://deb.nodesource.com/setup_4.x | sudo -E bash - # upgrade node manually as we're building on
- sudo apt-get install -y nodejs # android language and can't pick it in yml
- sudo npm update -g npm #
# The following three lines came from angular-seed, unsure
- export CHROME_BIN=chromium-browser
- export DISPLAY=:99.0
- sh -e /etc/init.d/xvfb start

install: npm install

before_script:
# seems to be necessary (for coveralls push in after success) due to the way travis clones the repo:
# git clone --depth=50 --branch=master https://github.com/lathonez/clicker.git lathonez/clicker
- git checkout master

script: npm test
after_script:
notifications:
email: true

after_failure: cat /home/travis/build/lathonez/clicker/npm-debug.log
branches:
only:
- master

after_success:
# push compiled TS to test folder in git for reference in coveralls
- eval "$(ssh-agent -s)"
- chmod 600 .travis/travis_rsa.pem
- ssh-add .travis/travis_rsa.pem
- git -f add www/build/test/app
- git remote rm origin # originally cloned by travis on https
- git remote add origin git@github.com:lathonez/clicker.git # ditto
- git -c user.name='travis' -c user.email='travis@travis-ci.org' commit -m "updating compiled tests [ci skip]" # dont want this triggering another build
- git push origin master
# dont send to coveralls until _after_ we've pushed the compiled test code
- cat coverage/lcov.info | node_modules/.bin/coveralls
- cat coverage/lcov.info | ./node_modules/.bin/codecov
- rm -rf coverage
# push to ionic (should be deploy really)
- sudo npm install -g cordova ionic
- ionic platform add android
- ionic build android
# - ionic upload --email $IONIC_EMAIL --password $IONIC_PASSWORD # deploy debug apk to davonez as ionic view is a pile of wank
- ssh-keyscan 176.58.107.25 >> ~/.ssh/known_hosts
- scp -i .travis/travis_rsa.pem platforms/android/build/outputs/apk/android-debug.apk shazleto@176.58.107.25:~/clicker
# push compiled TS to test folder in git for reference in coveralls
- .travis/push_built_tests.sh
# Send coverage info off to cloud ppl
- cat coverage/lcov.info | node_modules/.bin/coveralls
- cat coverage/lcov.info | ./node_modules/.bin/codecov

before_deploy:
# build for android
- sudo npm install -g cordova ionic
- ionic platform add android
- ionic build android

deploy:
# now deploying to davonez as ionic view is a pile of wank
# - ionic upload --email $IONIC_EMAIL --password $IONIC_PASSWORD
- ssh-keyscan 176.58.107.25 >> ~/.ssh/known_hosts
- scp -i .travis/travis_rsa.pem platforms/android/build/outputs/apk/android-debug.apk shazleto@176.58.107.25:~/clicker
18 changes: 18 additions & 0 deletions .travis/push_built_tests.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
#! /bin/bash
#
# Helper script run from travis that pushes compiled tests to github so they can be referenced by coverage providers
#
# travis clones in a weird way and the head gets detached, so checkout master again
git checkout master
# decrypt private key that gives us push access and add it to ssh agent
openssl aes-256-cbc -K $encrypted_a2f47a5da016_key -iv $encrypted_a2f47a5da016_iv -in .travis/travis_rsa.pem.enc -out .travis/travis_rsa.pem -d #
eval "$(ssh-agent -s)"
chmod 600 .travis/travis_rsa.pem
ssh-add .travis/travis_rsa.pem
# using -f as www/build is in .gitignore for dev purposes
git -f add www/build/test/app
git remote rm origin # originally cloned by travis on https
git remote add origin git@github.com:lathonez/clicker.git # ditto
# careful not to trigger another build
git -c user.name='travis' -c user.email='travis@travis-ci.org' commit -m "updating compiled tests [ci skip]"
git push origin master

0 comments on commit fb045f6

Please sign in to comment.