Skip to content

Commit

Permalink
PHP 8.1 (#4975)
Browse files Browse the repository at this point in the history
* PHP 8.1

* Drupal version parameter must be quoted in order to ensure it is passed as a string rather than an integer

* Update steps for wodby image

* Drop test to see if the dump file is a gzip file. We'll find out if it is corrupt soon enough, when we untar the file.

* Recreate environment if the archive restore fails for any reason
  • Loading branch information
greg-1-anderson committed Jan 3, 2022
1 parent 47a90a3 commit 786bfcb
Show file tree
Hide file tree
Showing 3 changed files with 55 additions and 28 deletions.
64 changes: 44 additions & 20 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,31 +9,41 @@ defaults: &defaults
version: 2.1

executors:
linux81:
docker:
- image: wodby/php:8.1
environment:
- MYSQL_HOST=127.0.0.1
- UNISH_DB_URL=mysql://root:@127.0.0.1
- image: circleci/mysql:5.7.31
linux80:
docker:
- image: circleci/php:8.0-apache-node
- image: wodby/php:8.0
environment:
- MYSQL_HOST=127.0.0.1
- UNISH_DB_URL=mysql://root:@127.0.0.1
- image: circleci/mysql:5.7.31
linux74:
docker:
- image: circleci/php:7.4-apache-node
- image: wodby/php:7.4
environment:
- MYSQL_HOST=127.0.0.1
- UNISH_DB_URL=mysql://root:@127.0.0.1
- image: circleci/mysql:5.7.31
linux56:
docker:
- image: circleci/php:5.6-apache-node
- image: wodby/php:5.6
environment:
- MYSQL_HOST=127.0.0.1
- UNISH_DB_URL=mysql://root:@127.0.0.1
- 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/
- run: cp .docker/zz-php.ini /usr/local/etc/php/conf.d/
- run: php --version

jobs:
lint:
Expand Down Expand Up @@ -68,12 +78,26 @@ workflows:
jobs:
- lint
- test:
matrix:
parameters:
os: [linux80, linux74, linux56]
drupal: ["9.3.0","9.1.15", "7"]
exclude:
- os: linux56
drupal: "9.3.0"
- os: linux56
drupal: "9.1.15"
name: test-drupal-9.3-php-8.1
drupal: "9.3.0"
os: linux81
- test:
name: test-drupal-9.3-php-8.0
drupal: "9.3.0"
os: linux80
- test:
name: test-drupal-9.3-php-7.4
drupal: "9.3.0"
os: linux74
- test:
name: test-drupal-9.1-php-7.4
drupal: "9.1.15"
os: linux74
- test:
name: test-drupal-7-php-7.4
drupal: "7"
os: linux74
- test:
name: test-drupal-7-php-5.6
drupal: "7"
os: linux56
11 changes: 9 additions & 2 deletions tests/Unish/UnishTestCase.php
Original file line number Diff line number Diff line change
Expand Up @@ -288,11 +288,18 @@ function setUpDrupal($num_sites = 1, $install = FALSE, $version_string = NULL, $

$cache_keys = array($num_sites, $install ? 'install' : 'noinstall', $version_string, $profile, $db_driver);
$source = $this->directory_cache('environments') . '/' . implode('-', $cache_keys) . '.tar.gz';
$fetchAndInstall = true;
if (file_exists($source)) {
$this->log('Cache HIT. Environment: ' . $source, 'verbose');
$this->drush('archive-restore', array($source), array('destination' => $root, 'overwrite' => NULL));
try {
$this->drush('archive-restore', array($source), array('destination' => $root, 'overwrite' => NULL));
$fetchAndInstall = false;
}
catch (\Exception $e) {
$this->log('Unexpected error restoring saved environment. Re-installing instead.', 'warning');
}
}
else {
if ($fetchAndInstall) {
$this->log('Cache MISS. Environment: ' . $source, 'verbose');
// Build the site(s), install (if needed), then cache.
foreach ($sites_subdirs as $subdir) {
Expand Down
8 changes: 2 additions & 6 deletions tests/archiveDumpTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -61,12 +61,8 @@ public function testArchiveDump() {
$dump_dest = $this->archiveDump(FALSE);
$docroot = basename($this->webroot());

// Check the dump file is a gzip file.
$exec = sprintf('file %s', $dump_dest);
$this->execute($exec);
$output = $this->getOutput();
$expected = '%sgzip compressed data%s';
$this->assertStringMatchesFormat($expected, $output);
// Confirm that the dump exists
$this->assertFileExists($dump_dest);

// Untar the archive and make sure it looks right.
$untar_dest = $this->unTar($dump_dest);
Expand Down

0 comments on commit 786bfcb

Please sign in to comment.