-
Notifications
You must be signed in to change notification settings - Fork 27
/
.travis.yml
95 lines (87 loc) · 4.01 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
language: node_js
node_js:
- '8'
dist: trusty
sudo: required
services:
- mysql
addons:
chrome: stable
firefox: "60.0"
env:
- EMONCMS_REPO="https://github.com/emoncms/emoncms.git" EMONCMS_BRANCH="stable"
before_install:
# Install Apache + PHP - adapted from https://docs.travis-ci.com/user/languages/php/
- sudo apt-get update
- sudo apt-get install apache2 libapache2-mod-fastcgi -y
## enable php-fpm
- sudo cp ~/.phpenv/versions/5.6/etc/php-fpm.conf.default ~/.phpenv/versions/5.6/etc/php-fpm.conf
- sudo a2enmod rewrite actions fastcgi alias
- echo "cgi.fix_pathinfo = 1" >> ~/.phpenv/versions/5.6/etc/php.ini
- sudo sed -i -e "s,www-data,travis,g" /etc/apache2/envvars
- sudo chown -R travis:travis /var/lib/apache2/fastcgi
- "~/.phpenv/versions/5.6/sbin/php-fpm"
## configure apache virtual hosts
- sudo cp -f travis-CI/travis-ci-apache /etc/apache2/sites-available/000-default.conf
- sudo service apache2 restart
install:
# Install emonCMS - adapted from https://github.com/emoncms/emoncms/blob/master/docs/LinuxInstall.md
## Setup apache
- sudo apt-get install php-pear build-essential php5-dev g++ wget -y
- sudo pear channel-discover pear.swiftmailer.org
- sudo cp ./travis-CI/emoncms.conf /etc/apache2/sites-available/emoncms.conf
- sudo a2ensite emoncms
- sudo service apache2 reload
- cd /var/www/
- sudo chown $USER html
## Clone emonCMS
- cd html
- git clone --depth=50 -b $EMONCMS_BRANCH $EMONCMS_REPO
- cd /var/www/html/emoncms
- git pull
## Setup database
- mysql -e 'CREATE DATABASE IF NOT EXISTS emoncms DEFAULT CHARACTER SET utf8;'
## Create settings.php
- cd /var/www/html/emoncms/
- cp default.settings.php settings.php
- sed -i 's/_DB_USER_/travis/g' settings.php
- sed -i 's/_DB_PASSWORD_//g' settings.php
- sed -i 's/$enable_multi_user = false;/$enable_multi_user = true;/g' settings.php
### Not setting up SMTP - needs to be done if we want to test emails features
# Install MHEP theme
- cd /var/www/html/emoncms/Theme
- git clone --depth=3 https://github.com/carboncoop/MHEP_theme.git CCoop
- cd /var/www/html/emoncms/
- sed -i 's/$theme = "basic";/$theme = "CCoop";/g' settings.php
# Install MHEP
- cd /var/www/html/emoncms/Modules
- git clone --depth=3 --branch=$TRAVIS_BRANCH https://github.com/$TRAVIS_REPO_SLUG assessment
- cd assessment
- git submodule update --init --recursive
## Add MHEP settings to settings.php - Do not reuse the key below in a productionn site!!!!
- echo "\$MHEP_image_gallery = true; // If true then the image gallery will be available" >> /var/www/html/emoncms/settings.php
- echo "\$MHEP_key = 'e5852d10bfcaf20de76435456ce162b0c36a1fb4469ef72f34103c2b37cb2cec';" >> /var/www/html/emoncms/settings.php
## Change ownership of images directory to allow MHEP save pictures
- sudo chown :www-data images
- sudo chmod 774 images
## Setup test suite
- cd /var/www/html/emoncms/Modules/assessment/tests
- npm install
- "./node_modules/.bin/selenium-standalone install"
- "./node_modules/.bin/selenium-standalone start > /dev/null 2>&1 &"
- mkdir webdrivers
- cd webdrivers
- wget https://chromedriver.storage.googleapis.com/2.42/chromedriver_linux64.zip
- unzip chromedriver_linux64.zip
- sudo chmod +x chromedriver
- wget https://github.com/mozilla/geckodriver/releases/download/v0.23.0/geckodriver-v0.23.0-linux64.tar.gz
- tar -xvzf geckodriver-v0.23.0-linux64.tar.gz
- sudo chmod +x geckodriver
- export PATH=$PATH:/var/www/html/emoncms/Modules/assessment/tests/webdrivers
script:
#- curl -vL http://127.0.0.1/emoncms
- cd /var/www/html/emoncms/Modules/assessment/tests
# Create emonCMS admin user and run basic test
- HEADLESS=true ./node_modules/.bin/wdio wdio.conf.js --spec travis_specs/emonCMS-setup.js
# Run MHEP tests
- HEADLESS=true DEBUG=true TRAVIS=true ./node_modules/.bin/wdio wdio.conf.js