Skip to content

Commit 828f229

Browse files
authored
Merge pull request #7613 from ampproject/update/composer-packages
Update composer packages; Bump PHP to 7.4 and WP to 5.3
2 parents 956c8d2 + 3eb015a commit 828f229

39 files changed

+2867
-1777
lines changed

.github/workflows/build-test-measure.yml

Lines changed: 71 additions & 102 deletions
Original file line numberDiff line numberDiff line change
@@ -101,8 +101,6 @@ jobs:
101101

102102
- name: Install Node dependencies
103103
run: npm ci
104-
env:
105-
CI: true
106104

107105
- name: Detect coding standard violations (stylelint)
108106
run: npm run lint:css
@@ -126,8 +124,6 @@ jobs:
126124

127125
- name: Install Node dependencies
128126
run: npm ci
129-
env:
130-
CI: true
131127

132128
- name: Validate package.json
133129
run: npm run lint:pkg-json
@@ -300,8 +296,6 @@ jobs:
300296

301297
- name: Install Node dependencies
302298
run: npm ci
303-
env:
304-
CI: true
305299

306300
- name: Run unit tests (with coverage)
307301
run: npm run test:js -- --ci --cacheDirectory="$HOME/.jest-cache" --collectCoverage
@@ -351,8 +345,6 @@ jobs:
351345
352346
- name: Install Node dependencies
353347
run: npm ci
354-
env:
355-
CI: true
356348

357349
- name: Install Composer dependencies
358350
run: composer install --prefer-dist --optimize-autoloader --no-progress --no-interaction
@@ -374,6 +366,13 @@ jobs:
374366
env:
375367
COMPOSE_INTERACTIVE_NO_CLI: true
376368

369+
- name: Upload artifacts
370+
uses: actions/upload-artifact@v3
371+
if: failure()
372+
with:
373+
name: amp-e2e-artifacts
374+
path: artifacts
375+
377376
#-----------------------------------------------------------------------------------------------------------------------
378377

379378
# Adapted from workflow for running PHP unit tests on google/web-stories-wp.
@@ -405,52 +404,51 @@ jobs:
405404
install-pwa-plugin: [true]
406405
coverage: [false]
407406
include:
408-
- php: '8.0'
407+
- php: '8.3'
409408
wp: 'trunk'
410-
multisite: true
409+
phpunit: '9.6'
411410
experimental: true
412411

412+
- php: '8.2'
413+
wp: 'trunk'
414+
phpunit: '9.6'
415+
413416
- php: '8.1'
414417
wp: 'trunk'
415-
experimental: true
418+
phpunit: '9.6'
416419

417-
- php: '8.2'
420+
- php: '8.0'
418421
wp: 'trunk'
419-
experimental: true
422+
phpunit: '9.3'
423+
multisite: true
420424

421425
- php: '8.0'
422426
wp: 'latest'
427+
phpunit: '9.3'
423428
coverage: true
424429

425430
- php: '8.0'
426431
wp: 'latest'
432+
phpunit: '9.3'
427433
external-http: true
428434

429435
- php: '7.4'
430-
multisite: true
431436
wp: 'latest'
437+
phpunit: '9.3'
438+
multisite: true
432439

433440
- php: '7.4'
434441
wp: 'latest'
442+
phpunit: '9.3'
435443
external-http: true
436444

437-
- php: '7.3'
438-
wp: 'latest'
439-
440-
- php: '7.2'
441-
wp: 'latest'
442-
443-
- php: '7.1'
444-
wp: 'latest'
445-
446-
- php: '7.0'
447-
wp: '5.1'
448-
449-
- php: '7.0'
450-
wp: '5.0'
445+
- php: '7.4'
446+
wp: '5.3'
447+
phpunit: '7'
451448

452-
- php: '7.0'
453-
wp: '4.9'
449+
- php: '7.4'
450+
wp: '5.3'
451+
phpunit: '7'
454452
external-http: true
455453

456454
steps:
@@ -472,6 +470,7 @@ jobs:
472470
with:
473471
php-version: ${{ matrix.php }}
474472
extensions: curl, date, dom, gd, iconv, json, libxml, mysql, spl
473+
tools: phpunit:${{ matrix.phpunit }}
475474
coverage: ${{ matrix.coverage && 'xdebug' || 'none' }}
476475

477476
- name: Shutdown default MySQL service
@@ -508,55 +507,20 @@ jobs:
508507
509508
- name: Install Composer dependencies
510509
if: needs.pre-run.outputs.changed-php-count > 0
511-
run: |
512-
# phpdocumentor/reflection has to be removed as it makes use of an outdated dependency.
513-
composer remove --dev phpdocumentor/reflection
514-
composer install --prefer-dist --ignore-platform-reqs --no-progress --no-interaction
510+
run: composer install --prefer-dist --ignore-platform-reqs --no-progress --no-interaction
515511

516-
# See https://github.com/wp-cli/wp-cli/issues/5484
517-
- name: Remove conflicting Requests library
518-
if: needs.pre-run.outputs.changed-php-count > 0
519-
run: composer remove --dev --ignore-platform-reqs --no-interaction --no-scripts roave/security-advisories wp-cli/export-command wp-cli/extension-command wp-cli/wp-cli wp-cli/wp-cli-tests
520-
521-
# Installs a different PHPUnit version depending on the WP/PHP version combo we're testing against.
522-
#
523-
# | WP / PHP | PHPUnit |
524-
# |-----------|---------|
525-
# | 5.0 / 7.0 | 6 |
526-
# | 5.7 / 7.1 | 7 |
527-
# | 5.9 / 7.2 | 8 |
528-
# | 5.9 / 7.4 | 9 |
529-
# | * / 8 | 9 |
530-
#
531-
# See https://make.wordpress.org/core/handbook/references/phpunit-compatibility-and-wordpress-versions/
532-
- name: Update PHPUnit
512+
# Since locally installed PHPUnit classes are loaded into the classmap, running tests with globally
513+
# installed PHPUnit requires removing locally installed PHPUnit. Additionally, using the workflow matrix
514+
# makes it simple for us to maintain different PHPUnit versions for various PHP versions.
515+
- name: Remove locally installed PHPUnit
533516
if: needs.pre-run.outputs.changed-php-count > 0
534517
run: |
535-
if [[ $PHP_VERSION == "7.1" ]]; then
536-
echo "Installing PHPUnit 7.5.x"
537-
composer require --ignore-platform-reqs --no-interaction --no-scripts phpunit/phpunit:^7.5 --with-dependencies
538-
elif [[ $PHP_VERSION == "7.2" ]]; then
539-
echo "Installing PHPUnit 8.5.x"
540-
composer require --ignore-platform-reqs --no-interaction --no-scripts phpunit/phpunit:^8.5 --with-dependencies
541-
echo "Downgrading phpunit/php-token-stream because the latest version requires PHP 7.3"
542-
composer require --ignore-platform-reqs --no-interaction --no-scripts phpunit/php-token-stream:^3.1.3 --with-dependencies
543-
elif [[ $PHP_VERSION == "7.3" || $PHP_VERSION == "7.4" || $PHP_VERSION == "8.0" ]]; then
544-
echo "Installing PHPUnit 9.3"
545-
composer update --ignore-platform-reqs --no-interaction --no-scripts yoast/phpunit-polyfills --with-dependencies
546-
composer require --dev --ignore-platform-reqs phpunit/phpunit:"9.3.*" --with-dependencies
547-
elif [[ $WP_VERSION == "latest" || $WP_VERSION == "trunk" || $PHP_VERSION == "8.1" || $PHP_VERSION == "8.2" ]]; then
548-
echo "Installing latest version of PHPUnit"
549-
composer update --ignore-platform-reqs --no-interaction --no-scripts yoast/phpunit-polyfills --with-dependencies
550-
fi
551-
env:
552-
WP_VERSION: ${{ matrix.wp }}
553-
PHP_VERSION: ${{ matrix.php }}
518+
rm -rf vendor/phpunit
519+
composer dump-autoload -o
554520
555521
- name: Install Node dependencies
556522
if: needs.pre-run.outputs.changed-php-count > 0
557523
run: npm ci
558-
env:
559-
CI: true
560524

561525
- name: Build plugin
562526
if: needs.pre-run.outputs.changed-php-count > 0
@@ -586,29 +550,37 @@ jobs:
586550
587551
- name: Run tests
588552
if: ${{ matrix.coverage == false && needs.pre-run.outputs.changed-php-count > 0 }}
589-
run: vendor/bin/phpunit --verbose
553+
run: |
554+
phpunit --version
555+
phpunit --verbose
590556
working-directory: ${{ env.WP_CORE_DIR }}/src/wp-content/plugins/amp
591557
env:
592558
WP_TESTS_DIR: /tmp/wordpress-tests-lib
593559

594560
- name: Run multisite tests
595561
if: ${{ matrix.multisite == true && needs.pre-run.outputs.changed-php-count > 0 }}
596-
run: vendor/bin/phpunit --verbose
562+
run: |
563+
phpunit --version
564+
phpunit --verbose
597565
working-directory: ${{ env.WP_CORE_DIR }}/src/wp-content/plugins/amp
598566
env:
599567
WP_TESTS_DIR: /tmp/wordpress-tests-lib
600568
WP_MULTISITE: 1
601569

602570
- name: Run tests with coverage
603571
if: ${{ matrix.coverage == true && needs.pre-run.outputs.changed-php-count > 0 }}
604-
run: vendor/bin/phpunit --verbose --coverage-clover ${{ env.WP_CORE_DIR }}/src/wp-content/plugins/amp/build/logs/clover.xml
572+
run: |
573+
phpunit --version
574+
phpunit --verbose --coverage-clover ${{ env.WP_CORE_DIR }}/src/wp-content/plugins/amp/build/logs/clover.xml
605575
working-directory: ${{ env.WP_CORE_DIR }}/src/wp-content/plugins/amp
606576
env:
607577
WP_TESTS_DIR: /tmp/wordpress-tests-lib
608578

609579
- name: Run external HTTP tests
610580
if: ${{ matrix.external-http == true && needs.pre-run.outputs.changed-php-count > 0 }}
611-
run: vendor/bin/phpunit --testsuite external-http
581+
run: |
582+
phpunit --version
583+
phpunit --testsuite external-http --verbose
612584
working-directory: ${{ env.WP_CORE_DIR }}/src/wp-content/plugins/amp
613585
env:
614586
WP_TESTS_DIR: /tmp/wordpress-tests-lib
@@ -645,27 +617,27 @@ jobs:
645617
strategy:
646618
fail-fast: false
647619
matrix:
620+
# @TODO: Revisit this if we want to enable code coverage for feature tests.
648621
coverage: [false]
649-
php: ['7.4', '7.3', '7.2', '7.1']
622+
php: ['7.4']
650623
wp: ['latest']
651624
include:
652-
- php: '8.1'
625+
- php: '8.3'
653626
wp: 'trunk'
654627
experimental: true
655-
coverage: false
628+
629+
- php: '8.2'
630+
wp: 'trunk'
631+
experimental: true
632+
633+
- php: '8.1'
634+
wp: 'trunk'
656635

657636
- php: '8.0'
658637
wp: 'latest'
659-
coverage: false
660638

661-
# TODO: Enable this once codecov upload merging works as expected.
662-
# - php: '7.4'
663-
# wp: 'latest'
664-
# coverage: true
665-
666-
- php: '7.0'
667-
wp: '5.1'
668-
coverage: false
639+
- php: '7.4'
640+
wp: '5.3'
669641

670642
steps:
671643
- name: Checkout
@@ -711,21 +683,20 @@ jobs:
711683

712684
- name: Install Node dependencies
713685
run: npm ci
714-
env:
715-
CI: true
716686

717687
- name: Build plugin
718688
run: npm run build:js
719689

720-
- name: Update PHPUnit to get latest php-code-coverage library
721-
if: ${{ matrix.coverage == true }}
722-
# phpdocumentor/reflection has to be removed as it makes use of an outdated dependency.
723-
# phpunit/phpunit has to be updated as the one in use provides an older version of phpunit/php-code-coverage,
724-
# but we need the v9.x branch.
725-
# It cannot be removed, as it is a requirement of wp-cli/wp-cli-tests as well.
726-
run: |
727-
composer remove --dev phpdocumentor/reflection
728-
composer require --dev --ignore-platform-reqs --update-with-all-dependencies phpunit/phpunit
690+
# @TODO: Revisit this if we want to enable code coverage for feature tests.
691+
# - name: Update PHPUnit to get latest php-code-coverage library
692+
# if: ${{ matrix.coverage == true }}
693+
# # phpdocumentor/reflection has to be removed as it makes use of an outdated dependency.
694+
# # phpunit/phpunit has to be updated as the one in use provides an older version of phpunit/php-code-coverage,
695+
# # but we need the v9.x branch.
696+
# # It cannot be removed, as it is a requirement of wp-cli/wp-cli-tests as well.
697+
# run: |
698+
# composer remove --dev phpdocumentor/reflection
699+
# composer require --dev --ignore-platform-reqs --update-with-all-dependencies phpunit/phpunit
729700

730701
- name: Configure DB environment
731702
run: |
@@ -786,7 +757,7 @@ jobs:
786757
- name: Setup PHP
787758
uses: shivammathur/setup-php@v2
788759
with:
789-
php-version: '7.0'
760+
php-version: '7.4'
790761

791762
- name: Setup Node
792763
uses: actions/[email protected]
@@ -813,8 +784,6 @@ jobs:
813784

814785
- name: Install Node dependencies
815786
run: npm ci
816-
env:
817-
CI: true
818787

819788
- name: Create destination directories
820789
run: mkdir -p builds/${{ matrix.build }}

0 commit comments

Comments
 (0)