Skip to content

Commit

Permalink
DQA-8645: Prepare release 10.8.0 (#733)
Browse files Browse the repository at this point in the history
  • Loading branch information
joaocsilva authored Jan 30, 2024
1 parent 24fb591 commit 066d42d
Show file tree
Hide file tree
Showing 8 changed files with 57 additions and 42 deletions.
11 changes: 11 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,16 @@
# Toolkit change log

## Version 10.8.0
- DQA-7921: Align Toolkit default deployment commands with Drush standards.
- DQA-8113: Component check - Forbid deprecated scripts in composer.json.
- DQA-8575: Component-check (Unsupported) - Error when there is no reco….
- DQA-8115: Component check - Forbid deprecated configuration.
- DQA-8117: Detect PHPStan includes if using phpstan/extension-installer.
- DQA-8236: Allow to append commands for local development environment.
- DQA-8253: Setting drupal.site.settings_override_file ignored.
- DQA-8608: Toolkit phpcs ruleset improvements.
- DQA-8583: Module Evaluation error & group evaluation components.

## Version 9.17.0 | 10.7.0
- DQA-8360: Set the config drupal.root_absolute.
- DQA-8373: Opts-review should ignore upper-quotes.
Expand Down
2 changes: 1 addition & 1 deletion docs/guide/commands.rst
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ See bellow current list of available commands:
toolkit:patch-list [tk-pl] Lists remote patches from the root composer.json.
toolkit:requirements Check the Toolkit Requirements.
toolkit:run-blackfire [tk-bfire|tbf] Run Blackfire.
toolkit:run-deploy Run deployment sequence.
toolkit:run-deploy [tk-deploy] Run deployment sequence.
toolkit:run-gitleaks [tk-gitleaks] Executes the Gitleaks.
toolkit:run-phpcbf [tk-phpcbf] Run PHP code autofixing.
toolkit:setup-behat Setup the Behat file.
Expand Down
2 changes: 1 addition & 1 deletion phpdoc.dist.xml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
<paths>
<output>docs</output>
</paths>
<version number="10.7.0">
<version number="10.8.0">
<folder>latest</folder>
<api>
<source dsn=".">
Expand Down
21 changes: 17 additions & 4 deletions src/TaskRunner/Commands/DocumentationCommands.php
Original file line number Diff line number Diff line change
Expand Up @@ -149,19 +149,32 @@ public function toolkitGenerateDocumentation(ConsoleIO $io, array $options = [
*
* @aliases tk-gcl
*/
public function toolkitGenerateCommandsList()
public function toolkitGenerateCommandsList(ConsoleIO $io)
{
$commandsFile = 'docs/guide/commands.rst';
if (!file_exists($commandsFile)) {
$io->warning("The file $commandsFile could not be found.");
return ResultData::EXITCODE_OK;
}
// Get the available commands.
$commands = $this->taskExec($this->getBin('run'))
$commands = $this->taskExec($this->getBin('run') . ' --no-ansi')
->silent(true)->run()->getMessage();
if (empty($commands)) {
$io->error('Fail to load existing commands.');
return ResultData::EXITCODE_ERROR;
}
// Remove the header part.
$commands = preg_replace('/((.|\n)*)(Available commands:)/', '\3', $commands);
$commands = strstr($commands, 'Available commands:');
if (empty($commands)) {
$io->error('Fail to load existing commands from output.');
return ResultData::EXITCODE_ERROR;
}
// Add spaces to match the .rst format.
$commands = preg_replace('/^/im', ' ', $commands);

$start = ".. toolkit-block-commands\n\n.. code-block::\n\n";
$end = "\n\n.. toolkit-block-commands-end";
$task = $this->taskReplaceBlock('docs/guide/commands.rst')
$task = $this->taskReplaceBlock($commandsFile)
->start($start)->end($end)->content($commands);
return $this->collectionBuilder()->addTask($task);
}
Expand Down
31 changes: 18 additions & 13 deletions src/TaskRunner/Commands/ReleaseCommands.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@

use Composer\Semver\Semver;
use EcEuropa\Toolkit\TaskRunner\AbstractCommands;
use EcEuropa\Toolkit\Toolkit;
use Robo\Contract\VerbosityThresholdInterface;
use Robo\ResultData;
use Robo\Symfony\ConsoleIO;
Expand All @@ -29,14 +30,7 @@ class ReleaseCommands extends AbstractCommands
*
* @var string
*/
private string $releaseBranch = 'release/9.x';

/**
* The Toolkit repo url.
*
* @var string
*/
private string $repo = 'https://github.com/ec-europa/toolkit';
private string $releaseBranch = 'release/10.x';

/**
* Write the specified version string into needed places.
Expand Down Expand Up @@ -80,9 +74,10 @@ public function toolkitVersionWrite(ConsoleIO $io, string $version)
$tasks[] = $this->taskReplaceInFile('tests/fixtures/commands/tool.yml')
->regex('#Toolkit version OK \([0-9.]+\)#')
->to("Toolkit version OK ($version)");
$major = explode('.', $version)[0];
$tasks[] = $this->taskReplaceInFile('tests/fixtures/commands/tool.yml')
->regex('#Current version: [0-9.]+#')
->to("Current version: $version");
->to("Current version: $major");
}

return $this->collectionBuilder()->addTaskList($tasks);
Expand Down Expand Up @@ -128,6 +123,10 @@ public function toolkitChangelogWrite(ConsoleIO $io, string $version, string $fr
$from = $changelog_latest;
}
if (!Semver::satisfies($version, '>' . $from)) {
if (Semver::satisfies($version, '=' . $from)) {
$io->warning('Changelog file is already in the given version.');
return ResultData::EXITCODE_OK;
}
$io->error("The given version $version do not satisfies the version $from found in the $this->changelog file.");
return ResultData::EXITCODE_ERROR;
}
Expand All @@ -136,7 +135,8 @@ public function toolkitChangelogWrite(ConsoleIO $io, string $version, string $fr

if ($options['full-link'] === true) {
$changelog[] = '';
$changelog[] = "**Full Changelog**: $this->repo/compare/$from...$version";
$repo = Toolkit::REPOSITORY;
$changelog[] = "**Full Changelog**: https://github.com/$repo/compare/$from...$version";
}

$body = implode(PHP_EOL, $changelog) . PHP_EOL;
Expand Down Expand Up @@ -182,7 +182,12 @@ private function getLatestChangelogVersion()
}
$content = file_get_contents($this->changelog);
preg_match('/## Version (.*)/', $content, $match);
return !empty($match[1]) ? $match[1] : '';
$version = !empty($match[1]) ? $match[1] : '';
// Check if the changelog version contains two versions on it.
if (strpos($version, ' | ')) {
$version = explode(' | ', $version)[1];
}
return $version;
}

/**
Expand Down Expand Up @@ -251,10 +256,10 @@ private function prepareChangelogRow(array $data, array $options)

$log = ' - ' . trim($message, '.') . '.';
if ($options['show-name'] === true) {
$log .= ' by ' . $name;
$log .= " by $name";
}
if ($options['show-pr'] === true) {
$log .= ' in ' . $this->repo . "/pull/$pr";
$log .= ' in https://github.com/' . Toolkit::REPOSITORY . "/pull/$pr";
}

return $log;
Expand Down
2 changes: 1 addition & 1 deletion src/Toolkit.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ final class Toolkit
/**
* Constant holding the current version.
*/
public const VERSION = '10.7.0';
public const VERSION = '10.8.0';

/**
* The Toolkit repository.
Expand Down
21 changes: 4 additions & 17 deletions tests/fixtures/commands/documentation.yml
Original file line number Diff line number Diff line change
Expand Up @@ -103,29 +103,16 @@
resources: []
expectations:
- contains: |
[Simulator] Simulating Exec('./vendor/bin/run')
->silent(1)
[Simulator] Running ./vendor/bin/run
[error] in task EcEuropa\Toolkit\Task\File\ReplaceBlock
The file docs/guide/commands.rst could not be found.
[WARNING] The file docs/guide/commands.rst could not be found.
- command: 'toolkit:generate-commands-list'
resources:
- from: sample-commands.rst
to: docs/guide/commands.rst
expectations:
- contains: |
[Simulator] Simulating Exec('./vendor/bin/run')
[Simulator] Simulating Exec('./vendor/bin/run --no-ansi')
->silent(1)
[Simulator] Running ./vendor/bin/run
[Simulator] Simulating EcEuropa\Toolkit\Task\File\ReplaceBlock('docs/guide/commands.rst')
->start('.. toolkit-block-commands
.. code-block::
')
->end('
[Simulator] Running ./vendor/bin/run --no-ansi
.. toolkit-block-commands-end')
->content(' ')
[ERROR] Fail to load existing commands.
9 changes: 4 additions & 5 deletions tests/fixtures/commands/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
->to('Toolkit version OK (9.5.0)')
[Simulator] Simulating File\Replace('tests/fixtures/commands/tool.yml')
->regex('#Current version: [0-9.]+#')
->to('Current version: 9.5.0')
->to('Current version: 9')
- command: 'toolkit:version-write 9.5.0'
configuration: []
Expand Down Expand Up @@ -74,8 +74,7 @@
to: CHANGELOG.md
expectations:
- contains: |
[ERROR] The given version 9.5.0 do not satisfies the version 9.5.0 found in the
CHANGELOG.md file.
[WARNING] Changelog file is already in the given version.
- command: 'toolkit:changelog-write 9.6.0'
configuration: []
Expand All @@ -84,7 +83,7 @@
to: CHANGELOG.md
expectations:
- contains: |
[Simulator] Running git log 9.5.0...release/9.x --pretty='%s##%an##%ae' --reverse
[Simulator] Running git log 9.5.0...release/10.x --pretty='%s##%an##%ae' --reverse
[Simulator] Simulating Development\Changelog('CHANGELOG.md')
->setHeader('# Toolkit change log
Expand All @@ -102,7 +101,7 @@
to: CHANGELOG.md
expectations:
- contains: |
[Simulator] Running git log 9.5.0...release/9.x --pretty='%s##%an##%ae' --reverse
[Simulator] Running git log 9.5.0...release/10.x --pretty='%s##%an##%ae' --reverse
[Simulator] Simulating Development\Changelog('CHANGELOG.md')
->setHeader('# Toolkit change log
Expand Down

0 comments on commit 066d42d

Please sign in to comment.