From eb6c4977932439a1bac988e7603abc49b92f77aa Mon Sep 17 00:00:00 2001 From: Leo Feyer <1192057+leofeyer@users.noreply.github.com> Date: Wed, 8 May 2024 11:30:31 +0200 Subject: [PATCH 01/11] Create a separate cache per tool and branch --- phpstan.neon | 1 + tools/ecs/config/default.php | 2 +- tools/ecs/config/legacy.php | 2 +- tools/ecs/config/template.php | 2 +- tools/phpstan/config/config.php | 17 +++++++++++++++++ 5 files changed, 21 insertions(+), 3 deletions(-) create mode 100644 tools/phpstan/config/config.php diff --git a/phpstan.neon b/phpstan.neon index 7f9262abc67..045be2c339a 100644 --- a/phpstan.neon +++ b/phpstan.neon @@ -1,4 +1,5 @@ includes: + - tools/phpstan/config/config.php - tools/phpstan/vendor/phpstan/phpstan-phpunit/extension.neon - tools/phpstan/vendor/phpstan/phpstan-phpunit/rules.neon - tools/phpstan/vendor/phpstan/phpstan-symfony/extension.neon diff --git a/tools/ecs/config/default.php b/tools/ecs/config/default.php index 5fa214077a4..1cb8d433797 100644 --- a/tools/ecs/config/default.php +++ b/tools/ecs/config/default.php @@ -34,5 +34,5 @@ $ecsConfig->lineEnding("\n"); $parameters = $ecsConfig->parameters(); - $parameters->set(Option::CACHE_DIRECTORY, sys_get_temp_dir().'/ecs_default_cache'); + $parameters->set(Option::CACHE_DIRECTORY, sys_get_temp_dir().'/ecs/contao413'); }; diff --git a/tools/ecs/config/legacy.php b/tools/ecs/config/legacy.php index a49165684f4..829365d3b73 100644 --- a/tools/ecs/config/legacy.php +++ b/tools/ecs/config/legacy.php @@ -117,5 +117,5 @@ $ecsConfig->lineEnding("\n"); $parameters = $ecsConfig->parameters(); - $parameters->set(Option::CACHE_DIRECTORY, sys_get_temp_dir().'/ecs_legacy_cache'); + $parameters->set(Option::CACHE_DIRECTORY, sys_get_temp_dir().'/ecs/contao413-legacy'); }; diff --git a/tools/ecs/config/template.php b/tools/ecs/config/template.php index bdcc5d078fa..ce059cafcfd 100644 --- a/tools/ecs/config/template.php +++ b/tools/ecs/config/template.php @@ -36,5 +36,5 @@ $parameters = $ecsConfig->parameters(); $parameters->set(Option::FILE_EXTENSIONS, ['html5']); - $parameters->set(Option::CACHE_DIRECTORY, sys_get_temp_dir().'/ecs_template_cache'); + $parameters->set(Option::CACHE_DIRECTORY, sys_get_temp_dir().'/ecs/contao413-template'); }; diff --git a/tools/phpstan/config/config.php b/tools/phpstan/config/config.php new file mode 100644 index 00000000000..3bd81f3d34d --- /dev/null +++ b/tools/phpstan/config/config.php @@ -0,0 +1,17 @@ + [ + 'tmpDir' => sys_get_temp_dir().'/phpstan/contao413', + ], +]; From 06a71403cd18a4e83b8e97c3861baaca07f615d5 Mon Sep 17 00:00:00 2001 From: veronikaplenta <88315148+veronikaplenta@users.noreply.github.com> Date: Wed, 8 May 2024 13:45:12 +0200 Subject: [PATCH 02/11] Fix the CSS class of legacy templates in new elements and modules (see #7202) Description ----------- Fixes using the complete template name instead of the frontend module/content element type as CSS class for legacy template variants Commits ------- c5c89cc9 Use frontend module/content element type as CSS class again --- .../ContentElement/AbstractContentElementController.php | 2 +- .../FrontendModule/AbstractFrontendModuleController.php | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/core-bundle/src/Controller/ContentElement/AbstractContentElementController.php b/core-bundle/src/Controller/ContentElement/AbstractContentElementController.php index 5bb466f5956..b6014dec94a 100644 --- a/core-bundle/src/Controller/ContentElement/AbstractContentElementController.php +++ b/core-bundle/src/Controller/ContentElement/AbstractContentElementController.php @@ -72,7 +72,7 @@ protected function addDefaultDataToTemplate(FragmentTemplate $template, array $m if ($this->isLegacyTemplate($template->getName())) { // Legacy fragments $this->addHeadlineToTemplate($template, $modelData['headline'] ?? null); - $this->addCssAttributesToTemplate($template, $template->getName(), $modelData['cssID'] ?? null, $classes); + $this->addCssAttributesToTemplate($template, 'ce_'.$this->getType(), $modelData['cssID'] ?? null, $classes); $this->addPropertiesToTemplate($template, $properties); $this->addSectionToTemplate($template, $section); diff --git a/core-bundle/src/Controller/FrontendModule/AbstractFrontendModuleController.php b/core-bundle/src/Controller/FrontendModule/AbstractFrontendModuleController.php index 3443943fe38..dd1cadd36e3 100644 --- a/core-bundle/src/Controller/FrontendModule/AbstractFrontendModuleController.php +++ b/core-bundle/src/Controller/FrontendModule/AbstractFrontendModuleController.php @@ -77,7 +77,7 @@ protected function addDefaultDataToTemplate(FragmentTemplate $template, array $m if ($this->isLegacyTemplate($template->getName())) { // Legacy fragments $this->addHeadlineToTemplate($template, $modelData['headline'] ?? null); - $this->addCssAttributesToTemplate($template, $template->getName(), $modelData['cssID'] ?? null, $classes); + $this->addCssAttributesToTemplate($template, 'mod_'.$this->getType(), $modelData['cssID'] ?? null, $classes); $this->addPropertiesToTemplate($template, $properties); $this->addSectionToTemplate($template, $section); From 3ee448d1a33c3317e98f6d3f2b25ffc64d2c3d0c Mon Sep 17 00:00:00 2001 From: Leo Feyer <1192057+leofeyer@users.noreply.github.com> Date: Wed, 8 May 2024 17:33:22 +0200 Subject: [PATCH 03/11] Enable colors in the GitHub actions log files (see #7193) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Description ----------- @contao/developers I‘m not sure if this is any better than adding `--ansi` flags to the individual commands. WDYT? Commits ------- 4fc54608 Set `TERM: xterm` in the GitHub workflow files 5c8ab457 Try changing the default shell 7c467c12 Adjust the other .yml files, too cf64c06d Hide the progress bar in the checkout action b6e4897a Simplify the YAMLlint job --- .github/workflows/ci.yml | 62 ++++++++++++++++++++++++---------- .github/workflows/coverage.yml | 9 ++++- .github/workflows/split.yml | 9 ++++- 3 files changed, 60 insertions(+), 20 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index bcb016d21a6..5d5c2c9a949 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -5,6 +5,11 @@ on: permissions: read-all +defaults: + run: + # Simulate an interactive terminal with color support + shell: script -q -e -c "export TERM=xterm; bash {0}" + jobs: rector: name: Rector @@ -18,7 +23,9 @@ jobs: coverage: none - name: Checkout - uses: actions/checkout@v3 + uses: actions/checkout@v4 + with: + show-progress: false - name: Install the dependencies run: | @@ -40,7 +47,9 @@ jobs: coverage: none - name: Checkout - uses: actions/checkout@v3 + uses: actions/checkout@v4 + with: + show-progress: false - name: Install the dependencies run: | @@ -62,7 +71,9 @@ jobs: coverage: none - name: Checkout - uses: actions/checkout@v3 + uses: actions/checkout@v4 + with: + show-progress: false - name: Install the dependencies run: | @@ -86,7 +97,9 @@ jobs: coverage: none - name: Checkout - uses: actions/checkout@v3 + uses: actions/checkout@v4 + with: + show-progress: false - name: Install the dependencies run: | @@ -101,14 +114,12 @@ jobs: runs-on: ubuntu-latest steps: - name: Checkout - uses: actions/checkout@v3 + uses: actions/checkout@v4 + with: + show-progress: false - name: Run YAMLlint - run: | - python3 -m pip install --upgrade pip - python3 -m pip install --upgrade setuptools wheel - python3 -m pip install --upgrade yamllint - /home/runner/.local/bin/yamllint . + run: yamllint --format=github . service-linter: name: Service linter @@ -122,7 +133,9 @@ jobs: coverage: none - name: Checkout - uses: actions/checkout@v3 + uses: actions/checkout@v4 + with: + show-progress: false - name: Install the dependencies run: | @@ -144,9 +157,10 @@ jobs: coverage: none - name: Checkout - uses: actions/checkout@v3 + uses: actions/checkout@v4 with: fetch-depth: 0 + show-progress: false - name: Install the dependencies run: | @@ -181,7 +195,9 @@ jobs: mysql -uroot -proot -e "CREATE database contao_test" - name: Checkout - uses: actions/checkout@v3 + uses: actions/checkout@v4 + with: + show-progress: false - name: Install the dependencies run: composer install --no-interaction --no-progress @@ -211,7 +227,9 @@ jobs: coverage: none - name: Checkout - uses: actions/checkout@v3 + uses: actions/checkout@v4 + with: + show-progress: false - name: Install the dependencies run: composer install --no-interaction --no-progress @@ -237,7 +255,9 @@ jobs: mysql -uroot -proot -e "CREATE database contao_test" - name: Checkout - uses: actions/checkout@v3 + uses: actions/checkout@v4 + with: + show-progress: false - name: Install the dependencies run: composer install --ignore-platform-req=php+ --no-interaction --no-progress @@ -267,7 +287,9 @@ jobs: mysql -uroot -proot -e "CREATE database contao_test" - name: Checkout - uses: actions/checkout@v3 + uses: actions/checkout@v4 + with: + show-progress: false - name: Install the dependencies run: composer update --prefer-lowest --prefer-stable --no-interaction --no-progress @@ -297,7 +319,9 @@ jobs: coverage: none - name: Checkout - uses: actions/checkout@v3 + uses: actions/checkout@v4 + with: + show-progress: false - name: Test the single bundles run: | @@ -337,7 +361,9 @@ jobs: coverage: none - name: Checkout - uses: actions/checkout@v3 + uses: actions/checkout@v4 + with: + show-progress: false - name: Install the dependencies run: | diff --git a/.github/workflows/coverage.yml b/.github/workflows/coverage.yml index 82a9157764c..b7cd6e7d752 100644 --- a/.github/workflows/coverage.yml +++ b/.github/workflows/coverage.yml @@ -10,6 +10,11 @@ on: permissions: read-all +defaults: + run: + # Simulate an interactive terminal with color support + shell: script -q -e -c "export TERM=xterm; bash {0}" + jobs: coverage: name: Codecov @@ -23,7 +28,9 @@ jobs: coverage: pcov - name: Checkout - uses: actions/checkout@v3 + uses: actions/checkout@v4 + with: + show-progress: false - name: Install the dependencies run: composer install --no-interaction --no-progress diff --git a/.github/workflows/split.yml b/.github/workflows/split.yml index 4af23f3f984..3759cee3115 100644 --- a/.github/workflows/split.yml +++ b/.github/workflows/split.yml @@ -9,6 +9,11 @@ on: permissions: read-all +defaults: + run: + # Simulate an interactive terminal with color support + shell: script -q -e -c "export TERM=xterm; bash {0}" + jobs: monorepo-split: name: Monorepo split @@ -22,7 +27,9 @@ jobs: coverage: none - name: Checkout - uses: actions/checkout@v3 + uses: actions/checkout@v4 + with: + show-progress: false - name: Cache the monorepo split uses: actions/cache@v3 From e808972d7cbc647fc099cca6519658ff7674198c Mon Sep 17 00:00:00 2001 From: Leo Feyer <1192057+leofeyer@users.noreply.github.com> Date: Wed, 8 May 2024 18:44:54 +0200 Subject: [PATCH 04/11] Use a Composer action that supports caching (see #7204) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Description ----------- Let‘s see if that speeds up the actions. Commits ------- 11e0688b Use a Composer action that supports caching --- .github/workflows/ci.yml | 103 +++++++++++++++++++++------------ .github/workflows/coverage.yml | 4 +- 2 files changed, 68 insertions(+), 39 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 5d5c2c9a949..12ce92b41a5 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -27,10 +27,13 @@ jobs: with: show-progress: false - - name: Install the dependencies - run: | - composer install --no-interaction --no-progress - composer bin rector install --no-interaction --no-progress + - name: Install Contao + uses: ramsey/composer-install@v3 + + - name: Install Rector + uses: ramsey/composer-install@v3 + with: + working-directory: vendor-bin/rector - name: Run Rector run: vendor-bin/rector/vendor/bin/rector --dry-run --no-progress-bar @@ -51,10 +54,13 @@ jobs: with: show-progress: false - - name: Install the dependencies - run: | - composer install --no-interaction --no-progress - composer bin ecs install --no-interaction --no-progress + - name: Install Contao + uses: ramsey/composer-install@v3 + + - name: Install ECS + uses: ramsey/composer-install@v3 + with: + working-directory: vendor-bin/ecs - name: Run ECS run: vendor-bin/ecs/vendor/bin/ecs check --no-progress-bar @@ -75,10 +81,13 @@ jobs: with: show-progress: false - - name: Install the dependencies - run: | - composer install --no-interaction --no-progress - composer bin ecs install --no-interaction --no-progress + - name: Install Contao + uses: ramsey/composer-install@v3 + + - name: Install ECS + uses: ramsey/composer-install@v3 + with: + working-directory: vendor-bin/ecs - name: Run ECS run: | @@ -101,10 +110,13 @@ jobs: with: show-progress: false - - name: Install the dependencies - run: | - composer install --no-interaction --no-progress - composer bin phpstan install --no-interaction --no-progress + - name: Install Contao + uses: ramsey/composer-install@v3 + + - name: Install PHPStan + uses: ramsey/composer-install@v3 + with: + working-directory: vendor-bin/phpstan - name: Run PHPStan run: vendor-bin/phpstan/vendor/bin/phpstan analyse --no-progress @@ -137,10 +149,13 @@ jobs: with: show-progress: false - - name: Install the dependencies - run: | - composer install --no-interaction --no-progress - composer bin service-linter install --no-interaction --no-progress + - name: Install Contao + uses: ramsey/composer-install@v3 + + - name: Install the service linter + uses: ramsey/composer-install@v3 + with: + working-directory: vendor-bin/service-linter - name: Run the service linter run: vendor-bin/service-linter/bin/lint-service-ids @@ -162,11 +177,18 @@ jobs: fetch-depth: 0 show-progress: false - - name: Install the dependencies - run: | - composer install --no-interaction --no-progress - composer -dcore-bundle install --no-interaction --no-progress - composer bin depcheck install --no-interaction --no-progress + - name: Install Contao + uses: ramsey/composer-install@v3 + + - name: Install the core bundle + uses: ramsey/composer-install@v3 + with: + working-directory: core-bundle + + - name: Install depcheck + uses: ramsey/composer-install@v3 + with: + working-directory: vendor-bin/depcheck - name: Check for unknown symbols (contao/contao) run: vendor-bin/depcheck/vendor/bin/composer-dependency-analyser --config=depcheck.php @@ -199,8 +221,8 @@ jobs: with: show-progress: false - - name: Install the dependencies - run: composer install --no-interaction --no-progress + - name: Install Contao + uses: ramsey/composer-install@v3 - name: Run the unit tests run: vendor/bin/phpunit @@ -231,8 +253,8 @@ jobs: with: show-progress: false - - name: Install the dependencies - run: composer install --no-interaction --no-progress + - name: Install Contao + uses: ramsey/composer-install@v3 - name: Run the unit tests in reverse order run: vendor/bin/phpunit --order-by=reverse --extensions Contao\\CoreBundle\\Tests\\PhpunitExtension\\GlobalStateWatcher @@ -259,8 +281,10 @@ jobs: with: show-progress: false - - name: Install the dependencies - run: composer install --ignore-platform-req=php+ --no-interaction --no-progress + - name: Install Contao + uses: ramsey/composer-install@v3 + with: + composer-options: --ignore-platform-req=php+ - name: Run the unit tests run: vendor/bin/phpunit @@ -291,8 +315,10 @@ jobs: with: show-progress: false - - name: Install the dependencies - run: composer update --prefer-lowest --prefer-stable --no-interaction --no-progress + - name: Install Contao + uses: ramsey/composer-install@v3 + with: + dependency-versions: lowest - name: Run the unit tests run: vendor/bin/phpunit @@ -365,10 +391,13 @@ jobs: with: show-progress: false - - name: Install the dependencies - run: | - composer install --no-interaction --no-progress - composer bin monorepo-tools install --no-interaction --no-progress + - name: Install Contao + uses: ramsey/composer-install@v3 + + - name: Install PHPStan + uses: ramsey/composer-install@v3 + with: + working-directory: vendor-bin/monorepo-tools - name: Validate the composer.json files run: vendor-bin/monorepo-tools/vendor/bin/monorepo-tools composer-json --validate diff --git a/.github/workflows/coverage.yml b/.github/workflows/coverage.yml index b7cd6e7d752..a0bcdc98001 100644 --- a/.github/workflows/coverage.yml +++ b/.github/workflows/coverage.yml @@ -32,8 +32,8 @@ jobs: with: show-progress: false - - name: Install the dependencies - run: composer install --no-interaction --no-progress + - name: Install Contao + uses: ramsey/composer-install@v3 - name: Generate the coverage report run: php -d pcov.enabled=1 vendor/bin/phpunit --testsuite=coverage --coverage-clover=clover.xml From 688114f8b6e06e790222763a96b37824f16da0de Mon Sep 17 00:00:00 2001 From: Leo Feyer <1192057+leofeyer@users.noreply.github.com> Date: Fri, 10 May 2024 11:20:55 +0200 Subject: [PATCH 05/11] Update all workflow actions to their latest version (see #7206) Description ----------- Commits ------- 07cb83b0 Update all workflow actions to their latest version --- .github/workflows/ci.yml | 10 +++++----- .github/workflows/pr.yml | 2 +- .github/workflows/split.yml | 4 ++-- 3 files changed, 8 insertions(+), 8 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 12ce92b41a5..1140fc45171 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -180,11 +180,6 @@ jobs: - name: Install Contao uses: ramsey/composer-install@v3 - - name: Install the core bundle - uses: ramsey/composer-install@v3 - with: - working-directory: core-bundle - - name: Install depcheck uses: ramsey/composer-install@v3 with: @@ -193,6 +188,11 @@ jobs: - name: Check for unknown symbols (contao/contao) run: vendor-bin/depcheck/vendor/bin/composer-dependency-analyser --config=depcheck.php + - name: Install the core bundle + uses: ramsey/composer-install@v3 + with: + working-directory: core-bundle + - name: Check for unknown symbols (contao/core-bundle) run: vendor-bin/depcheck/vendor/bin/composer-dependency-analyser --config=depcheck.php --composer-json=core-bundle/composer.json diff --git a/.github/workflows/pr.yml b/.github/workflows/pr.yml index 604f89cee13..716012f263b 100644 --- a/.github/workflows/pr.yml +++ b/.github/workflows/pr.yml @@ -14,7 +14,7 @@ jobs: continue-on-error: true steps: - name: Assign the PR - uses: toshimaru/auto-author-assign@v1.4.0 + uses: toshimaru/auto-author-assign@v2.1.0 - name: Assign the milestone uses: zoispag/action-assign-milestone@v1 diff --git a/.github/workflows/split.yml b/.github/workflows/split.yml index 3759cee3115..f3b191d391a 100644 --- a/.github/workflows/split.yml +++ b/.github/workflows/split.yml @@ -32,13 +32,13 @@ jobs: show-progress: false - name: Cache the monorepo split - uses: actions/cache@v3 + uses: actions/cache@v4 with: path: .monorepo-split-cache key: dev-${GITHUB_REF##*/} - name: Install the dependencies - run: composer global require contao/monorepo-tools:dev-main + run: composer global require contao/monorepo-tools:^0.2 - name: Split the monorepo run: $HOME/.composer/vendor/bin/monorepo-tools split ${GITHUB_REF##*/} ${{ github.event.forced && '--force-push' || '' }} From 119935ed169668222447530174f33139e5855b54 Mon Sep 17 00:00:00 2001 From: Leo Feyer <1192057+leofeyer@users.noreply.github.com> Date: Fri, 10 May 2024 11:46:04 +0200 Subject: [PATCH 06/11] Update the CI workflows (see #7207) Description ----------- Commits ------- 5884a342 Update the CI workflows b2206fdd Use codecov-action@v4 61867d8d Fix the ci.yml file ac0c6dfe Fix the reverse order tests --- .github/workflows/ci.yml | 133 ++++++++++++------ .github/workflows/coverage.yml | 15 +- .github/workflows/pr.yml | 3 +- .github/workflows/split.yml | 15 +- .../tests/Command/ContaoSetupCommandTest.php | 8 ++ 5 files changed, 119 insertions(+), 55 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index c2913def722..2f99f631659 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -5,6 +5,11 @@ on: permissions: read-all +defaults: + run: + # Simulate an interactive terminal with color support + shell: script -q -e -c "export TERM=xterm; bash {0}" + jobs: ecs: name: ECS @@ -18,12 +23,17 @@ jobs: coverage: none - name: Checkout - uses: actions/checkout@v3 + uses: actions/checkout@v4 + with: + show-progress: false - - name: Install the dependencies - run: | - composer install --no-interaction --no-progress - composer bin ecs install --no-interaction --no-progress + - name: Install Contao + uses: ramsey/composer-install@v3 + + - name: Install ECS + uses: ramsey/composer-install@v3 + with: + working-directory: tools/ecs - name: Run ECS run: tools/ecs/vendor/bin/ecs check *-bundle/bin *-bundle/src *-bundle/tests tools/*/src --config tools/ecs/config/default.php --no-progress-bar @@ -40,12 +50,17 @@ jobs: coverage: none - name: Checkout - uses: actions/checkout@v3 + uses: actions/checkout@v4 + with: + show-progress: false - - name: Install the dependencies - run: | - composer install --no-interaction --no-progress - composer bin ecs install --no-interaction --no-progress + - name: Install Contao + uses: ramsey/composer-install@v3 + + - name: Install ECS + uses: ramsey/composer-install@v3 + with: + working-directory: tools/ecs - name: Run ECS run: | @@ -64,12 +79,17 @@ jobs: coverage: none - name: Checkout - uses: actions/checkout@v3 + uses: actions/checkout@v4 + with: + show-progress: false - - name: Install the dependencies - run: | - composer install --no-interaction --no-progress - composer bin phpstan install --no-interaction --no-progress + - name: Install Contao + uses: ramsey/composer-install@v3 + + - name: Install PHPStan + uses: ramsey/composer-install@v3 + with: + working-directory: tools/phpstan - name: Run PHPStan run: tools/phpstan/vendor/bin/phpstan analyse --no-progress @@ -79,14 +99,12 @@ jobs: runs-on: ubuntu-latest steps: - name: Checkout - uses: actions/checkout@v3 + uses: actions/checkout@v4 + with: + show-progress: false - name: Run YAMLlint - run: | - python3 -m pip install --upgrade pip - python3 -m pip install --upgrade setuptools wheel - python3 -m pip install --upgrade yamllint - /home/runner/.local/bin/yamllint . + run: yamllint --format=github . service-linter: name: Service linter @@ -100,12 +118,17 @@ jobs: coverage: none - name: Checkout - uses: actions/checkout@v3 + uses: actions/checkout@v4 + with: + show-progress: false - - name: Install the dependencies - run: | - composer install --no-interaction --no-progress - composer bin service-linter install --no-interaction --no-progress + - name: Install Contao + uses: ramsey/composer-install@v3 + + - name: Install the service linter + uses: ramsey/composer-install@v3 + with: + working-directory: tools/service-linter - name: Run the service linter run: tools/service-linter/bin/lint-service-ids @@ -122,9 +145,10 @@ jobs: coverage: none - name: Checkout - uses: actions/checkout@v3 + uses: actions/checkout@v4 with: fetch-depth: 0 + show-progress: false - name: Install the dependencies run: | @@ -167,10 +191,12 @@ jobs: mysql -uroot -proot -e "CREATE database contao_test" - name: Checkout - uses: actions/checkout@v3 + uses: actions/checkout@v4 + with: + show-progress: false - - name: Install the dependencies - run: composer install --no-interaction --no-progress + - name: Install Contao + uses: ramsey/composer-install@v3 - name: Run the unit tests run: vendor/bin/phpunit @@ -197,10 +223,12 @@ jobs: coverage: none - name: Checkout - uses: actions/checkout@v3 + uses: actions/checkout@v4 + with: + show-progress: false - - name: Install the dependencies - run: composer install --no-interaction --no-progress + - name: Install Contao + uses: ramsey/composer-install@v3 - name: Run the unit tests in reverse order run: vendor/bin/phpunit --order-by=reverse --extensions Contao\\CoreBundle\\Tests\\PhpunitExtension\\GlobalStateWatcher @@ -223,10 +251,14 @@ jobs: mysql -uroot -proot -e "CREATE database contao_test" - name: Checkout - uses: actions/checkout@v3 + uses: actions/checkout@v4 + with: + show-progress: false - - name: Install the dependencies - run: composer install --ignore-platform-req=php --no-interaction --no-progress + - name: Install Contao + uses: ramsey/composer-install@v3 + with: + composer-options: --ignore-platform-req=php+ - name: Run the unit tests run: vendor/bin/phpunit @@ -253,10 +285,14 @@ jobs: mysql -uroot -proot -e "CREATE database contao_test" - name: Checkout - uses: actions/checkout@v3 + uses: actions/checkout@v4 + with: + show-progress: false - - name: Install the dependencies - run: composer update --prefer-lowest --prefer-stable --no-interaction --no-progress + - name: Install Contao + uses: ramsey/composer-install@v3 + with: + dependency-versions: lowest - name: Run the unit tests run: vendor/bin/phpunit @@ -283,7 +319,9 @@ jobs: coverage: none - name: Checkout - uses: actions/checkout@v3 + uses: actions/checkout@v4 + with: + show-progress: false - name: Test the single bundles run: | @@ -327,12 +365,17 @@ jobs: coverage: none - name: Checkout - uses: actions/checkout@v3 + uses: actions/checkout@v4 + with: + show-progress: false - - name: Install the dependencies - run: | - composer install --no-interaction --no-progress - composer bin monorepo install --no-interaction --no-progress + - name: Install Contao + uses: ramsey/composer-install@v3 + + - name: Install the monorepo tools + uses: ramsey/composer-install@v3 + with: + working-directory: tools/monorepo - name: Validate the composer.json files run: tools/monorepo/vendor/bin/monorepo-tools composer-json --validate diff --git a/.github/workflows/coverage.yml b/.github/workflows/coverage.yml index d6217ca5209..884b8bd21e0 100644 --- a/.github/workflows/coverage.yml +++ b/.github/workflows/coverage.yml @@ -10,6 +10,11 @@ on: permissions: read-all +defaults: + run: + # Simulate an interactive terminal with color support + shell: script -q -e -c "export TERM=xterm; bash {0}" + jobs: coverage: name: Codecov @@ -23,16 +28,18 @@ jobs: coverage: pcov - name: Checkout - uses: actions/checkout@v3 + uses: actions/checkout@v4 + with: + show-progress: false - - name: Install the dependencies - run: composer install --no-interaction --no-progress + - name: Install Contao + uses: ramsey/composer-install@v3 - name: Generate the coverage report run: php -d pcov.enabled=1 vendor/bin/phpunit --testsuite=coverage --coverage-clover=clover.xml - name: Upload the coverage report - uses: codecov/codecov-action@v3 + uses: codecov/codecov-action@v4 with: files: ./clover.xml fail_ci_if_error: true diff --git a/.github/workflows/pr.yml b/.github/workflows/pr.yml index 77abb343b65..2ab60e7e057 100644 --- a/.github/workflows/pr.yml +++ b/.github/workflows/pr.yml @@ -5,7 +5,6 @@ on: types: [opened] permissions: - issues: write pull-requests: write jobs: @@ -15,7 +14,7 @@ jobs: continue-on-error: true steps: - name: Assign the author - uses: toshimaru/auto-author-assign@v1.4.0 + uses: toshimaru/auto-author-assign@v2.1.0 - name: Assign the milestone uses: zoispag/action-assign-milestone@v1 diff --git a/.github/workflows/split.yml b/.github/workflows/split.yml index f5fec7e8d25..611b70fc1b2 100644 --- a/.github/workflows/split.yml +++ b/.github/workflows/split.yml @@ -9,6 +9,11 @@ on: permissions: read-all +defaults: + run: + # Simulate an interactive terminal with color support + shell: script -q -e -c "export TERM=xterm; bash {0}" + jobs: monorepo-split: name: Monorepo split @@ -22,18 +27,20 @@ jobs: coverage: none - name: Checkout - uses: actions/checkout@v3 + uses: actions/checkout@v4 + with: + show-progress: false - name: Cache the monorepo split - uses: actions/cache@v1 + uses: actions/cache@v4 with: path: .monorepo-split-cache key: dev-${GITHUB_REF##*/} - name: Install the dependencies - run: composer global require contao/monorepo-tools:dev-main + run: composer global require contao/monorepo-tools:^0.2 - name: Split the monorepo - run: $HOME/.composer/vendor/bin/monorepo-tools split ${GITHUB_REF##*/} + run: $HOME/.composer/vendor/bin/monorepo-tools split ${GITHUB_REF##*/} ${{ github.event.forced && '--force-push' || '' }} env: GITHUB_TOKEN: ${{ secrets.MONOREPO_SPLIT_TOKEN }} diff --git a/manager-bundle/tests/Command/ContaoSetupCommandTest.php b/manager-bundle/tests/Command/ContaoSetupCommandTest.php index b15abccf06d..d4cd3b9776d 100644 --- a/manager-bundle/tests/Command/ContaoSetupCommandTest.php +++ b/manager-bundle/tests/Command/ContaoSetupCommandTest.php @@ -15,6 +15,7 @@ use Contao\ManagerBundle\Command\ContaoSetupCommand; use Contao\TestCase\ContaoTestCase; use Symfony\Component\Console\Output\OutputInterface; +use Symfony\Component\Console\Terminal; use Symfony\Component\Console\Tester\CommandTester; use Symfony\Component\Dotenv\Dotenv; use Symfony\Component\Filesystem\Filesystem; @@ -24,6 +25,13 @@ class ContaoSetupCommandTest extends ContaoTestCase { + protected function tearDown(): void + { + $this->resetStaticProperties([Terminal::class]); + + parent::tearDown(); + } + public function testIsHidden(): void { $command = new ContaoSetupCommand('project/dir', 'project/dir/public', 'secret'); From 660043b847a2ca953ea0d2bb313306ad28a33370 Mon Sep 17 00:00:00 2001 From: Leo Feyer <1192057+leofeyer@users.noreply.github.com> Date: Fri, 10 May 2024 11:46:56 +0200 Subject: [PATCH 07/11] Use version 4 of codecov/codecov-action --- .github/workflows/ci.yml | 2 +- .github/workflows/coverage.yml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 1140fc45171..2a9e828e5df 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -394,7 +394,7 @@ jobs: - name: Install Contao uses: ramsey/composer-install@v3 - - name: Install PHPStan + - name: Install the monorepo tools uses: ramsey/composer-install@v3 with: working-directory: vendor-bin/monorepo-tools diff --git a/.github/workflows/coverage.yml b/.github/workflows/coverage.yml index a0bcdc98001..09efe832906 100644 --- a/.github/workflows/coverage.yml +++ b/.github/workflows/coverage.yml @@ -39,7 +39,7 @@ jobs: run: php -d pcov.enabled=1 vendor/bin/phpunit --testsuite=coverage --coverage-clover=clover.xml - name: Upload the coverage report - uses: codecov/codecov-action@v3 + uses: codecov/codecov-action@v4 with: files: ./clover.xml fail_ci_if_error: true From 59eb1b9cd8507d2946878288f8bc930bacad7455 Mon Sep 17 00:00:00 2001 From: Leo Feyer <1192057+leofeyer@users.noreply.github.com> Date: Fri, 10 May 2024 12:14:43 +0200 Subject: [PATCH 08/11] Try out the Twig CS fixer (see #7143) Description ----------- I played with the [Twig CS Fixer](https://github.com/VincentLanglet/Twig-CS-Fixer) and this is roughly what it suggests to change. There were some false positives that I couldn't suppress, so we can't add it to our CI chain yet, but we can discuss the suggestions. The latter was already reported in https://github.com/VincentLanglet/Twig-CS-Fixer/issues/161. Commits ------- b1bd73a6 Try out the Twig CS fixer --- .../templates/twig/component/_picture.html.twig | 12 ++++++------ .../twig/content_element/description_list.html.twig | 6 +++--- core-bundle/templates/Collector/contao.html.twig | 2 +- .../Frontend/preview_toolbar_base_js.html.twig | 8 ++++---- .../templates/Image/Studio/_macros.html.twig | 13 ++++++------- core-bundle/templates/Image/Studio/figure.html.twig | 2 +- 6 files changed, 21 insertions(+), 22 deletions(-) diff --git a/core-bundle/contao/templates/twig/component/_picture.html.twig b/core-bundle/contao/templates/twig/component/_picture.html.twig index 940291fedd8..8adea47869f 100644 --- a/core-bundle/contao/templates/twig/component/_picture.html.twig +++ b/core-bundle/contao/templates/twig/component/_picture.html.twig @@ -27,15 +27,15 @@ {# Just an image (no sources) #} {% block image %} {% set img = figure.image.img %} - {% set defineProportions = img.width|default(false) and img.height|default(false) %} + {% set define_proportions = img.width|default(false) and img.height|default(false) %} {% set img_attributes = attrs() .set('src', img.src) .set('alt', figure.hasMetadata ? figure.metadata.alt|insert_tag : '') .setIfExists('title', figure.hasMetadata ? figure.metadata.title|insert_tag : null) .setIfExists('srcset', img.srcset is defined and img.srcset != img.src ? img.srcset : null) .setIfExists('sizes', img.sizes|default) - .setIfExists('width', defineProportions ? img.width : null) - .setIfExists('height', defineProportions ? img.height : null) + .setIfExists('width', define_proportions ? img.width : null) + .setIfExists('height', define_proportions ? img.height : null) .setIfExists('loading', img.loading|default) .addClass(img.class|default) .mergeWith(figure.options.img_attr|default) @@ -53,14 +53,14 @@ {% block sources %} {% for source in figure.image.sources %} {% block source %} - {% set defineProportions = source.width|default(false) and source.height|default(false) %} + {% set define_proportions = source.width|default(false) and source.height|default(false) %} {% set source_attributes = attrs() .set('srcset', source.srcset) .setIfExists('sizes', source.sizes|default) .setIfExists('media', source.media|default) .setIfExists('type', source.type|default) - .setIfExists('width', defineProportions ? source.width : null) - .setIfExists('height', defineProportions ? source.height : null) + .setIfExists('width', define_proportions ? source.width : null) + .setIfExists('height', define_proportions ? source.height : null) .mergeWith(figure.options.picture_attr|default) .mergeWith(source_attributes|default) %} diff --git a/core-bundle/contao/templates/twig/content_element/description_list.html.twig b/core-bundle/contao/templates/twig/content_element/description_list.html.twig index 03d63f055e6..fc4cfa1457a 100644 --- a/core-bundle/contao/templates/twig/content_element/description_list.html.twig +++ b/core-bundle/contao/templates/twig/content_element/description_list.html.twig @@ -1,14 +1,14 @@ {% extends "@Contao/content_element/_base.html.twig" %} {% block content %} -