Skip to content

Commit

Permalink
Merge pull request #243 from lemberg/feature/235-drop-ubuntu-1604
Browse files Browse the repository at this point in the history
Drop support of ubuntu/focal64
  • Loading branch information
T2L committed Jun 11, 2021
2 parents f204c18 + ebbe2a3 commit acfb660
Show file tree
Hide file tree
Showing 12 changed files with 215 additions and 28 deletions.
4 changes: 1 addition & 3 deletions .github/workflows/Integrate.yml
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,6 @@ jobs:
python-version:
- '3.8'
molecule-platform:
- xenial64
- bionic64
- focal64

Expand Down Expand Up @@ -145,7 +144,6 @@ jobs:
php-version:
- '7.4'
vagrant-box:
- xenial64
- bionic64
- focal64

Expand Down Expand Up @@ -177,7 +175,7 @@ jobs:
run: composer install --no-interaction --no-progress --no-suggest --prefer-dist --optimize-autoloader --no-dev

- name: Set Vagrant box to use
run: sed -i '' 's/xenial64/${{ matrix.vagrant-box }}/g' default.vm-settings.yml
run: sed -i '' 's/focal64/${{ matrix.vagrant-box }}/g' default.vm-settings.yml

- name: Provision the machine
run: vagrant up
Expand Down
11 changes: 11 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,14 @@
## Draft Environment (Unreleased)

Updates:

- [GH-235](https://github.com/lemberg/draft-environment/pull/235) - Drop Ubuntu 16.04 support. Make Ubuntu 20.04 the default guest OS. Side effect: updated all Ansible roles:
* oefenweb.swapfile (v2.0.32 => v2.0.33)
* geerlingguy.mysql (3.3.0 => 3.3.1)
* t2l.php (1.4.0 => 1.5.0)
* t2l.composer (2.0.3 => 2.0.4)
* t2l.java (1.3.2 => 1.3.3)

## Draft Environment 3.3.2 (2021-03-13)

Updates:
Expand Down
10 changes: 5 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -56,14 +56,14 @@ Dramatically increases disk IO on Windows by adding NFS support.
Here's the list of used roles:

- draft (internal)
- [oefenweb.swapfile @ v2.0.32](https://github.com/Oefenweb/ansible-swapfile/tree/v2.0.32)
- [oefenweb.swapfile @ v2.0.33](https://github.com/Oefenweb/ansible-swapfile/tree/v2.0.33)
- [geerlingguy.mailhog @ 2.2.0](https://github.com/geerlingguy/ansible-role-mailhog/tree/2.2.0)
- git_config (internal)
- apache2 (internal)
- [geerlingguy.mysql @ 3.3.0](https://github.com/geerlingguy/ansible-role-mysql/tree/3.3.0)
- [t2l.php @ 1.4.0](https://github.com/T2L/ansible-role-php/tree/1.4.0)
- [t2l.composer @ 2.0.3](https://github.com/T2L/ansible-role-composer/tree/2.0.3)
- [t2l.java @ 1.3.2](https://github.com/T2L/ansible-role-java/tree/1.3.2)
- [geerlingguy.mysql @ 3.3.1](https://github.com/geerlingguy/ansible-role-mysql/tree/3.3.1)
- [t2l.php @ 1.5.0](https://github.com/T2L/ansible-role-php/tree/1.5.0)
- [t2l.composer @ 2.0.4](https://github.com/T2L/ansible-role-composer/tree/2.0.4)
- [t2l.java @ 1.3.3](https://github.com/T2L/ansible-role-java/tree/1.3.3)
- [t2l.solr @ 2.2.2](https://github.com/T2L/ansible-role-solr/tree/2.2.2)

2. Create and provision the guest machine:
Expand Down
15 changes: 7 additions & 8 deletions default.vm-settings.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,8 @@ vagrant:
# Do not change this value, unless absolutely necessary. Valid use case is
# 32-bit host machine and no support for virtualization of 64-bit guest
# machine.
# Defaults to 'Official Ubuntu Server 16.04 LTS (Xenial Xerus)'.
# Change this parameter in the local settings file.
box: ubuntu/xenial64
# Defaults to 'Official Ubuntu Server 20.04 LTS (Focal Fossa)'.
box: ubuntu/focal64
# Box version.
box_version: '>= 0'
# Disable automatic update checking be setting this option to false.
Expand Down Expand Up @@ -106,7 +105,7 @@ draft_features:

ssh_default_directory: '{{ vagrant.destination_directory }}'

# Role: oefenweb.swapfile @ v2.0.28
# Role: oefenweb.swapfile @ v2.0.33

# Set swap file size.
swapfile_size: 2GB
Expand All @@ -130,7 +129,7 @@ apache2_document_root: docroot
# Log level to use
apache2_log_level: error

# Role: geerlingguy.mysql @ 3.3.0
# Role: geerlingguy.mysql @ 3.3.1

# Set this to the user ansible is logging in as - should have root
# or sudo access
Expand Down Expand Up @@ -261,7 +260,7 @@ mysql_replication_master: ''
# Same keys as `mysql_users` above.
mysql_replication_user: []

# Role: t2l.php @ 1.4.0
# Role: t2l.php @ 1.5.0

# PHP version to install. Possible values: 5.6, 7.0 - 7.4, and 8.0
php_version: '7.4'
Expand Down Expand Up @@ -319,7 +318,7 @@ php_web_server_daemon: apache2
# Boolean indicating whether to restart web server or not.
php_restart_web_server: true

# Role: t2l.composer @ 2.0.3
# Role: t2l.composer @ 2.0.4

# Composer installation directory.
composer_install_dir: /usr/local/bin
Expand All @@ -336,7 +335,7 @@ composer_keep_updated: true
# PHP executable name.
composer_php_executable: php

# Role: t2l.java @ 1.3.2
# Role: t2l.java @ 1.3.3

# Open JDK version(s) and package type (jre or jdk).
# Currently supported versions are 6-13 (however not every Java version is
Expand Down
10 changes: 5 additions & 5 deletions provisioning/requirements.yml
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
---
- src: oefenweb.swapfile
version: v2.0.32
version: v2.0.33
- src: geerlingguy.mailhog
version: 2.2.0
- src: geerlingguy.mysql
version: 3.3.0
version: 3.3.1
- src: t2l.php
version: 1.4.0
version: 1.5.0
- src: t2l.composer
version: 2.0.3
version: 2.0.4
- src: t2l.java
version: 1.3.2
version: 1.3.3
- src: t2l.solr
version: 2.2.2
2 changes: 2 additions & 0 deletions src/App.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,8 @@ final class App {

public const PACKAGE_NAME = 'lemberg/draft-environment';

public const LAST_AVAILABLE_UPDATE_WEIGHT = 9;

/**
* @var \Composer\Composer
*/
Expand Down
2 changes: 1 addition & 1 deletion src/Config/Update/Step/Xdebug2To3.php
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ public function update(array &$config): void {
}
if (array_key_exists('xdebug.remote_connect_back', $xdebug_config)) {
$this->replaceArrayKey($xdebug_config, 'xdebug.remote_connect_back', 'xdebug.discover_client_host');
$xdebug_config['xdebug.discover_client_host'] = $xdebug_config['xdebug.discover_client_host'] === 'On' ? TRUE : FALSE;
$xdebug_config['xdebug.discover_client_host'] = $xdebug_config['xdebug.discover_client_host'] === 'On' ? 'true' : 'false';
}
}
}
Expand Down
36 changes: 36 additions & 0 deletions src/Config/Update/Step/Xenial2Focal.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
<?php

declare(strict_types=1);

namespace Lemberg\Draft\Environment\Config\Update\Step;

use Lemberg\Draft\Environment\Config\Update\UpdateStepInterface;

/**
* Updates guest OS to Ubuntu 20.04.
*
* @link https://github.com/lemberg/draft-environment/issues/235
*/
final class Xenial2Focal extends AbstractUpdateStep implements UpdateStepInterface {

/**
* {@inheritdoc}
*/
public function getWeight(): int {
return 9;
}

/**
* {@inheritdoc}
*/
public function update(array &$config): void {
if (array_key_exists('vagrant', $config)) {
if (array_key_exists('box', $config['vagrant'])) {
if ($config['vagrant']['box'] === 'ubuntu/xenial64') {
$config['vagrant']['box'] = 'ubuntu/focal64';
}
}
}
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ final protected function assertComposerLockContainsPackageExtra(): void {
$key = array_search(App::PACKAGE_NAME, array_column($decoded_composer_lock['packages-dev'], 'name'), TRUE);

self::assertTrue($decoded_composer_lock['packages-dev'][$key]['extra']['draft-environment']['already-installed']);
self::assertSame(8, $decoded_composer_lock['packages-dev'][$key]['extra']['draft-environment']['last-update-weight']);
self::assertSame(App::LAST_AVAILABLE_UPDATE_WEIGHT, $decoded_composer_lock['packages-dev'][$key]['extra']['draft-environment']['last-update-weight']);
}

}
2 changes: 1 addition & 1 deletion tests/Unit/Config/Manager/UpdateManagerTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -177,7 +177,7 @@ public function testGetAndSetLastAppliedUpdateWeight(): void {
* Tests the last available update weight getter.
*/
public function testGetLastAvailableUpdateWeight(): void {
self::assertSame(8, $this->configUpdateManager->getLastAvailableUpdateWeight());
self::assertSame(App::LAST_AVAILABLE_UPDATE_WEIGHT, $this->configUpdateManager->getLastAvailableUpdateWeight());
}

}
8 changes: 4 additions & 4 deletions tests/Unit/Config/Update/Step/Xdebug2To3Test.php
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ final public function updateDataProvider(): array {
],
'xdebug' => [
'xdebug.mode' => 'debug',
'xdebug.discover_client_host' => TRUE,
'xdebug.discover_client_host' => 'true',
'xdebug.remote_log' => '/var/log/draft/php_xdebug_remote.log',
],
],
Expand All @@ -131,7 +131,7 @@ final public function updateDataProvider(): array {
],
'xdebug' => [
'xdebug.mode' => 'debug',
'xdebug.discover_client_host' => TRUE,
'xdebug.discover_client_host' => 'true',
'xdebug.remote_log' => '/var/log/draft/php_xdebug_remote.log',
],
],
Expand All @@ -157,7 +157,7 @@ final public function updateDataProvider(): array {
],
'xdebug' => [
'xdebug.mode' => 'off',
'xdebug.discover_client_host' => FALSE,
'xdebug.discover_client_host' => 'false',
'xdebug.remote_log' => '/var/log/draft/php_xdebug_remote.log',
],
],
Expand All @@ -183,7 +183,7 @@ final public function updateDataProvider(): array {
],
'xdebug' => [
'xdebug.mode' => 'debug',
'xdebug.discover_client_host' => TRUE,
'xdebug.discover_client_host' => 'true',
'xdebug.remote_log' => '/var/log/draft/php_xdebug_remote.log',
],
],
Expand Down
141 changes: 141 additions & 0 deletions tests/Unit/Config/Update/Step/Xenial2FocalTest.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,141 @@
<?php

declare(strict_types=1);

namespace Lemberg\Tests\Unit\Draft\Environment\Config\Update\Step;

use Composer\Composer;
use Composer\Config as ComposerConfig;
use Composer\IO\IOInterface;
use Lemberg\Draft\Environment\Config\Config;
use Lemberg\Draft\Environment\Config\Manager\UpdateManager;
use Lemberg\Draft\Environment\Config\Update\Step\Xenial2Focal;
use Lemberg\Draft\Environment\Utility\Filesystem;
use org\bovigo\vfs\vfsStream;
use PHPUnit\Framework\TestCase;

/**
* Tests updating the guest OS box configuration.
*
* @link https://github.com/lemberg/draft-environment/issues/204
*
* @covers \Lemberg\Draft\Environment\Config\Update\Step\AbstractUpdateStep
* @covers \Lemberg\Draft\Environment\Config\Update\Step\Xenial2Focal
*/
final class Xenial2FocalTest extends TestCase {

/**
* @var \Composer\Composer
*/
private $composer;

/**
* @var \Composer\IO\IOInterface
*/
private $io;

/**
* @var string
*/
private $root;

/**
* @var \Lemberg\Draft\Environment\Config\Manager\UpdateManagerInterface
*/
private $configUpdateManager;

/**
* {@inheritdoc}
*/
protected function setUp(): void {
$this->composer = new Composer();
$this->composer->setConfig(new ComposerConfig());
$this->io = $this->createMock(IOInterface::class);

// Mock source and target configuration directories.
$this->root = vfsStream::setup()->url();
$fs = new Filesystem();
$fs->mkdir(["$this->root/source", "$this->root/target"]);

$configObject = new Config("$this->root/source", "$this->root/target");
$this->configUpdateManager = new UpdateManager($this->composer, $this->io, $configObject);
}

/**
* Tests step weight getter.
*/
final public function testGetWeight(): void {
$step = new Xenial2Focal($this->composer, $this->io, $this->configUpdateManager);
self::assertSame(9, $step->getWeight());
}

/**
* Tests update step execution.
*
* @param array<string,mixed> $config
* @param array<string,mixed> $expectedConfig
*
* @dataProvider updateDataProvider
*/
final public function testUpdate(array $config, array $expectedConfig): void {
$step = new Xenial2Focal($this->composer, $this->io, $this->configUpdateManager);

$step->update($config);
self::assertSame($expectedConfig, $config);
}

/**
* Data provider for the ::testUpdate().
*
* @return array<int,array<int,string|array<string,mixed>>>
*/
final public function updateDataProvider(): array {
return [
[
[],
[],
],
[
[
'vagrant' => [
'box_version' => '>= 0',
],
],
[
'vagrant' => [
'box_version' => '>= 0',
],
],
],
[
[
'vagrant' => [
'box' => 'ubuntu/xenial64',
'box_version' => '>= 0',
],
],
[
'vagrant' => [
'box' => 'ubuntu/focal64',
'box_version' => '>= 0',
],
],
],
[
[
'vagrant' => [
'box' => 'ubuntu/bionic64',
'box_version' => '>= 0',
],
],
[
'vagrant' => [
'box' => 'ubuntu/bionic64',
'box_version' => '>= 0',
],
],
],
];
}

}

0 comments on commit acfb660

Please sign in to comment.