mirror of
git://develop.git.wordpress.org/
synced 2025-01-18 05:18:42 +01:00
5e85c8fb69
When the workflow file is updated, it should always be run to verify changes. Follow up to [50592]. See #52786. git-svn-id: https://develop.svn.wordpress.org/trunk@50595 602fd350-edb4-49c9-b593-d223f7449a82
150 lines
4.9 KiB
YAML
150 lines
4.9 KiB
YAML
name: Code Coverage Report
|
|
|
|
on:
|
|
# Verify
|
|
push:
|
|
branches:
|
|
- master
|
|
- trunk
|
|
paths:
|
|
- '.github/workflows/test-coverage.yml'
|
|
- 'phpunit.xml.dist'
|
|
- 'tests/phpunit/multisite.xml'
|
|
# Once daily at 00:00 UTC.
|
|
schedule:
|
|
- cron: '0 0 * * *'
|
|
# Allow manually triggering the workflow.
|
|
workflow_dispatch:
|
|
|
|
env:
|
|
PUPPETEER_SKIP_CHROMIUM_DOWNLOAD: ${{ true }}
|
|
COMPOSER_INSTALL: ${{ false }}
|
|
# Controls which NPM script to use for running PHPUnit tests. Options ar `php` and `php-composer`.
|
|
PHPUNIT_SCRIPT: php
|
|
LOCAL_PHP: '7.4-fpm'
|
|
LOCAL_PHP_XDEBUG: true
|
|
LOCAL_PHP_MEMCACHED: ${{ false }}
|
|
|
|
jobs:
|
|
# Sets up WordPress for testing or development use.
|
|
#
|
|
# Performs the following steps:
|
|
# - Set environment variables.
|
|
# - Checks out the repository.
|
|
# - Checks out the WordPress Importer plugin (needed for the Core PHPUnit tests).
|
|
# - Logs debug information about the runner container.
|
|
# - Installs NodeJS 14.
|
|
# - Sets up caching for NPM.
|
|
# _ Installs NPM dependencies using install-changed to hash the `package.json` file.
|
|
# - Logs Docker debug information (about the Docker installation within the runner).
|
|
# - Starts the WordPress Docker container.
|
|
# - Logs debug general information.
|
|
# - Logs the running Docker containers.
|
|
# - Logs WordPress Docker container debug information.
|
|
# - Logs debug information about what's installed within the WordPress Docker containers.
|
|
# - Install WordPress within the Docker container.
|
|
# - Run the PHPUnit tests as a single site.
|
|
# - Upload the single site code coverage report to Codecov.io.
|
|
# - Run the PHPUnit tests as a multisite.
|
|
# - Upload the multisite code coverage report to Codecov.io.
|
|
test-coverage-report:
|
|
name: ${{ matrix.multisite && 'Multisite' || 'Single site' }} report
|
|
runs-on: ubuntu-latest
|
|
if: ${{ github.repository == 'WordPress/wordpress-develop' }}
|
|
strategy:
|
|
fail-fast: false
|
|
matrix:
|
|
multisite: [ false, true ]
|
|
|
|
steps:
|
|
- name: Configure environment variables
|
|
run: |
|
|
echo "PHP_FPM_UID=$(id -u)" >> $GITHUB_ENV
|
|
echo "PHP_FPM_GID=$(id -g)" >> $GITHUB_ENV
|
|
|
|
- name: Checkout repository
|
|
uses: actions/checkout@5a4ac9002d0be2fb38bd78e4b4dbde5606d7042f # v2.3.4
|
|
|
|
- name: Log debug information
|
|
run: |
|
|
echo "$GITHUB_REF"
|
|
echo "$GITHUB_EVENT_NAME"
|
|
npm --version
|
|
node --version
|
|
curl --version
|
|
git --version
|
|
svn --version
|
|
php --version
|
|
php -i
|
|
locale -a
|
|
|
|
- name: Install NodeJS
|
|
uses: actions/setup-node@46071b5c7a2e0c34e49c3cb8a0e792e86e18d5ea # v2.1.5
|
|
with:
|
|
node-version: 14
|
|
|
|
- name: Cache NodeJS modules
|
|
uses: actions/cache@26968a09c0ea4f3e233fdddbafd1166051a095f6 # v2.1.4
|
|
env:
|
|
cache-name: cache-node-modules
|
|
with:
|
|
# npm cache files are stored in `~/.npm` on Linux/macOS
|
|
path: ~/.npm
|
|
key: ${{ runner.os }}-npm-${{ hashFiles('**/package-lock.json') }}
|
|
|
|
- name: Install Dependencies
|
|
run: npm ci
|
|
|
|
- name: Docker debug information
|
|
run: |
|
|
docker -v
|
|
docker-compose -v
|
|
|
|
- name: Start Docker environment
|
|
run: |
|
|
npm run env:start
|
|
|
|
- name: General debug information
|
|
run: |
|
|
npm --version
|
|
node --version
|
|
curl --version
|
|
git --version
|
|
svn --version
|
|
|
|
- name: Log running Docker containers
|
|
run: docker ps -a
|
|
|
|
- name: WordPress Docker container debug information
|
|
run: |
|
|
docker-compose run --rm mysql mysql --version
|
|
docker-compose run --rm php php --version
|
|
docker-compose run --rm php php -m
|
|
docker-compose run --rm php php -i
|
|
docker-compose run --rm php locale -a
|
|
|
|
- name: Install WordPress
|
|
run: npm run env:install
|
|
|
|
- name: Run tests as a single site
|
|
if: ${{ ! matrix.multisite }}
|
|
run: npm run test:${{ env.PHPUNIT_SCRIPT }} -- --verbose -c phpunit.xml.dist --coverage-clover wp-code-coverage-single-clover-${{ github.sha }}.xml
|
|
|
|
- name: Upload single site report to Codecov
|
|
if: ${{ ! matrix.multisite }}
|
|
uses: codecov/codecov-action@e156083f13aff6830c92fc5faa23505779fbf649 # v1.2.1
|
|
with:
|
|
file: wp-code-coverage-single-clover-${{ github.sha }}.xml
|
|
flags: single,php
|
|
|
|
- name: Run tests as a multisite install
|
|
if: ${{ matrix.multisite }}
|
|
run: npm run test:${{ env.PHPUNIT_SCRIPT }} -- --verbose -c tests/phpunit/multisite.xml --coverage-clover wp-code-coverage-multisite-clover-${{ github.sha }}.xml
|
|
|
|
- name: Upload multisite report to Codecov
|
|
if: ${{ matrix.multisite }}
|
|
uses: codecov/codecov-action@e156083f13aff6830c92fc5faa23505779fbf649 # v1.2.1
|
|
with:
|
|
file: wp-code-coverage-multisite-clover-${{ github.sha }}.xml
|
|
flags: multisite,php
|