mirror of
https://github.com/gosticks/wordpress-develop.git
synced 2025-10-16 12:05:38 +00:00
Before the coverage reports were submitted to Codecov.io, HTML coverage reports were compressed into ZIP files and uploaded to the workflow run as an artifact. A weekly schedule was chosen to run this workflow because generating a coverage report is more time consuming, and the resulting reports are quite large (~150-200MB each). This changes the schedule for the code coverage workflow from weekly to daily and eliminates the ZIP artifacts that were previously generated. This will ensure the code coverage data found at https://codecov.io/gh/WordPress/wordpress-develop is relatively accurate on any given day of the week without needlessly consuming artifact storage. Props jorbin. See #50401, #52141. git-svn-id: https://develop.svn.wordpress.org/trunk@49931 602fd350-edb4-49c9-b593-d223f7449a82
141 lines
4.6 KiB
YAML
141 lines
4.6 KiB
YAML
name: Code Coverage Report
|
|
|
|
on:
|
|
# Once daily at 00:00 UTC.
|
|
schedule:
|
|
- cron: '0 0 * * *'
|
|
|
|
env:
|
|
LOCAL_DIR: build
|
|
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.
|
|
# - Builds WordPress to run from the `build` directory.
|
|
# - 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: Generate a code coverage report
|
|
runs-on: ubuntu-latest
|
|
if: ${{ github.repository == 'WordPress/wordpress-develop' }}
|
|
|
|
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@v2
|
|
|
|
- name: Checkout the WordPress Importer plugin
|
|
run: svn checkout -r 2387243 https://plugins.svn.wordpress.org/wordpress-importer/trunk/ tests/phpunit/data/plugins/wordpress-importer
|
|
|
|
- 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@v1
|
|
with:
|
|
node-version: 14
|
|
|
|
- name: Cache NodeJS modules
|
|
uses: actions/cache@v2
|
|
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') }}
|
|
restore-keys: |
|
|
${{ runner.os }}-npm-
|
|
|
|
- name: Install Dependencies
|
|
run: npx install-changed --install-command="npm ci"
|
|
|
|
- name: Build WordPress
|
|
run: npm run build
|
|
|
|
- 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
|
|
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
|
|
uses: codecov/codecov-action@v1
|
|
with:
|
|
file: wp-code-coverage-single-clover-${{ github.sha }}.xml
|
|
flags: single,php
|
|
|
|
- name: Run tests as a multisite install
|
|
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
|
|
uses: codecov/codecov-action@v1
|
|
with:
|
|
file: wp-code-coverage-multisite-clover-${{ github.sha }}.xml
|
|
flags: multisite,php
|