Skip to content

Bump ergebnis/composer-normalize from 2.44.0 to 2.45.0 #5835

Bump ergebnis/composer-normalize from 2.44.0 to 2.45.0

Bump ergebnis/composer-normalize from 2.44.0 to 2.45.0 #5835

Workflow file for this run

name: PHP Unit Tests
on:
push:
# Only run if PHP-related files changed.
paths:
- '**.php'
- 'phpunit.xml.dist'
- 'phpunit-multisite.xml.dist'
- 'composer.json'
- 'composer.lock'
- 'tests/phpunit/**'
- 'includes/data/**'
- '.github/workflows/tests-unit-php.yml'
branches:
- main
- release/*
pull_request:
# Only run if PHP-related files changed.
paths:
- '**.php'
- 'phpunit.xml.dist'
- 'phpunit-multisite.xml.dist'
- 'composer.json'
- 'composer.lock'
- 'tests/phpunit/**'
- 'includes/data/**'
- '.github/workflows/tests-unit-php.yml'
permissions:
contents: read
# Cancels all previous workflow runs for pull requests that have not completed.
concurrency:
# The concurrency group contains the workflow name and the (target) branch name.
group: ${{ github.workflow }}-${{ github.head_ref || github.ref }}
cancel-in-progress: true
jobs:
unit-php:
name: PHP ${{ matrix.php }} - WP ${{ matrix.wp }}${{ matrix.experimental && ' (experimental)' || '' }}${{ matrix.coverage && ' (with coverage)' || '' }}${{ matrix.random && ' (in random order)' || '' }}
runs-on: ubuntu-latest
timeout-minutes: 20
services:
mysql:
image: mariadb:lts
env:
MARIADB_ALLOW_EMPTY_ROOT_PASSWORD: true
MARIADB_DATABASE: wordpress_test
MARIADB_MYSQL_LOCALHOST_USER: 1
MARIADB_MYSQL_LOCALHOST_GRANTS: USAGE
ports:
- 3306
options: --health-cmd="healthcheck.sh --su-mysql --connect --innodb_initialized" --health-interval=10s --health-timeout=5s --health-retries=3
continue-on-error: ${{ matrix.experimental }}
strategy:
matrix:
php: ['8.3', '8.2', '8.1', '8.0']
wp: ['latest']
coverage: [false]
experimental: [false]
include:
- php: '8.4'
wp: 'latest'
coverage: true
experimental: false
- php: '8.4'
wp: 'latest'
random: true
experimental: true
- php: '7.4'
wp: '6.5'
experimental: false
- php: '8.4'
wp: 'trunk'
experimental: true
steps:
- name: Harden Runner
uses: step-security/harden-runner@0080882f6c36860b6ba35c610c98ce87d4e2f26f
with:
disable-file-monitoring: true
egress-policy: audit
allowed-endpoints: >
api.github.com:443
api.wordpress.org:80
cdn.ampproject.org:443
develop.svn.wordpress.org:443
example.com:443
github.com:443
objects.githubusercontent.com:443
packagist.org:443
raw.github.com:443
repo.packagist.org:443
wordpress.org:443
getcomposer.org:443
dl.cloudsmith.io:443
- name: Checkout
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683
# PHP-Scoper only works on PHP 7.4+ and we need to prefix our dependencies to accurately test them.
# So we temporarily switch PHP versions, do a full install and then remove the package.
# Then switch back to the PHP version we want to test and delete the vendor directory.
- name: Setup PHP 8.0
uses: shivammathur/setup-php@e6f75134d35752277f093989e72e140eaa222f35
with:
php-version: '8.0'
tools: composer
- name: Install PHP dependencies
uses: ramsey/composer-install@57532f8be5bda426838819c5ee9afb8af389d51a
with:
composer-options: '--prefer-dist --no-progress --no-interaction'
- name: Remove prefixed dependencies
run: rm -rf vendor/*
- name: Setup PHP
uses: shivammathur/setup-php@e6f75134d35752277f093989e72e140eaa222f35
with:
php-version: ${{ matrix.php }}
extensions: mysql
coverage: ${{ matrix.coverage && 'xdebug' || 'none' }}
tools: composer, cs2pr
- name: Install PHP dependencies
uses: ramsey/composer-install@57532f8be5bda426838819c5ee9afb8af389d51a
with:
composer-options: '--prefer-dist --no-progress --no-interaction --no-scripts'
- name: Update PHPUnit
run: |
echo "Installing latest version of PHPUnit"
composer update --ignore-platform-reqs --no-interaction --no-scripts yoast/phpunit-polyfills --with-dependencies
- name: Composer dump autoload
run: composer dump-autoload --no-interaction
- name: Shutdown default MySQL service
run: sudo service mysql stop
- name: Verify MariaDB connection
run: |
while ! mysqladmin ping -h"127.0.0.1" -P"${{ job.services.mysql.ports[3306] }}" --silent; do
sleep 1
done
- name: Install svn
run: |
sudo apt-get update
sudo apt-get install -y subversion
- name: Set up tests
run: bash bin/install-wp-tests.sh wordpress_test root '' 127.0.0.1:${{ job.services.mysql.ports['3306'] }} ${{ matrix.wp }} true
- name: Set up problem matchers for PHPUnit
run: echo "::add-matcher::${{ runner.tool_cache }}/phpunit.json"
- name: Run tests
run: |
npm run test:php:unit
npm run test:php:integration:single
npm run test:php:integration:multisite
if: ${{ ! matrix.coverage && ! matrix.random }}
- name: Run tests with coverage
run: |
npm run test:php:unit -- --coverage-clover build/logs/php-coverage.xml
npm run test:php:integration:single -- --coverage-clover build/logs/php-coverage-integration.xml
npm run test:php:integration:multisite -- --coverage-clover build/logs/php-coverage-multisite.xml
if: ${{ matrix.coverage && ! matrix.random }}
- name: Run tests in random order
run: |
npm run test:php:unit -- --order-by random
npm run test:php:integration:single -- --order-by random
npm run test:php:integration:multisite -- --order-by random
if: ${{ matrix.random }}
- name: Upload code coverage report
uses: codecov/codecov-action@015f24e6818733317a2da2edd6290ab26238649a
with:
file: build/logs/*.xml
token: ${{ secrets.CODECOV_TOKEN }}
if: ${{ matrix.coverage }}