forked from expertiza/expertiza
-
Notifications
You must be signed in to change notification settings - Fork 0
/
.travis.yml
86 lines (86 loc) · 3.51 KB
/
.travis.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
env:
global:
- CC_TEST_REPORTER_ID=d20eadb9183f9f1866657be5b5e47b4a2398ff1ea0be29fbd50a26a43ea98b62
- REPORT_REPO_NAME=Travis-ci-code-coverage-reports
- secure: fpBhnY1Y4U0qx/BOFyO8OaS5gBPlF9Y8mFONF7WkphqbEJytlfIunbLFpQ1CX/9rDo1+96g0TDJUMx3bs4AnsgGEt16oSLOiRhKfyMcdsVRJry8a0PZMtYaEpBReyPv0Va0V7VTy1hFzLKTkmxKoIoYgNY0msocRypl/K6CF7l8=
matrix:
- TESTFOLDER=features
- TESTFOLDER=models
- TESTFOLDER=controllers
- TESTFOLDER=helpers
language: ruby
dist: trusty
cache:
bundler: true
directories:
- vendor/assets/components
rvm:
- 2.2.7
branches:
only:
- master
- beta
before_install:
- uname -a
- lsb_release -a
- rvm list
- unset RAILS_ENV
- rvm rubygems current
- npm install -g bower
- bower install
- wget https://github.com/mozilla/geckodriver/releases/download/v0.23.0/geckodriver-v0.23.0-linux64.tar.gz
- tar -xf geckodriver-v0.23.0-linux64.tar.gz
- sudo mv geckodriver /usr/local/bin/geckodriver
- geckodriver --version
- redis-server --version
- redis-server &
before_script:
- mysql -u root < db/grant_expertiza.sql
- cp config/database.yml.example config/database.yml
- cp config/secrets.yml.example config/secrets.yml
- export JAVA_HOME=/usr/lib/jvm/java-6-openjdk-amd64
- bundle install
- bundle exec danger --verbose
- bundle exec rake db:setup
# Test coverage offered by Code Climate
- curl -L https://codeclimate.com/downloads/test-reporter/test-reporter-0.7.0-linux-amd64 > ./cc-test-reporter
- chmod +x ./cc-test-reporter
- ./cc-test-reporter before-build
# Using xvfb to Run Tests That Require a GUI (https://docs.travis-ci.com/user/gui-and-headless-browsers/)
- "export DISPLAY=:99.0" # Display number for xvfb (for headless browser testing)
- "/sbin/start-stop-daemon --start --quiet --pidfile /tmp/custom_xvfb_99.pid --make-pidfile --background --exec /usr/bin/Xvfb -- :99 -ac -screen 0 1920x1080x16"
- sleep 3 # give xvfb some time to start
script:
- "export DISPLAY=:99.0 && RUBYOPT=W0 bundle exec rspec spec/$TESTFOLDER 2> /dev/null"
after_script:
-
- ./cc-test-reporter format-coverage -t simplecov -o "coverage/codeclimate.$TESTFOLDER.json"
# https://docs.travis-ci.com/user/environment-variables#convenience-variables
- if [ "$TRAVIS_PULL_REQUEST" == "false" ]; then export TRAVIS_PULL_REQUEST=master; fi
- ls -lah coverage/
- cd $HOME
- git config --global user.email "[email protected]"
- git config --global user.name "Winbobob"
- git clone --quiet https://[email protected]/expertiza/$REPORT_REPO_NAME.git
- cd $REPORT_REPO_NAME
- if [ ! -d "./$TRAVIS_PULL_REQUEST" ]; then mkdir $TRAVIS_PULL_REQUEST; fi
- cp -Rf $HOME/build/expertiza/expertiza/coverage/codeclimate.$TESTFOLDER.json $HOME/$REPORT_REPO_NAME/$TRAVIS_PULL_REQUEST/codeclimate.$TESTFOLDER.json
- git add --all
- git commit -m "Add code climate coverage report"
- git push origin master
# Sum coverage parts into coverage/codeclimate.json and upload coverage/codeclimate.json
- if [ "$TESTFOLDER" == "features" ] && [ "$TRAVIS_TEST_RESULT" == 0 ]; then $HOME/build/expertiza/expertiza/cc-test-reporter sum-coverage $HOME/$REPORT_REPO_NAME/$TRAVIS_PULL_REQUEST/codeclimate.*.json && $HOME/build/expertiza/expertiza/cc-test-reporter upload-coverage; fi
services:
- mysql
addons:
firefox: latest
notifications:
email:
recipients:
on_success: change
on_failure: always
slack: expertiza-support:DS8GtpbAybxHVwwYNRvvbb39
webhooks:
urls:
- https://expertiza-travisci.herokuapp.com/?insertMode=update