Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
3 changed files
with
116 additions
and
11 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,18 @@ | ||
language: php | ||
php: | ||
- 7.0 | ||
- 7.1 | ||
- 7.2 | ||
install: cd ./libs/composer && composer install && cd ../.. | ||
script: ./run_tests.sh | ||
language: php | ||
matrix: | ||
include: | ||
- php: 7.0 | ||
- php: 7.1 | ||
- php: 7.2 | ||
script: | ||
- "./run_tests_with_reporting.sh;" | ||
- if [[ "$TRAVIS_EVENT_TYPE" == "cron" ]]; then ./run_dicto.sh; fi | ||
addons: | ||
apt: | ||
packages: | ||
- unzip | ||
apt: | ||
packages: | ||
- unzip | ||
install: | ||
- cd ./libs/composer && composer install && cd ../.. | ||
env: | ||
global: | ||
secure: c43mDcrMbH53mAGZdASJ8HkVpjxbEi388HTegyFGFhVLWk6/srrWUGJtYPkVGvhv2/5s5VQiHelXpjT9vi9iKi9wQCZcudBALjvywPY+OuMdDSs8priMpedRWYcR+l8DGNxfubgp8hb2tcZJh2IwzlOlPRvYhOPoCZZHp9i2AoEHEMmpIMagtBSg7jg7kchQSDcnMB9BUplmDJsQwWY46Yom+8G0KQM84Hcn24SwYq6qGjFCwwdFVLhIDmKGubkKBdYpF06kOftZ8hOBwpYgjzhGhCDSIT6qj/RSgH9i4Bn2b/QzzoxlSJFW5pldiYUXWiwf4qBBisG8EnHSc/pCpTbEeXnCr9fJ8aWyakK4Fm8EjBR5Ll8hmIKR9sAboS13btr2fRMpoS1VrdbjGbFmuSNgL6rrnlbPvRSMR6smmHPRQJ7iLP8/q8jBxiPnhVG/yGeZm8Oe38ONfRAlJwfa0bfxh8ifRHSK9e9yyi2HYPejoFpIUHRzr6j/4WevQShlwaGOzEFbrCawKPJkcFuyVY2gd0sYSJQLXnefMwAGSjhtOAS4YSypL2bX75WcKXodALZRyzU6OSFlGYfPT0rdbz7scV6US0zA/T1ltlsjO6yzqlc0WuVBkZPdF270sldOluGGrwEj+9nVqsRftgC9ZdlecxeE4blCzT1cx8eUSUU= |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,3 @@ | ||
#!/bin/bash | ||
|
||
libs/composer/vendor/phpunit/phpunit/phpunit --bootstrap ./libs/composer/vendor/autoload.php --configuration ./Services/PHPUnit/config/PhpUnitConfig.xml --exclude-group needsInstalledILIAS --verbose $@; | ||
libs/composer/vendor/phpunit/phpunit/phpunit --bootstrap ./libs/composer/vendor/autoload.php --configuration ./Services/PHPUnit/config/PhpUnitConfig.xml --exclude-group needsInstalledILIAS --verbose $@ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,98 @@ | ||
#!/bin/bash | ||
|
||
PRE="\t*** " | ||
|
||
function printLn() { | ||
echo -e "$PRE $1" | ||
} | ||
|
||
printLn "Initialize paths variables" | ||
|
||
PHPUNIT_PATH="/tmp/phpunit_latest.csv" | ||
PHPUNIT_PATH_TMP="/tmp/phpunit_changed.csv" | ||
PHPUNIT_RESULTS_PATH="/tmp/phpunit_results" | ||
DICTO_PATH="/tmp/dicto_latest.csv" | ||
TRAVIS_RESULTS_DIRECTORY="/tmp/CI-Results/" | ||
DATE=`date '+%Y-%m-%d %H:%M:%S'` | ||
|
||
./run_tests.sh | tee "$PHPUNIT_RESULTS_PATH" | ||
|
||
printLn "Travis: event type ($TRAVIS_EVENT_TYPE), job number ($TRAVIS_JOB_NUMBER), pull request ($TRAVIS_PULL_REQUEST), commit ($TRAVIS_COMMIT) " | ||
|
||
if [[ -e "$PHPUNIT_RESULTS_PATH" ]] | ||
then | ||
printLn "Collecting data." | ||
RESULT=`tail -n1 < "$PHPUNIT_RESULTS_PATH"` | ||
SPLIT_RESULT=(`echo $RESULT | tr ':' ' '`) | ||
PHP_VERSION=`php -r "echo PHP_MAJOR_VERSION . '_' . PHP_MINOR_VERSION;"` | ||
if [ -e "include/inc.ilias_version.php" ] | ||
then | ||
ILIAS_VERSION=`php -r "require_once 'include/inc.ilias_version.php'; echo ILIAS_VERSION_NUMERIC;"` | ||
ILIAS_VERSION=`echo "$ILIAS_VERSION" | tr . _` | ||
fi | ||
|
||
JOB_ID=`echo $TRAVIS_JOB_NUMBER` | ||
JOB_URL=`echo $TRAVIS_JOB_WEB_URL` | ||
FAILURE=false | ||
declare -A RESULTS=([Tests]=0 [Assertions]=0 [Errors]=0 [Warnings]=0 [Skipped]=0 [Incomplete]=0 [Risky]=0 [Failures]=0); | ||
|
||
for TYPE in "${!RESULTS[@]}"; | ||
do | ||
for PHP_UNIT_RESULT in "${!SPLIT_RESULT[@]}"; | ||
do | ||
if [ "$TYPE" == "${SPLIT_RESULT[$PHP_UNIT_RESULT]}" ] | ||
then | ||
CLEANED=(`echo ${SPLIT_RESULT[$PHP_UNIT_RESULT + 1]} | tr ',.' ' '`) | ||
RESULTS[$TYPE]=$CLEANED; | ||
fi | ||
done | ||
done | ||
|
||
if [ ${RESULTS[Errors]} -gt 0 ] || [ ${RESULTS[Failures]} -gt 0 ] | ||
then | ||
FAILURE=true | ||
fi | ||
|
||
if [[ "$TRAVIS_EVENT_TYPE" != "pull_request" ]] | ||
then | ||
printLn "Cloning results repository, copy results file." | ||
if [ -d "$TRAVIS_RESULTS_DIRECTORY" ]; then | ||
printLn "Starting to remove old temp directory" | ||
rm -rf "$TRAVIS_RESULTS_DIRECTORY" | ||
fi | ||
|
||
cd /tmp && git clone https://github.com/ILIAS-eLearning/CI-Results | ||
cp "$TRAVIS_RESULTS_DIRECTORY/data/phpunit_latest.csv" "$PHPUNIT_PATH" | ||
|
||
printLn "Removing old line PHP version $PHP_VERSION and ILIAS version $ILIAS_VERSION" | ||
grep -v "$ILIAS_VERSION.*php_$PHP_VERSION" $PHPUNIT_PATH > $PHPUNIT_PATH_TMP | ||
|
||
NEW_LINE="$JOB_URL,$JOB_ID,$ILIAS_VERSION,php_$PHP_VERSION,PHP $PHP_VERSION,${RESULTS[Warnings]},${RESULTS[Skipped]},${RESULTS[Incomplete]},${RESULTS[Tests]},${RESULTS[Errors]},${RESULTS[Risky]},$FAILURE,$DATE"; | ||
printLn "Writing line: $NEW_LINE" | ||
echo "$NEW_LINE" >> "$PHPUNIT_PATH_TMP"; | ||
|
||
printLn "Handling result." | ||
|
||
if [ -e "$PHPUNIT_PATH_TMP" ] | ||
then | ||
mv "$PHPUNIT_PATH_TMP" "$PHPUNIT_PATH" | ||
rm "$PHPUNIT_RESULTS_PATH" | ||
fi | ||
|
||
printLn "Switching directory and run results handling." | ||
cp "$PHPUNIT_PATH" "$TRAVIS_RESULTS_DIRECTORY/data/" | ||
cd "$TRAVIS_RESULTS_DIRECTORY" && ./run.sh | ||
|
||
fi | ||
if [ "$FAILURE" == "true" ] | ||
then | ||
printLn "Errors were found, exiting with error code." | ||
exit 99 | ||
else | ||
printLn "No errors were found." | ||
exit 0 | ||
fi | ||
else | ||
printLn "No result file found, stopping!" | ||
exit 99 | ||
fi |