forked from aces/Loris
-
Notifications
You must be signed in to change notification settings - Fork 0
/
.travis.yml
107 lines (86 loc) · 4.75 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
language: php
cache:
directories:
- vendor
php:
- 5.4
- 5.6
- '7'
matrix:
allow_failures:
- php: '7'
sudo: false
before_install:
# Start Xvfb in a desktop screen size,
# otherwise some tests will fail because the links
# are hidden when Selenium tries to find them.
- "/sbin/start-stop-daemon --start --quiet --pidfile /tmp/custom_xvfb_99.pid --make-pidfile --background --exec /usr/bin/Xvfb -- :99 -ac -screen 0 1600x1200x16"
#- "export DISPLAY=:99.0"
#- "sh -e /etc/init.d/xvfb start"
install:
# Install composer modules
- composer install --dev
- phpenv rehash
# Install jslint
- npm install -g jslint
# Download a Selenium Web Driver release
- wget "http://selenium-release.storage.googleapis.com/2.45/selenium-server-standalone-2.45.0.jar"
- php -S localhost:8000 -t htdocs 2>1 > /dev/null &
# Start Selenium and redirect Selenium WebDriver
# output to /dev/null so that it doesn't flood the
# screen in the middle of our other tests
- DISPLAY=:99.0 java -jar selenium-server-standalone-2.45.0.jar 2>1 > /dev/null &
before_script:
# Set up the Loris environment
- mkdir -p project smarty/templates_c
- chmod 777 smarty/templates_c
# Set up the MySQL database, install the Schema, create a MySQL user
# for the config file, and reset the Loris user's password for testing
- mysql -e 'CREATE DATABASE LorisTest'
- mysql LorisTest < SQL/0000-00-00-schema.sql
- mysql LorisTest -u root -e "GRANT UPDATE,INSERT,SELECT,DELETE,DROP,CREATE TEMPORARY TABLES ON LorisTest.* TO 'SQLTestUser'@'localhost' IDENTIFIED BY 'TestPassword' WITH GRANT OPTION"
- mysql LorisTest -e "UPDATE users SET Password_MD5=CONCAT('aa', MD5('aatestpass')), Pending_approval='N', Password_expiry='2100-01-01' WHERE ID=1"
- sed -e "s/%HOSTNAME%/localhost/g"
-e "s/%USERNAME%/SQLTestUser/g"
-e "s/%PASSWORD%/TestPassword/g"
-e "s/%DATABASE%/LorisTest/g"
< docs/config/config.xml > project/config.xml
- mysql LorisTest -e "UPDATE Config SET Value='$(pwd)/' WHERE ConfigID=(SELECT ID FROM ConfigSettings WHERE Name='base')"
- mysql LorisTest -e "UPDATE Config SET Value='http://localhost:8000' WHERE ConfigID=(SELECT ID FROM ConfigSettings WHERE Name='url')"
#env:
# - "LORIS_DB_CONFIG=test/config.xml"
script:
# Run PHP -l on everything to ensure there's no syntax
# errors.
- for i in `ls php/libraries/*.class.inc modules/*/php/* modules/*/ajax/* htdocs/*.php htdocs/*/*.php`;
do
php -l $i || exit $?;
done
# Run unit tests to make sure functions still do what they should.
- vendor/bin/phpunit --configuration test/phpunit.xml --testsuite 'LorisUnitTests for php/libraries'
# Run integration tests to make sure everything didn't just
# break
- vendor/bin/phpunit --configuration test/phpunit.xml --testsuite 'Loris Core Integration Tests'
# Run integration tests for specific modules
- vendor/bin/phpunit --configuration test/phpunit.xml --testsuite 'Loris Module Integration Tests'
# Run PHPCS on the entire libraries directory.
- vendor/bin/phpcs --standard=docs/LorisCS.xml php/libraries php/exceptions
- vendor/bin/phpcs --standard=docs/LorisCS.xml --extensions=php/php htdocs
# Run PHPCS on some scripts
- vendor/bin/phpcs --standard=docs/LorisCS.xml tools/CouchDB_Import_MRI.php
- vendor/bin/phpcs --standard=docs/LorisCS.xml tools/assign_missing_instruments.php
- vendor/bin/phpcs --standard=docs/LorisCS.xml tools/data_dictionary_builder.php
- vendor/bin/phpcs --standard=docs/LorisCS.xml tools/generic_includes.php
# Run PHPCS on specific modules
- vendor/bin/phpcs --standard=docs/LorisCS.xml modules/imaging_uploader/php/NDB_Menu_Filter_imaging_uploader.class.inc
- vendor/bin/phpcs --standard=docs/LorisCS.xml modules/imaging_uploader/php/File_Decompress.class.inc
- vendor/bin/phpcs --standard=docs/LorisCS.xml --extensions=php/php,inc/php modules/genomic_browser
- vendor/bin/phpcs --standard=docs/LorisCS.xml --extensions=php/php,inc/php modules/candidate_list
- vendor/bin/phpcs --standard=docs/LorisCS.xml --extensions=php/php,inc/php modules/conflict_resolver
- vendor/bin/phpcs --standard=docs/LorisCS.xml --extensions=php/php,inc/php modules/dashboard
- vendor/bin/phpcs --standard=docs/LorisCS.xml --extensions=php/php,inc/php modules/examiner
- vendor/bin/phpcs --standard=docs/LorisCS.xml --extensions=php/php,inc/php modules/training
- vendor/bin/phpcs --standard=docs/LorisCS.xml --extensions=php/php,inc/php modules/brainbrowser
- vendor/bin/phpcs --standard=docs/LorisCS.xml --extensions=php/php,inc/php modules/configuration
# Run JSLINT on specific scripts
- jslint htdocs/js/jquery.dynamictable.js