Skip to content

Commit

Permalink
Test on circle (#4647)
Browse files Browse the repository at this point in the history
  • Loading branch information
greg-1-anderson committed Jan 30, 2021
1 parent 399927f commit 16ad1de
Show file tree
Hide file tree
Showing 8 changed files with 84 additions and 131 deletions.
54 changes: 52 additions & 2 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,31 @@ defaults: &defaults
TERM: dumb
PHPUNIT_ARGS: ""

version: 2
version: 2.1

executors:
linux74:
docker:
- image: circleci/php:7.4-apache-node
- image: circleci/mysql:5.7.31
linux56:
docker:
- image: circleci/php:5.6-apache-node
- image: circleci/mysql:5.6.50

commands:
prepare_php:
description: Installs the extensions we need and configures PHP to run Drush tests
steps:
- run: sudo apt-get update -y
- run: sudo apt-get install -y imagemagick libmagickwand-dev mariadb-client
- run: sudo docker-php-ext-install bcmath
- run: sudo docker-php-ext-install dom
- run: sudo docker-php-ext-install filter
- run: sudo docker-php-ext-install gd
- run: sudo docker-php-ext-install pdo_mysql
- run: sudo cp .docker/zz-php.ini /usr/local/etc/php/conf.d/

jobs:
lint:
<<: *defaults
Expand All @@ -17,8 +41,34 @@ jobs:
- run: composer install --prefer-dist --no-interaction
- run: composer lint

test:
parameters:
os:
type: executor
drupal:
type: string
executor: << parameters.os >>
environment:
UNISH_NO_TIMEOUTS: y
UNISH_DB_URL: mysql://root:@127.0.0.1
UNISH_DRUPAL_VERSION: << parameters.drupal >>
steps:
- checkout
- prepare_php
- run: composer install --prefer-dist --no-interaction
- run: ./unish.sh

workflows:
version: 2
build_test:
jobs:
- lint
- test:
matrix:
parameters:
os: [linux74, linux56]
drupal: ["9.1.3", "8.9.13", "7"]
exclude:
- os: linux56
drupal: "9.1.3"
- os: linux56
drupal: "8.9.13"
8 changes: 8 additions & 0 deletions .docker/zz-php.ini
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
[PHP]
variables_order = GPCS
error_reporting = E_ALL & ~E_DEPRECATED
date.timezone = "UTC"
sendmail_path = "true"
mbstring.http_input = pass
mbstring.http_output = pass
memory_limit = -1
120 changes: 0 additions & 120 deletions .travis.yml

This file was deleted.

10 changes: 9 additions & 1 deletion tests/bootstrap.inc
Original file line number Diff line number Diff line change
Expand Up @@ -24,14 +24,22 @@ unish_init();
function unish_init() {
// Default drupal major version to run tests over.
$unish_drupal_major = '8';
$unish_drupal_minor = '';
if (getenv('UNISH_DRUPAL_VERSION')) {
if (preg_match('#([0-9]+)(\..*)*#', getenv('UNISH_DRUPAL_VERSION'), $matches)) {
$unish_drupal_major = $matches[1];
if ((count($matches) > 2) && ($unish_drupal_major >= 8)) {
$unish_drupal_minor = $matches[2];
}
}
}
if (getenv('UNISH_DRUPAL_MAJOR_VERSION')) {
$unish_drupal_major = getenv('UNISH_DRUPAL_MAJOR_VERSION');
}
elseif (isset($GLOBALS['UNISH_DRUPAL_MAJOR_VERSION'])) {
$unish_drupal_major = $GLOBALS['UNISH_DRUPAL_MAJOR_VERSION'];
}
define('UNISH_DRUPAL_MAJOR_VERSION', $unish_drupal_major);
$unish_drupal_minor = '';
if ($unish_drupal_major >= 8) {
if (getenv('UNISH_DRUPAL_MINOR_VERSION')) {
$unish_drupal_minor = '.' . getenv('UNISH_DRUPAL_MINOR_VERSION');
Expand Down
4 changes: 3 additions & 1 deletion tests/completeTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,13 +21,15 @@ static function setUpBeforeClass() {
file_put_contents(UNISH_SANDBOX . '/drushrc.php', trim($contents));
}



public function testComplete() {
if ($this->is_windows()) {
$this->markTestSkipped('Complete tests not fully working nor needed on Windows.');
}

$this->markTestSkipped("This test was working on TravisCI. A pull request to fix it on CircleCI would be welcome.");

// We copy our completetest commandfile into our path.
// We cannot use --include since complete deliberately avoids drush
// command dispatch.
Expand Down
4 changes: 2 additions & 2 deletions tests/makefiles/qd-devel.make
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
core = "7.x"
api = 2

projects[drupal][version] = "7.42"
projects[drupal][version] = "7.78"
defaults[projects][subdir] = "contrib"
projects[devel] = "1.3"
projects[devel] = "1.7"
1 change: 1 addition & 0 deletions tests/quickDrupalTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ private function runQuickDrupalTest($test) {
}

function testQuickDrupal() {
$this->markTestSkipped("This test was working on TravisCI. A pull request to fix it on CircleCI would be welcome.");
$this->runQuickDrupalTest('devel');
}

Expand Down
14 changes: 9 additions & 5 deletions tests/sqlDumpTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,10 @@ function testSqlDump() {
$this->assertNotContains('DROP TABLE IF EXISTS', $full_dump_file);
}

$table_to_check = 'history';
if (UNISH_DRUPAL_MAJOR_VERSION > 7) {
$table_to_check = 'cache_config';
}

// First, do a test without any aliases, and dump the whole database
$this->drush('sql-dump', array(), array_merge($options, $site_selection_options));
Expand All @@ -52,7 +56,7 @@ function testSqlDump() {
// Test that we have sane contents.
$this->assertContains('queue', $full_dump_file);
// Test skip-files-list and wildcard expansion.
$this->assertNotContains('history', $full_dump_file);
$this->assertNotContains($table_to_check, $full_dump_file);
// Next, set up an alias file and run a couple of simulated
// tests to see if options are propagated correctly.
// Control: insure options are not set when not specified
Expand All @@ -64,7 +68,7 @@ function testSqlDump() {
// Test that we have sane contents.
$this->assertContains('queue', $full_dump_file);
// Test skip-files-list and wildcard expansion.
$this->assertContains('history', $full_dump_file);
$this->assertContains($table_to_check, $full_dump_file);

$aliasPath = UNISH_SANDBOX . '/aliases';
mkdir($aliasPath);
Expand Down Expand Up @@ -93,7 +97,7 @@ function testSqlDump() {
// Test that we have sane contents.
$this->assertContains('queue', $full_dump_file);
// Test skip-files-list and wildcard expansion.
$this->assertNotContains('history', $full_dump_file);
$this->assertNotContains($table_to_check, $full_dump_file);
// Repeat control test: options not recovered in absence of an alias.
unlink($full_dump_file_path);
$this->drush('sql-dump', array(), array_merge($options, $site_selection_options));
Expand All @@ -102,7 +106,7 @@ function testSqlDump() {
// Test that we have sane contents.
$this->assertContains('queue', $full_dump_file);
// Test skip-files-list and wildcard expansion.
$this->assertContains('history', $full_dump_file);
$this->assertContains($table_to_check, $full_dump_file);
// Now run yet with @self, and test to see that Drush can recover the option
// --skip-tables-list, defined in @test.
unlink($full_dump_file_path);
Expand All @@ -112,6 +116,6 @@ function testSqlDump() {
// Test that we have sane contents.
$this->assertContains('queue', $full_dump_file);
// Test skip-files-list and wildcard expansion.
$this->assertNotContains('history', $full_dump_file);
$this->assertNotContains($table_to_check, $full_dump_file);
}
}

0 comments on commit 16ad1de

Please sign in to comment.