containers/base/php-base/Dockerfile | 8 ++- containers/base/php-base/conf/scripts/start.sh | 3 + .../PHPUnitFunctionalJSJob.php | 83 ++++++++++++++++++++++ .../JobTypes/phpunit--functional-js/drupalci.yml | 17 +++++ 4 files changed, 109 insertions(+), 2 deletions(-) diff --git a/containers/base/php-base/Dockerfile b/containers/base/php-base/Dockerfile index 10826a0..12f3834 100644 --- a/containers/base/php-base/Dockerfile +++ b/containers/base/php-base/Dockerfile @@ -53,6 +53,9 @@ RUN apt-get clean && apt-get update && \ make \ mysql-client \ ncurses-dev \ + phantomjs \ + nodejs \ + npm \ php5-dev \ postgresql-client \ postgresql-client-common \ @@ -63,8 +66,9 @@ RUN apt-get clean && apt-get update && \ supervisor \ unixODBC-dev \ unzip && \ - apt-get clean && apt-get autoremove -y && \ - rm /etc/cron.d/php5 + apt-get clean && apt-get autoremove -y && \ + rm /etc/cron.d/php5 && \ + npm install -g eslint ## # PHPENV. diff --git a/containers/base/php-base/conf/scripts/start.sh b/containers/base/php-base/conf/scripts/start.sh index 088de62..845246c 100755 --- a/containers/base/php-base/conf/scripts/start.sh +++ b/containers/base/php-base/conf/scripts/start.sh @@ -83,6 +83,9 @@ fi mkdir -p /var/www/html/sites/default/files/ /var/www/html/sites/simpletest chown -fR www-data /var/www/html/sites/default/files/ /var/www/html/sites/simpletest +# Start phantomJS +phantomjs --ssl-protocol=any --ignore-ssl-errors=true /var/www/vendor/jcalderonzumba/gastonjs/src/Client/main.js 8510 1024 768 2>&1 >> /dev/null & + # Run the test suite. echo "" echo "Operation [run tests]..." diff --git a/src/DrupalCI/Plugin/JobTypes/phpunit--functional-js/PHPUnitFunctionalJSJob.php b/src/DrupalCI/Plugin/JobTypes/phpunit--functional-js/PHPUnitFunctionalJSJob.php new file mode 100644 index 0000000..07d82f9 --- /dev/null +++ b/src/DrupalCI/Plugin/JobTypes/phpunit--functional-js/PHPUnitFunctionalJSJob.php @@ -0,0 +1,83 @@ + '5.4', + 'DCI_CoreRepository' => 'git://drupalcode.org/project/drupal.git', + 'DCI_CoreBranch' => '8.0.x', + 'DCI_GitCheckoutDepth' => '1', + 'DCI_RunScript' => "/var/www/html/core/vendor/phpunit/phpunit/phpunit", + 'DCI_RunOptions' => "-c core --testsuite=functional", + 'DCI_RunTarget' => "/var/www/html/core" + ); + + /** + * {@inheritdoc} + */ + public $requiredArguments = array( + ); + + /** + * Return an array of possible argument variables for this job type. + * + * The 'availableArguments' property is intended to provide a complete list + * of possible variable values which can affect this particular job type, + * along with details regarding how each variable affects the job operation. + * These are specified in an array, with the variable names used as the keys + * for the array and the description used as the array values. + */ + public $availableArguments = array( + // ***** Variables Available for any job type ***** + 'DCI_UseLocalCodebase' => 'Used to define a local codebase to be cloned (instead of performing a Git checkout)', + 'DCI_WorkingDir' => 'Defines the location to be used in creating the local copy of the codebase, to be mapped into the container as a container volume. Default: /tmp/simpletest-[random string]', + 'DCI_ResultsServer' => 'Specifies the url string of a DrupalCI results server for which to publish job results', + 'DCI_ResultsServerConfig' => 'Specifies the location of a configuration file on the test runner containg a DrupalCI Results Server configuration to use in publishing results.', + 'DCI_JobBuildId' => 'Specifies a unique build ID assigned to this job from an upstream server', + 'DCI_JobId' => 'Specifies a unique results server node ID to use when publishing results for this job.', + 'DCI_JobType' => 'Specifies a default job type to assume for a "drupalci run" command', + 'DCI_EXCLUDE' => 'Specifies whether to exclude the .git directory during a clone of a local codebase.', //TODO: Check logic, may be reversed. + + // ***** Default Variables defined for every phpUnit job ***** + 'DCI_PHPVersion' => 'Defines the PHP Version used within the executable container for this job type. Default: 5.4', + 'DCI_CoreRepository' => 'Defines the primary repository to be checked out while building the codebase to test. Default: git://drupalcode.org/project/drupal.git', + 'DCI_CoreBranch' => 'Defines the branch on the primary repository to be checked out while building the codebase to test. Default: 8.0.x', + 'DCI_GitCheckoutDepth' => 'Defines the depth parameter passed to git clone while checking out the core repository. Default: 1', + 'DCI_RunScript' => 'Defines the default run script to be executed on the container. Default: /var/www/html/core/scripts/run-tests.sh', + 'DCI_RunOptions' => 'A string containing initial runScript options to append to the run script when performing a job.', + // Default: '--bootstrap /var/www/html/core/tests/bootstrap.php', + 'DCI_RunTarget' => 'A string defining the initial runScript target to append to the run script when performing a job.', + // Default: '/var/www/html/core/tests/Drupal/Tests' + + // ***** Optional Arguments ***** + 'DCI_Fetch' => 'Used to specify any files which should be downloaded while building out the codebase.', + // Syntax: 'url1,relativelocaldirectory1;url2,relativelocaldirectory2;...' + 'DCI_Patch' => 'Defines any patches which should be applied while building out the codebase.', + // Syntax: 'localfile1,applydirectory1;localfile2,applydirectory2;...' + 'DCI_RunScriptArguments' => 'An array of other build script options which will be added to the runScript command when executing a job.', + // Syntax: 'argkey1,argvalue1;argkey2,argvalue2;argkey3;argkey4,argvalue4; + 'DCI_ListGroups' => 'Directs the test runner to list available test groups instead of executing tests. (i.e. Specifies --list-groups).', + 'DCI_PHPUnitBootstrapFile', + ); +} diff --git a/src/DrupalCI/Plugin/JobTypes/phpunit--functional-js/drupalci.yml b/src/DrupalCI/Plugin/JobTypes/phpunit--functional-js/drupalci.yml new file mode 100644 index 0000000..286104a --- /dev/null +++ b/src/DrupalCI/Plugin/JobTypes/phpunit--functional-js/drupalci.yml @@ -0,0 +1,17 @@ +# Job Definition Template for the DrupalCI 'PHPUnit' Job Type +environment: + web: + - %DCI_PHPVersion% +setup: + checkout: + # DCI_UseLocalCodebase plugin can override the checkout array to look like: + # - protocol: local + # source_dir: %DCI_SourceDirectory% + - protocol: git + repo: %DCI_CoreRepository% + branch: %DCI_CoreBranch% + depth: %DCI_GitCheckoutDepth% + checkout_dir: . +execute: + command: + - %DCI_RunScript% %DCI_RunOptions% %DCI_RunTarget%