forked from DMPRoadmap/roadmap
-
Notifications
You must be signed in to change notification settings - Fork 1
/
.travis.yml
113 lines (93 loc) · 2.85 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
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
sudo: false
# Ruby is the main language of the project.
language: ruby
bundler_args: --with development,ci
# Cache third party dependencies for faster builds
cache:
apt: true
bundler: true
directories:
# Cache NPM packages
- lib/assets/node_modules
- $HOME/.npm
addons:
chrome: stable
apt:
packages:
- wkhtmltopdf
# artifacts:
# paths: "./log:./tmp/capybara"
# bucket: roadmap-test-assets
# s3_region: "eu-west-2"
# debug: true
services:
- mysql
- postgresql
matrix:
fast_finish: true
include:
rvm:
# Use 2.4.1, since this is installed by default on Travis (1st Aug, 2018)
- 2.4.4
# These env variables will set up a separate testing environment for each
# combination of variables.
env:
# Run specs once with each database adapter we support
- DB_ADAPTER=postgresql
- DB_ADAPTER=mysql2
before_install:
- nvm install 10.10.0
# sassc-rails causes a build failure when running assets:precompile in Travis
# for the mysql2 env. Forcing the gem to install and build ffi locally fixes
# the issue: https://github.com/sass/sassc-ruby/issues/146
#- gem install sassc -- --disable-march-tune-native
install:
- gem install bundler -v 1.17.2
# Install all gem and JS dependencies
- bundle install --with development,ci --path=${BUNDLE_PATH:-vendor/bundle}
- yarn install --ignore-optional
# This is a temporary bug fix for Karma tests
# See here: https://github.com/travis-ci/travis-ci/issues/9024
before_script:
- "sudo chown root /opt/google/chrome/chrome-sandbox"
- "sudo chmod 4755 /opt/google/chrome/chrome-sandbox"
# Main test script
script:
- export WICKED_PDF_PATH=./vendor/bundle/ruby/2.4.0/bin/wkhtmltopdf
# Copy over config files needed for setup, and create DB
- bin/setup
- bundle exec rake webpacker:compile
- bundle exec rake assets:precompile
# Default test stage: Run all specs, listing the 10 slowest.
- bundle exec rspec spec --profile=10
# Run these stages in this order:
stages:
- security
- test
- hygiene
# Define each stage (test is already defined automatically)
jobs:
include:
# Run Brakeman check with warning level 2, except these two checks:
- stage: security
name: "Brakeman check"
if: branch = master
script: bundle exec brakeman -w2 --except=Redirect,CrossSiteScripting
- stage: security
name: "Bundle audit"
if: branch = master
script: bundle exec bundle-audit check --update --ignore CVE-2015-9284
- stage: test
name: "Running JS through linter checks"
script: yarn run lint
- stage: test
name: "Running JS through Karma tests"
script: yarn run test
- stage: hygiene
name: "Check seeds are valid"
script:
bin/setup
bundle exec rake db:drop
bundle exec rake db:create
bundle exec rake db:schema:load
bundle exec rake db:seed