From c57974856ac55326c18f747c03d602b160421e38 Mon Sep 17 00:00:00 2001 From: tuutti Date: Tue, 17 Dec 2024 16:01:28 +0200 Subject: [PATCH 01/11] UHF-11184: Remove druidfi/tools --- src/Drush/Commands/UpdateDrushCommands.php | 44 ++++------------------ src/Update/migrations.php | 9 +++++ 2 files changed, 17 insertions(+), 36 deletions(-) diff --git a/src/Drush/Commands/UpdateDrushCommands.php b/src/Drush/Commands/UpdateDrushCommands.php index b4dd6f6..49ad913 100644 --- a/src/Drush/Commands/UpdateDrushCommands.php +++ b/src/Drush/Commands/UpdateDrushCommands.php @@ -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. * @@ -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', @@ -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); diff --git a/src/Update/migrations.php b/src/Update/migrations.php index bd4ee0f..cb32f02 100644 --- a/src/Update/migrations.php +++ b/src/Update/migrations.php @@ -287,3 +287,12 @@ 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', + ]); +} From 18edfce84694298e66b007c80c045f0c5c1c9b11 Mon Sep 17 00:00:00 2001 From: tuutti Date: Tue, 17 Dec 2024 16:19:25 +0200 Subject: [PATCH 02/11] UHF-11184: Missing return --- src/Update/migrations.php | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/Update/migrations.php b/src/Update/migrations.php index cb32f02..7ca64dc 100644 --- a/src/Update/migrations.php +++ b/src/Update/migrations.php @@ -295,4 +295,7 @@ function drupal_tools_update_15(UpdateOptions $options, FileManager $fileManager $fileManager->removeFiles($options, [ 'tools', ]); + return new UpdateResult([ + 'Removed tools/ folder', + ]); } From 108aa5924789f15d99ebc867b74b92443d10c1ff Mon Sep 17 00:00:00 2001 From: tuutti Date: Tue, 17 Dec 2024 16:19:59 +0200 Subject: [PATCH 03/11] UHF-11184: Test php 8.3 and 8.4 --- .github/workflows/ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 0d38486..6286047 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -9,7 +9,7 @@ jobs: runs-on: ubuntu-latest strategy: matrix: - php-versions: ['8.1', '8.2'] + php-versions: ['8.3', '8.4'] container: image: ghcr.io/city-of-helsinki/drupal-php-docker:${{ matrix.php-versions }}-alpine From 2c14c9a1be6e28d0259d8746d6dc00d1313e7d70 Mon Sep 17 00:00:00 2001 From: tuutti Date: Tue, 17 Dec 2024 16:26:51 +0200 Subject: [PATCH 04/11] UHF-11184: Disable deprecations --- .github/workflows/ci.yml | 23 ++++++++--------------- 1 file changed, 8 insertions(+), 15 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 6286047..763ca18 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -3,6 +3,8 @@ on: push: branches: - main +env: + SYMFONY_DEPRECATIONS_HELPER: disabled name: CI jobs: tests: @@ -10,24 +12,15 @@ jobs: strategy: matrix: php-versions: ['8.3', '8.4'] - container: - image: ghcr.io/city-of-helsinki/drupal-php-docker:${{ matrix.php-versions }}-alpine - - services: - db: - image: mysql:8 - env: - MYSQL_USER: drupal - MYSQL_PASSWORD: drupal - MYSQL_DATABASE: drupal - MYSQL_ROOT_PASSWORD: drupal - ports: - - 3306:3306 steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 + + - name: Setup PHP with composer v2 + uses: shivammathur/setup-php@v2 with: - fetch-depth: 1 + php-version: ${{ matrix.php-versions }} + tools: composer:v2 - name: Install required composer dependencies run: composer install From 13ebf7e3522281d678a6163b5ced48c6ddc9d8f8 Mon Sep 17 00:00:00 2001 From: tuutti Date: Tue, 17 Dec 2024 16:29:39 +0200 Subject: [PATCH 05/11] UHF-11184: Use docker to run tests --- .github/workflows/ci.yml | 21 +++++++++++++++------ 1 file changed, 15 insertions(+), 6 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 763ca18..2f07bfa 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -12,15 +12,24 @@ jobs: strategy: matrix: php-versions: ['8.3', '8.4'] + container: + image: ghcr.io/city-of-helsinki/drupal-web:${{ matrix.php-versions }} + + services: + db: + image: mysql:8 + env: + MYSQL_USER: drupal + MYSQL_PASSWORD: drupal + MYSQL_DATABASE: drupal + MYSQL_ROOT_PASSWORD: drupal + ports: + - 3306:3306 steps: - - uses: actions/checkout@v4 - - - name: Setup PHP with composer v2 - uses: shivammathur/setup-php@v2 + - uses: actions/checkout@v3 with: - php-version: ${{ matrix.php-versions }} - tools: composer:v2 + fetch-depth: 1 - name: Install required composer dependencies run: composer install From 0dd7f091bc6b7519dd7c65c534ae71ca206872e9 Mon Sep 17 00:00:00 2001 From: tuutti Date: Tue, 17 Dec 2024 16:32:46 +0200 Subject: [PATCH 06/11] UHF-11184: Fixed docker user --- .github/workflows/ci.yml | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 2f07bfa..ee26075 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -14,6 +14,7 @@ jobs: php-versions: ['8.3', '8.4'] container: image: ghcr.io/city-of-helsinki/drupal-web:${{ matrix.php-versions }} + options: --user 1001 services: db: @@ -27,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 From 20f5d4ac6b61fcee147557026fbc0e65602aeec7 Mon Sep 17 00:00:00 2001 From: tuutti Date: Tue, 17 Dec 2024 16:38:35 +0200 Subject: [PATCH 07/11] UHF-11184: Use codecov action --- .github/workflows/ci.yml | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index ee26075..e31911f 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -43,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 }} From daaac69d209e740c880faf28ef7a4467e34c2e20 Mon Sep 17 00:00:00 2001 From: tuutti Date: Tue, 17 Dec 2024 16:49:35 +0200 Subject: [PATCH 08/11] UHF-11184: Removed unused api-base dependency --- composer.json | 1 - tests/src/Kernel/CheckPackageVersionsCommandsTest.php | 7 ------- 2 files changed, 8 deletions(-) diff --git a/composer.json b/composer.json index ea073dd..cb94b7a 100644 --- a/composer.json +++ b/composer.json @@ -5,7 +5,6 @@ "license": "GPL-2.0-or-later", "minimum-stability": "dev", "require": { - "drupal/helfi_api_base": "*", "drush/drush": "^12 || ^13" }, "conflict": { diff --git a/tests/src/Kernel/CheckPackageVersionsCommandsTest.php b/tests/src/Kernel/CheckPackageVersionsCommandsTest.php index 57861ce..4c88acf 100644 --- a/tests/src/Kernel/CheckPackageVersionsCommandsTest.php +++ b/tests/src/Kernel/CheckPackageVersionsCommandsTest.php @@ -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; @@ -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. * From 86789eeea37069d3b185d9e419d1acdf60990cd0 Mon Sep 17 00:00:00 2001 From: tuutti Date: Tue, 17 Dec 2024 16:52:18 +0200 Subject: [PATCH 09/11] UHF-11184: Fixed classmap --- composer.json | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/composer.json b/composer.json index cb94b7a..3feb612 100644 --- a/composer.json +++ b/composer.json @@ -35,8 +35,7 @@ "DrupalToolsTest\\": "tests/fixtures" }, "classmap": [ - "sut/core", - "sut/modules/contrib" + "sut/core" ], "files": [ "tests/fixtures/migration_fixture.php" ] }, From 7a020cfb052ab5ac51a7249e1bb64a138e5ce212 Mon Sep 17 00:00:00 2001 From: tuutti Date: Tue, 17 Dec 2024 16:58:21 +0200 Subject: [PATCH 10/11] UHF-11184: Readded api-tools dependency --- composer.json | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/composer.json b/composer.json index 3feb612..ea073dd 100644 --- a/composer.json +++ b/composer.json @@ -5,6 +5,7 @@ "license": "GPL-2.0-or-later", "minimum-stability": "dev", "require": { + "drupal/helfi_api_base": "*", "drush/drush": "^12 || ^13" }, "conflict": { @@ -35,7 +36,8 @@ "DrupalToolsTest\\": "tests/fixtures" }, "classmap": [ - "sut/core" + "sut/core", + "sut/modules/contrib" ], "files": [ "tests/fixtures/migration_fixture.php" ] }, From f52fbf8d4974e370ace8aa839cf16349f9fab243 Mon Sep 17 00:00:00 2001 From: tuutti Date: Tue, 17 Dec 2024 17:01:28 +0200 Subject: [PATCH 11/11] UHF-11184: Removed php 8.4 test for now --- .github/workflows/ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index e31911f..200af40 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -11,7 +11,7 @@ jobs: runs-on: ubuntu-latest strategy: matrix: - php-versions: ['8.3', '8.4'] + php-versions: ['8.3'] container: image: ghcr.io/city-of-helsinki/drupal-web:${{ matrix.php-versions }} options: --user 1001