Commit 7a89db11 authored by Aaron Wells's avatar Aaron Wells

Make sure CSS is built before installer runs

parent 05099ec8
...@@ -277,8 +277,41 @@ passthru_or_die( ...@@ -277,8 +277,41 @@ passthru_or_die(
."Please run \"make minaccept\" in your local workspace and fix any problems it finds." ."Please run \"make minaccept\" in your local workspace and fix any problems it finds."
); );
echo "\n";
echo "########## Verify that the patch contains a Behat test\n";
echo "\n";
if (trim(shell_exec("git diff-tree --no-commit-id --name-only -r HEAD | grep -c $BEHATTESTREGEX")) >= 1) {
echo "Patch includes a Behat test.\n";
}
else {
# Check whether the commit message has "behatnotneeded" in it.
if (trim(shell_exec("git log -1 | grep -i -c $BEHATNOTNEEDED")) >= 1) {
echo "This patch does not include a Behat test!\n... but the patch is marked with \"$BEHATNOTNEEDED\", so we will continue.\n";
}
else {
gerrit_comment(
"This patch does not include a Behat test (an automated test plan).\n\n"
."Please write a Behat test for it, or, if it cannot be tested in Behat or is covered by existing tests, put \"$BEHATNOTNEEDED\" in its commit message."
);
exit(1);
}
}
echo "\n";
echo "########## Build & Minify CSS\n";
echo "\n";
passthru('make clean-css');
passthru_or_die(
'make',
"This patch encountered an error while attempting to build its CSS.\n\n"
."This may be an error in Jenkins"
);
echo "\n"; echo "\n";
echo "########## Run install\n"; echo "########## Run installer\n";
echo "\n"; echo "\n";
passthru("dropdb $JOB_NAME"); passthru("dropdb $JOB_NAME");
passthru_or_die("rm -Rf $HOME/mahara/sitedata/$JOB_NAME/*"); passthru_or_die("rm -Rf $HOME/mahara/sitedata/$JOB_NAME/*");
...@@ -295,16 +328,18 @@ if (!file_exists("external/composer.json")) { ...@@ -295,16 +328,18 @@ if (!file_exists("external/composer.json")) {
exit(0); exit(0);
} }
echo "\n"; echo "\n";
echo "########## Install composer\n"; echo "########## Install composer dependencies\n";
echo "\n"; echo "\n";
chdir('external'); chdir('external');
passthru_or_die("curl -sS https://getcomposer.org/installer | php"); passthru_or_die("curl -sS https://getcomposer.org/installer | php");
passthru_or_die(PHP_BINARY . ' composer.phar update'); passthru_or_die(PHP_BINARY . ' composer.phar update');
chdir('..'); chdir('..');
echo "\n"; echo "\n";
echo "########## Run unit tests\n"; echo "########## Run phpunit tests\n";
echo "\n"; echo "\n";
passthru_or_die( passthru_or_die(
'external/vendor/bin/phpunit htdocs/', 'external/vendor/bin/phpunit htdocs/',
...@@ -312,38 +347,9 @@ passthru_or_die( ...@@ -312,38 +347,9 @@ passthru_or_die(
."Please see the console output on test.mahara.org for details, and fix any failing tests." ."Please see the console output on test.mahara.org for details, and fix any failing tests."
); );
echo "\n";
echo "########## Verify that the patch contains a Behat test\n";
echo "\n";
if (trim(shell_exec("git diff-tree --no-commit-id --name-only -r HEAD | grep -c $BEHATTESTREGEX")) >= 1) {
echo "Patch includes a Behat test.\n";
}
else {
# Check whether the commit message has "behatnotneeded" in it.
if (trim(shell_exec("git log -1 | grep -i -c $BEHATNOTNEEDED")) >= 1) {
echo "This patch does not include a Behat test!\n... but the patch is marked with \"$BEHATNOTNEEDED\", so we will continue.\n";
}
else {
gerrit_comment(
"This patch does not include a Behat test (an automated test plan).\n\n"
."Please write a Behat test for it, or, if it cannot be tested in Behat or is covered by existing tests, put \"$BEHATNOTNEEDED\" in its commit message."
);
exit(1);
}
}
echo "\n";
echo "########## Build & Minify CSS\n";
echo "\n";
passthru('make clean-css');
passthru_or_die(
'make',
"This patch encountered an error while attempting to build its CSS.\n\n"
."This may be an error in Jenkins"
);
echo "\n"; echo "\n";
echo "########## Run Behat\n"; echo "########## Run Behat tests\n";
echo "\n"; echo "\n";
passthru_or_die( passthru_or_die(
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment