Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

UHF-11184: Remove druidfi/tools #46

Open
wants to merge 11 commits into
base: main
Choose a base branch
from
17 changes: 10 additions & 7 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,18 @@ on:
push:
branches:
- main
env:
SYMFONY_DEPRECATIONS_HELPER: disabled
name: CI
jobs:
tests:
runs-on: ubuntu-latest
strategy:
matrix:
php-versions: ['8.1', '8.2']
php-versions: ['8.3']
container:
image: ghcr.io/city-of-helsinki/drupal-php-docker:${{ matrix.php-versions }}-alpine
image: ghcr.io/city-of-helsinki/drupal-web:${{ matrix.php-versions }}
options: --user 1001

services:
db:
Expand All @@ -25,9 +28,7 @@ jobs:
- 3306:3306

steps:
- uses: actions/checkout@v3
with:
fetch-depth: 1
- uses: actions/checkout@v4

- name: Install required composer dependencies
run: composer install
Expand All @@ -42,6 +43,8 @@ jobs:
run:
vendor/bin/phpunit -c tests/phpunit.xml tests/

- name: Upload codecov
run: codecov
- uses: codecov/codecov-action@v5
with:
fail_ci_if_error: true
token: ${{ secrets.CODECOV_TOKEN }}

44 changes: 8 additions & 36 deletions src/Drush/Commands/UpdateDrushCommands.php
Original file line number Diff line number Diff line change
Expand Up @@ -126,41 +126,11 @@ private function parseOptions(array $options, string $root) : UpdateOptions {
return new UpdateOptions(
ignoreFiles: $ignoreFiles,
branch: $options['branch'],
updateExternalPackages: $options['update-external-packages'],
selfUpdate: $options['self-update'],
runMigrations: $options['run-migrations'],
);
}

/**
* Updates the dependencies.
*
* @param \DrupalTools\Update\UpdateOptions $options
* The update options.
* @param string $root
* The root directory.
*
* @return self
* The self.
*/
private function updateExternalPackages(UpdateOptions $options, string $root) : self {
if (!$options->updateExternalPackages) {
return $this;
}
$this->style->note('Checking external packages ...');

// Update druidfi/tools only if the package exists.
if ($this->filesystem->exists($root . '/tools')) {
$this->processManager()->process([
'make',
'self-update',
])->run(function (string $type, ?string $output) : void {
$this->style->write($output);
});
}
return $this;
}

/**
* Checks if the self-package needs to be updated.
*
Expand Down Expand Up @@ -257,11 +227,13 @@ private function updateDefaultFiles(UpdateOptions $options) : self {
'phpcs.xml.dist',
'phpunit.xml.dist',
'phpunit.platform.xml',
'tools/make/override.mk',
'tools/make/project/install.mk',
'tools/make/project/git.mk',
'tools/make/project/theme.mk',
'tools/make/project/db-sync.sh',
'Makefile',
'tools/make/composer.mk',
'tools/make/docker.mk',
'tools/make/drupal.mk',
'tools/make/git.mk',
'tools/make/qa.mk',
'tools/make/theme.mk',
'tools/commit-msg',
'.sonarcloud.properties',
'.github/pull_request_template.md',
Expand Down Expand Up @@ -325,7 +297,7 @@ public function updatePlatform(array $options = self::DEFAULT_OPTIONS) : int {

return DrushCommands::EXIT_FAILURE_WITH_CLARITY;
}
$this->updateExternalPackages($options, $root)
$this
->runUpdateHooks($options, $root)
->updateDefaultFiles($options)
->addDefaultFiles($options);
Expand Down
12 changes: 12 additions & 0 deletions src/Update/migrations.php
Original file line number Diff line number Diff line change
Expand Up @@ -287,3 +287,15 @@ function drupal_tools_update_14() : UpdateResult {
'Added phpstan/extension-installer to allow-plugins',
]);
}

/**
* Remove druidfi/tools.
*/
function drupal_tools_update_15(UpdateOptions $options, FileManager $fileManager): UpdateResult {
$fileManager->removeFiles($options, [
'tools',
]);
return new UpdateResult([
'Removed tools/ folder',
]);
}
7 changes: 0 additions & 7 deletions tests/src/Kernel/CheckPackageVersionsCommandsTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@

use Consolidation\OutputFormatters\StructuredData\RowsOfFields;
use Drupal\KernelTests\KernelTestBase;
use Drupal\Tests\helfi_api_base\Traits\ApiTestTrait;
use DrupalTools\Drush\Commands\PackageScannerDrushCommands;
use DrupalTools\OutputFormatters\MarkdownTableFormatter;
use DrupalTools\Package\ComposerOutdatedProcess;
Expand All @@ -25,14 +24,8 @@
*/
final class CheckPackageVersionsCommandsTest extends KernelTestBase {

use ApiTestTrait;
use ProphecyTrait;

/**
* {@inheritdoc}
*/
protected static $modules = ['helfi_api_base'];

/**
* Initialized a dummy Drush container.
*
Expand Down
Loading