Build/Test Tools: Various minor GitHub Action improvements.

This applies several types of improvements to GitHub Action workflows:
- Updates to inline documentation to ensure accuracy.
- Removal of repetitive or unnecessary debug logging.
- Reorganization of some steps to have configuration steps towards the beginning of jobs.
- Step name updates for consistency across workflows.

Props desrosj, jrf.
See #56793.

git-svn-id: https://develop.svn.wordpress.org/trunk@54851 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Jonathan Desrosiers 2022-11-16 19:32:57 +00:00
parent 66706c996c
commit 7fbcfef25c
8 changed files with 76 additions and 123 deletions

View File

@ -48,14 +48,15 @@ jobs:
# Performs the following steps:
# - Checks out the repository.
# - Sets up PHP.
# - Logs debug information.
# - Configures caching for PHPCS scans.
# - Installs Composer dependencies (use cache if possible).
# - Installs Composer dependencies.
# - Make Composer packages available globally.
# - Logs PHP_CodeSniffer debug information.
# - Runs PHPCS on the full codebase with warnings suppressed.
# - Generate a report for displaying issues as pull request annotations.
# - Runs PHPCS on the `tests` directory without warnings suppressed.
# - Generate a report for displaying `test` directory issues as pull request annotations.
# - Ensures version-controlled files are not modified or deleted.
phpcs:
name: PHP coding standards
runs-on: ubuntu-latest
@ -73,11 +74,6 @@ jobs:
coverage: none
tools: composer, cs2pr
- name: Log debug information
run: |
php --version
composer --version
# This date is used to ensure that the PHPCS cache is cleared at least once every week.
# http://man7.org/linux/man-pages/man1/date.1.html
- name: "Get last Monday's date"
@ -98,9 +94,6 @@ jobs:
- name: Make Composer packages available globally
run: echo "${PWD}/vendor/bin" >> $GITHUB_PATH
- name: Log PHPCS debug information
run: phpcs -i
- name: Run PHPCS on all Core files
id: phpcs-core
run: phpcs -n --report-full --report-checkstyle=./.cache/phpcs-report.xml
@ -126,10 +119,9 @@ jobs:
#
# Performs the following steps:
# - Checks out the repository.
# - Sets up Node.js.
# - Logs debug information about the GitHub Action runner.
# - Installs Node.js.
# - Logs updated debug information.
# _ Installs npm dependencies.
# - Installs npm dependencies.
# - Run the WordPress JSHint checks.
# - Ensures version-controlled files are not modified or deleted.
jshint:
@ -144,14 +136,7 @@ jobs:
- name: Checkout repository
uses: actions/checkout@93ea575cb5d8a053eaa0ac8fa3b40d7e05a33cc8 # v3.1.0
- name: Log debug information
run: |
npm --version
node --version
git --version
svn --version
- name: Install Node.js
- name: Set up Node.js
uses: actions/setup-node@8c91899e586c5b171469028077307d293428b516 # v3.5.1
with:
node-version-file: '.nvmrc'
@ -161,8 +146,10 @@ jobs:
run: |
npm --version
node --version
git --version
svn --version
- name: Install Dependencies
- name: Install npm Dependencies
run: npm ci
- name: Run JSHint

View File

@ -35,12 +35,11 @@ jobs:
# Performs the following steps:
# - Sets environment variables.
# - Checks out the repository.
# - Sets up Node.js.
# - Logs debug information about the GitHub Action runner.
# - Installs Node.js.
# _ Installs npm dependencies.
# - Installs npm dependencies.
# - Builds WordPress to run from the `build` directory.
# - Starts the WordPress Docker container.
# - Logs general debug information.
# - Logs the running Docker containers.
# - Logs Docker debug information (about both the Docker installation within the runner and the WordPress container).
# - Install WordPress within the Docker container.
@ -61,6 +60,12 @@ jobs:
- name: Checkout repository
uses: actions/checkout@93ea575cb5d8a053eaa0ac8fa3b40d7e05a33cc8 # v3.1.0
- name: Set up Node.js
uses: actions/setup-node@8c91899e586c5b171469028077307d293428b516 # v3.5.1
with:
node-version-file: '.nvmrc'
cache: npm
- name: Log debug information
run: |
npm --version
@ -68,17 +73,9 @@ jobs:
curl --version
git --version
svn --version
php --version
php -i
locale -a
- name: Install Node.js
uses: actions/setup-node@8c91899e586c5b171469028077307d293428b516 # v3.5.1
with:
node-version-file: '.nvmrc'
cache: npm
- name: Install Dependencies
- name: Install npm Dependencies
run: npm ci
- name: Build WordPress
@ -88,14 +85,6 @@ jobs:
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

View File

@ -43,10 +43,9 @@ jobs:
#
# Performs the following steps:
# - Checks out the repository.
# - Sets up Node.js.
# - Logs debug information about the GitHub Action runner.
# - Installs Node.js.
# - Logs updated debug information.
# _ Installs npm dependencies.
# - Installs npm dependencies.
# - Run the WordPress QUnit tests.
# - Ensures version-controlled files are not modified or deleted.
test-js:
@ -59,14 +58,7 @@ jobs:
- name: Checkout repository
uses: actions/checkout@93ea575cb5d8a053eaa0ac8fa3b40d7e05a33cc8 # v3.1.0
- name: Log debug information
run: |
npm --version
node --version
git --version
svn --version
- name: Install Node.js
- name: Set up Node.js
uses: actions/setup-node@8c91899e586c5b171469028077307d293428b516 # v3.5.1
with:
node-version-file: '.nvmrc'
@ -76,8 +68,10 @@ jobs:
run: |
npm --version
node --version
git --version
svn --version
- name: Install Dependencies
- name: Install npm Dependencies
run: npm ci
- name: Run QUnit tests

View File

@ -46,10 +46,10 @@ jobs:
# - Sets up PHP.
# - Logs debug information.
# - Configures caching for PHP compatibility scans.
# - Installs Composer dependencies (use cache if possible).
# - Installs Composer dependencies.
# - Make Composer packages available globally.
# - Logs PHP_CodeSniffer debug information.
# - Runs the PHP compatibility tests.
# - Generate a report for displaying issues as pull request annotations.
# - Ensures version-controlled files are not modified or deleted.
php-compatibility:
name: Check PHP compatibility
@ -70,7 +70,6 @@ jobs:
- name: Log debug information
run: |
php --version
composer --version
# This date is used to ensure that the PHP compatibility cache is cleared at least once every week.
@ -93,9 +92,6 @@ jobs:
- name: Make Composer packages available globally
run: echo "${PWD}/vendor/bin" >> $GITHUB_PATH
- name: Log PHPCS debug information
run: phpcs -i
- name: Run PHP compatibility tests
id: phpcs
run: phpcs --standard=phpcompat.xml.dist --report-full --report-checkstyle=./.cache/phpcs-compat-report.xml

View File

@ -36,22 +36,20 @@ jobs:
#
# Performs the following steps:
# - Sets environment variables.
# - Sets up the environment variables needed for testing with memcached (if desired).
# - Installs Node.js.
# - Checks out the repository.
# - Sets up Node.js.
# - Logs general debug information about the runner.
# - Installs npm dependencies
# - Configures caching for Composer.
# - Installs Composer dependencies.
# - Logs Docker debug information (about the Docker installation within the runner).
# - Starts the WordPress Docker container.
# - Logs general debug information about the runner.
# - Logs the running Docker containers.
# - Logs debug information from inside the WordPress Docker container.
# - Logs debug information about what's installed within the WordPress Docker containers.
# - Install WordPress within the Docker container.
# - Run the PHPUnit tests.
# - Ensures version-controlled files are not modified or deleted.
# - Checks out the WordPress Test reporter repository.
# - Reconnect the directory to the Git repository.
# - Submit the test results to the WordPress.org host test results.
test-php:
name: ${{ matrix.php }}${{ matrix.multisite && ' multisite' || '' }}${{ matrix.split_slow && ' slow tests' || '' }}${{ matrix.memcached && ' with memcached' || '' }} on ${{ matrix.os }}
@ -108,13 +106,21 @@ jobs:
- name: Checkout repository
uses: actions/checkout@93ea575cb5d8a053eaa0ac8fa3b40d7e05a33cc8 # v3.1.0
- name: Install Node.js
- name: Set up Node.js
uses: actions/setup-node@8c91899e586c5b171469028077307d293428b516 # v3.5.1
with:
node-version-file: '.nvmrc'
cache: npm
- name: Install Dependencies
- name: General debug information
run: |
npm --version
node --version
curl --version
git --version
svn --version
- name: Install npm dependencies
run: npm ci
# This date is used to ensure that the Composer cache is refreshed at least once every week.
@ -155,14 +161,6 @@ jobs:
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

View File

@ -49,9 +49,9 @@ jobs:
#
# Performs the following steps:
# - Checks out the repository.
# - Installs Node.js (only when theme has a build process)
# - Installs npm dependencies (only when theme has a build process)
# - Runs the theme build script (only when theme has a build process)
# - Sets up Node.js.
# - Installs npm dependencies.
# - Runs the theme build script.
# - Ensures version-controlled files are not modified or deleted.
test-build-scripts:
name: Test ${{ matrix.theme }} build script
@ -77,7 +77,7 @@ jobs:
with:
ref: ${{ github.event_name == 'workflow_dispatch' && inputs.branch || github.ref }}
- name: Install Node.js
- name: Set up Node.js
uses: actions/setup-node@8c91899e586c5b171469028077307d293428b516 # v3.5.1
with:
node-version-file: '.nvmrc'

View File

@ -32,26 +32,25 @@ env:
LOCAL_PHP_MEMCACHED: ${{ false }}
jobs:
# Sets up WordPress for testing or development use.
# Runs the PHPUnit tests for WordPress.
#
# Performs the following steps:
# - Sets environment variables.
# - Checks out the repository.
# - Checks out the WordPress Importer plugin (needed for the Core PHPUnit tests).
# - Logs debug information about the GitHub Action runner.
# - Installs Node.js.
# _ Installs npm dependencies.
# - Sets up Node.js.
# - Logs general debug information about the runner.
# - Installs npm dependencies
# - Configures caching for Composer.
# - Installs Composer dependencies.
# - 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.
# - Ensures version-controlled files are not modified or deleted.
# - Upload the single site code coverage report to Codecov.io.
# - Run the PHPUnit tests as a multisite.
# - Run the PHPUnit tests as a multisite installation.
# - Ensures version-controlled files are not modified or deleted.
# - Upload the multisite code coverage report to Codecov.io.
test-coverage-report:
@ -73,6 +72,12 @@ jobs:
- name: Checkout repository
uses: actions/checkout@93ea575cb5d8a053eaa0ac8fa3b40d7e05a33cc8 # v3.1.0
- name: Set up Node.js
uses: actions/setup-node@8c91899e586c5b171469028077307d293428b516 # v3.5.1
with:
node-version-file: '.nvmrc'
cache: npm
- name: Log debug information
run: |
echo "$GITHUB_REF"
@ -82,17 +87,9 @@ jobs:
curl --version
git --version
svn --version
php --version
php -i
locale -a
- name: Install Node.js
uses: actions/setup-node@8c91899e586c5b171469028077307d293428b516 # v3.5.1
with:
node-version-file: '.nvmrc'
cache: npm
- name: Install Dependencies
- name: Install npm Dependencies
run: npm ci
# This date is used to ensure that the Composer cache is refreshed at least once every week.
@ -129,14 +126,6 @@ jobs:
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

View File

@ -41,9 +41,9 @@ jobs:
#
# Performs the following steps:
# - Checks out the repository.
# - Sets up Node.js.
# - Logs debug information about the GitHub Action runner.
# - Installs Node.js.
# _ Installs npm dependencies.
# - Installs npm dependencies.
# - Builds WordPress to run from the `build` directory.
# - Cleans up after building WordPress to the `build` directory.
# - Ensures version-controlled files are not modified or deleted.
@ -64,6 +64,12 @@ jobs:
- name: Checkout repository
uses: actions/checkout@93ea575cb5d8a053eaa0ac8fa3b40d7e05a33cc8 # v3.1.0
- name: Set up Node.js
uses: actions/setup-node@8c91899e586c5b171469028077307d293428b516 # v3.5.1
with:
node-version-file: '.nvmrc'
cache: npm
- name: Log debug information
run: |
npm --version
@ -72,13 +78,7 @@ jobs:
git --version
svn --version
- name: Install Node.js
uses: actions/setup-node@8c91899e586c5b171469028077307d293428b516 # v3.5.1
with:
node-version-file: '.nvmrc'
cache: npm
- name: Install Dependencies
- name: Install npm Dependencies
run: npm ci
- name: Build WordPress in /src
@ -106,9 +106,9 @@ jobs:
#
# Performs the following steps:
# - Checks out the repository.
# - Sets up Node.js.
# - Logs debug information about the GitHub Action runner.
# - Installs Node.js.
# _ Installs npm dependencies.
# - Installs npm dependencies.
# - Builds WordPress to run from the `build` directory.
# - Cleans up after building WordPress to the `build` directory.
# - Ensures version-controlled files are not modified or deleted.
@ -124,6 +124,12 @@ jobs:
- name: Checkout repository
uses: actions/checkout@93ea575cb5d8a053eaa0ac8fa3b40d7e05a33cc8 # v3.1.0
- name: Set up Node.js
uses: actions/setup-node@8c91899e586c5b171469028077307d293428b516 # v3.5.1
with:
node-version-file: '.nvmrc'
cache: npm
- name: Log debug information
run: |
npm --version
@ -132,13 +138,7 @@ jobs:
git --version
svn --version
- name: Install Node.js
uses: actions/setup-node@8c91899e586c5b171469028077307d293428b516 # v3.5.1
with:
node-version-file: '.nvmrc'
cache: npm
- name: Install Dependencies
- name: Install npm Dependencies
run: npm ci
- name: Build WordPress in /src