From edb9df23d8732f7e28a159a068366c46c3a718be Mon Sep 17 00:00:00 2001 From: Adam Date: Wed, 3 Jul 2024 14:19:00 -0400 Subject: [PATCH] Test Drupal project compatibility in a matrix of template projects and PHP versions (#113) --- ...pal-recommended-project.yml => drupal.yml} | 23 +++++++++++-------- tests/ApiTest.php | 4 ++-- 2 files changed, 16 insertions(+), 11 deletions(-) rename .github/workflows/{drupal-recommended-project.yml => drupal.yml} (57%) diff --git a/.github/workflows/drupal-recommended-project.yml b/.github/workflows/drupal.yml similarity index 57% rename from .github/workflows/drupal-recommended-project.yml rename to .github/workflows/drupal.yml index d63285d..11682c2 100644 --- a/.github/workflows/drupal-recommended-project.yml +++ b/.github/workflows/drupal.yml @@ -1,4 +1,4 @@ -name: Drupal recommended-project Compatibility +name: Drupal compatibility on: push: @@ -10,7 +10,16 @@ on: jobs: composer-project: + name: ${{ matrix.template }} on PHP ${{ matrix.php }} runs-on: ubuntu-latest + strategy: + fail-fast: false + max-parallel: 10 + matrix: + php: ['8.1', '8.2', '8.3'] + template: + - recommended-project + - legacy-project steps: - name: Checkout self @@ -21,17 +30,13 @@ jobs: - name: Install PHP and Composer uses: shivammathur/setup-php@v2 with: - php-version: '8.1' + php-version: ${{ matrix.php }} tools: composer:v2 - - name: Create Drupal Project + - name: Create Drupal project run: | - composer create-project drupal/recommended-project project_name - cd project_name - # Set dev stability to allow for php-tuf/php-tuf to be installed. - composer config minimum-stability dev + composer create-project drupal/${{ matrix.template }} project + cd project composer config --no-plugins allow-plugins.php-tuf/composer-integration true - composer config github-oauth.github.com ${{ secrets.GITHUB_TOKEN }} - composer config repositories.vcs-php-tuf vcs https://github.com/php-tuf/php-tuf.git composer config repositories.local path ../composer-integration composer require php-tuf/composer-integration:@dev --with-all-dependencies diff --git a/tests/ApiTest.php b/tests/ApiTest.php index 614fbb4..d0650b1 100644 --- a/tests/ApiTest.php +++ b/tests/ApiTest.php @@ -354,13 +354,13 @@ public function testTargetFromUrl(): void 'repository' => $repository, ] ); - $repository->prepareMetadata($event); + $repository->prepareComposerMetadata($event); $this->assertSame(39, $event->getTransportOptions()['max_file_size']); // If the URL of the metadata doesn't start with the repository URL, // we should fall back to using the URL's path component as the target. $event->setProcessedUrl('http://localhost/another/target.json'); - $repository->prepareMetadata($event); + $repository->prepareComposerMetadata($event); $this->assertSame(59, $event->getTransportOptions()['max_file_size']); } }