forked from doubtfire-lms/doubtfire-api
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path.travis.yml
95 lines (82 loc) · 3.17 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
# Specify language for project
language: ruby
# Enable caching
cache:
# Cache bundler
bundler: true
# Cache the following directories. RVM can be cached according to Travis's docs
directories:
- /home/travis/.rvm/
- /tmp/texlive
- $HOME/.texlive
# Specify Ruby version for rvm
rvm:
- 2.3.1
# Run processes as sudo
sudo: true
# Environment settings for staging testing
env:
global:
- DF_STAGING_DB_ADAPTER=mysql2
- DF_STAGING_DB_HOST=localhost
- DF_STAGING_DB_DATABASE=doubtfire_staging
- DF_STAGING_DB_USERNAME=root
- DF_STAGING_DB_PASSWORD=""
- DF_SECRET_KEY_BASE=test_staging
- DF_SECRET_KEY_ATTR=test_staging
- DF_SECRET_KEY_DEVISE=test_staging
- CC_TEST_REPORTER_ID=355f46e3aec53ec2d17f714bd0eab58682dc03ee413d46195440311da30982c7
# Enable postgresql and MySQL service
services:
- postgresql
- mysql
addons:
postgresql: "9.6"
# Update apt packages
apt:
update: true
# Shallow clone git repository. Only the last branch with an update shall be cloned without the version history
# This helps reduce server load
git:
depth: 1
# Install following dependencies and rehash rbenv before setting the environment for script execution
install:
- sudo apt-get install -y ghostscript imagemagick libmagic-dev libmagickwand-dev libmagic-dev python-pygments libav-tools
- ./.ci-setup/texlive-install.sh
- bundle install --without production replica
- rbenv rehash
- export PATH=/tmp/texlive/bin/x86_64-linux:$PATH
- curl -L https://codeclimate.com/downloads/test-reporter/test-reporter-latest-linux-amd64 > ./cc-test-reporter
- chmod +x ./cc-test-reporter
- ./cc-test-reporter before-build
# Set the environment before running the tests
before_script:
# ======================================================================================
# Create the development environment and set it up
# ======================================================================================
# Restart postgresql service
- sudo service postgresql restart
# Create postgresql role
- psql -c "CREATE ROLE itig WITH CREATEDB PASSWORD 'd872\$dh' LOGIN;"
# Create the database of the project in the dev environment on postgresql
- bundle exec rake db:create
# Populate the database
- echo "n" | bundle exec rake db:populate
# ======================================================================================
# Create the staging environment and set it up
# ======================================================================================
# Restart mysql instance
- sudo service mysql restart
# Creating database in MySQL
- echo $(DF_STAGING_DB_PASSWORD) | mysql -e 'CREATE DATABASE IF NOT EXISTS doubtfire_staging;'
# Create the database of the project in the staging environment
- echo "test_staging" | RAILS_ENV=staging bundle exec rake db:create
# Populate the database
- echo "n" | RAILS_ENV=staging bundle exec rake db:populate
# Run the tests
script:
- which lualatex
- PATH=/tmp/texlive/bin/x86_64-linux:$PATH bundle exec rake test
- PATH=/tmp/texlive/bin/x86_64-linux:$PATH RAILS_ENV=staging bundle exec rake test
after_script:
- ./cc-test-reporter after-build --exit-code $TRAVIS_TEST_RESULT