mirror of
git://develop.git.wordpress.org/
synced 2025-01-29 10:38:22 +01:00
Build/Test Tools: Use the Slack notifications workflow as a reusable one.
This backports several changesets that are required to remove the reliance on the `workflow_run` event for posting Slack notifications. The Slack notification workflow will now be called as a reusable one, which has several benefits (see [53591]). Several other minor GitHub Actions related updates are also being backported in this commit to maintain tooling consistency across branches that still receive security updates as a courtesy when necessary. Workflows that are not relevant to this branch that were mistakenly backported are also being deleted. Merges [50473], [50704], [50796], [50930], [51341], [51355], [51498], [51511], [51535], [51924], [51925], [51937], [52002], [52130], [52183], [52233], [53112], [53581], [53582], [53592] to the 5.3 branch. See #56095. git-svn-id: https://develop.svn.wordpress.org/branches/5.3@53602 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
parent
e0ad050acd
commit
f019ba5911
55
.github/workflows/coding-standards.yml
vendored
55
.github/workflows/coding-standards.yml
vendored
@ -5,7 +5,6 @@ on:
|
||||
# PHPCS checking was introduced in WordPress 5.1.
|
||||
push:
|
||||
branches:
|
||||
- master
|
||||
- trunk
|
||||
- '3.[89]'
|
||||
- '[4-9].[0-9]'
|
||||
@ -14,7 +13,6 @@ on:
|
||||
- '[4-9].[0-9]*'
|
||||
pull_request:
|
||||
branches:
|
||||
- master
|
||||
- trunk
|
||||
- '3.[89]'
|
||||
- '[4-9].[0-9]'
|
||||
@ -34,6 +32,13 @@ on:
|
||||
- '.github/workflows/*.yml'
|
||||
workflow_dispatch:
|
||||
|
||||
# Cancels all previous workflow runs for pull requests that have not completed.
|
||||
concurrency:
|
||||
# The concurrency group contains the workflow name and the branch name for pull requests
|
||||
# or the commit hash for any other events.
|
||||
group: ${{ github.workflow }}-${{ github.event_name == 'pull_request' && github.head_ref || github.sha }}
|
||||
cancel-in-progress: true
|
||||
|
||||
jobs:
|
||||
# Runs PHP coding standards checks.
|
||||
#
|
||||
@ -48,18 +53,18 @@ jobs:
|
||||
# - Logs PHP_CodeSniffer debug information.
|
||||
# - Runs PHPCS on the full codebase with warnings suppressed.
|
||||
# - Runs PHPCS on the `tests` directory without warnings suppressed.
|
||||
# - todo: Configure Slack notifications for failing scans.
|
||||
phpcs:
|
||||
name: PHP coding standards
|
||||
runs-on: ubuntu-latest
|
||||
timeout-minutes: 20
|
||||
if: ${{ github.repository == 'WordPress/wordpress-develop' || github.event_name == 'pull_request' }}
|
||||
|
||||
steps:
|
||||
- name: Checkout repository
|
||||
uses: actions/checkout@5a4ac9002d0be2fb38bd78e4b4dbde5606d7042f # v2.3.4
|
||||
uses: actions/checkout@2541b1294d2704b0964813337f33b291d3f8596b # v3.0.2
|
||||
|
||||
- name: Set up PHP
|
||||
uses: shivammathur/setup-php@afefcaf556d98dc7896cca380e181decb609ca44 # v2.10.0
|
||||
uses: shivammathur/setup-php@3eda58347216592f618bb1dff277810b6698e4ca # v2.19.1
|
||||
with:
|
||||
php-version: '7.3'
|
||||
coverage: none
|
||||
@ -71,7 +76,7 @@ jobs:
|
||||
composer --version
|
||||
|
||||
- name: Install Composer dependencies
|
||||
uses: ramsey/composer-install@92a7904348d4ad30236f3611e33b7f0c6f9edd70 # v1.1.0
|
||||
uses: ramsey/composer-install@f680dac46551dffb2234a240d65ae806c2999dd6 # v2.1.0
|
||||
with:
|
||||
composer-options: "--no-progress --no-ansi --no-interaction"
|
||||
|
||||
@ -96,23 +101,22 @@ jobs:
|
||||
#
|
||||
# Performs the following steps:
|
||||
# - Checks out the repository.
|
||||
# - Logs debug information about the runner container.
|
||||
# - Installs NodeJS 14.
|
||||
# - Sets up caching for NPM.
|
||||
# - Logs debug information about the GitHub Action runner.
|
||||
# - Installs NodeJS.
|
||||
# - Logs updated debug information.
|
||||
# _ Installs NPM dependencies using install-changed to hash the `package.json` file.
|
||||
# _ Installs NPM dependencies.
|
||||
# - Run the WordPress JSHint checks.
|
||||
# - todo: Configure Slack notifications for failing tests.
|
||||
jshint:
|
||||
name: JavaScript coding standards
|
||||
runs-on: ubuntu-latest
|
||||
timeout-minutes: 20
|
||||
if: ${{ github.repository == 'WordPress/wordpress-develop' || github.event_name == 'pull_request' }}
|
||||
env:
|
||||
PUPPETEER_SKIP_CHROMIUM_DOWNLOAD: ${{ true }}
|
||||
|
||||
steps:
|
||||
- name: Checkout repository
|
||||
uses: actions/checkout@5a4ac9002d0be2fb38bd78e4b4dbde5606d7042f # v2.3.4
|
||||
uses: actions/checkout@2541b1294d2704b0964813337f33b291d3f8596b # v3.0.2
|
||||
|
||||
- name: Log debug information
|
||||
run: |
|
||||
@ -122,18 +126,10 @@ jobs:
|
||||
svn --version
|
||||
|
||||
- name: Install NodeJS
|
||||
uses: actions/setup-node@46071b5c7a2e0c34e49c3cb8a0e792e86e18d5ea # v2.1.5
|
||||
uses: actions/setup-node@eeb10cff27034e7acf239c5d29f62154018672fd # v3.3.0
|
||||
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') }}
|
||||
node-version-file: '.nvmrc'
|
||||
cache: npm
|
||||
|
||||
- name: Log debug information
|
||||
run: |
|
||||
@ -145,3 +141,16 @@ jobs:
|
||||
|
||||
- name: Run JSHint
|
||||
run: npm run grunt jshint
|
||||
|
||||
slack-notifications:
|
||||
name: Slack Notifications
|
||||
uses: WordPress/wordpress-develop/.github/workflows/slack-notifications.yml@trunk
|
||||
needs: [ phpcs, jshint ]
|
||||
if: ${{ github.repository == 'WordPress/wordpress-develop' && github.event_name != 'pull_request' && always() }}
|
||||
with:
|
||||
calling_status: ${{ needs.phpcs.result == 'success' && needs.jshint.result == 'success' && 'success' || ( needs.phpcs.result == 'cancelled' || needs.jshint.result == 'cancelled' ) && 'cancelled' || 'failure' }}
|
||||
secrets:
|
||||
SLACK_GHA_SUCCESS_WEBHOOK: ${{ secrets.SLACK_GHA_SUCCESS_WEBHOOK }}
|
||||
SLACK_GHA_CANCELLED_WEBHOOK: ${{ secrets.SLACK_GHA_CANCELLED_WEBHOOK }}
|
||||
SLACK_GHA_FIXED_WEBHOOK: ${{ secrets.SLACK_GHA_FIXED_WEBHOOK }}
|
||||
SLACK_GHA_FAILURE_WEBHOOK: ${{ secrets.SLACK_GHA_FAILURE_WEBHOOK }}
|
||||
|
119
.github/workflows/end-to-end-tests.yml
vendored
119
.github/workflows/end-to-end-tests.yml
vendored
@ -1,119 +0,0 @@
|
||||
name: End-to-end Tests
|
||||
|
||||
on:
|
||||
push:
|
||||
branches:
|
||||
- master
|
||||
# The end to end test suite was introduced in WordPress 5.3.
|
||||
- '5.[3-9]'
|
||||
- '[6-9].[0-9]'
|
||||
tags:
|
||||
- '5.[3-9]*'
|
||||
- '[6-9].[0-9]*'
|
||||
pull_request:
|
||||
|
||||
env:
|
||||
LOCAL_DIR: build
|
||||
|
||||
jobs:
|
||||
# Runs the end-to-end test suite.
|
||||
#
|
||||
# Performs the following steps:
|
||||
# - Cancels all previous workflow runs for pull requests that have not completed.
|
||||
# - Set environment variables.
|
||||
# - Checks out the repository.
|
||||
# - 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.
|
||||
# - 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.
|
||||
# - Run the E2E tests.
|
||||
# - todo: Configure Slack notifications for failing tests.
|
||||
e2e-tests:
|
||||
name: E2E Tests
|
||||
runs-on: ubuntu-latest
|
||||
if: ${{ github.repository == 'WordPress/wordpress-develop' || github.event_name == 'pull_request' }}
|
||||
|
||||
steps:
|
||||
- name: Cancel previous runs of this workflow (pull requests only)
|
||||
if: ${{ github.event_name == 'pull_request' }}
|
||||
uses: styfle/cancel-workflow-action@0.5.0
|
||||
with:
|
||||
access_token: ${{ github.token }}
|
||||
|
||||
- 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: Log debug information
|
||||
run: |
|
||||
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: 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: Docker debug information
|
||||
run: |
|
||||
docker -v
|
||||
docker-compose -v
|
||||
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 E2E tests
|
||||
run: npm run test:e2e
|
52
.github/workflows/javascript-tests.yml
vendored
52
.github/workflows/javascript-tests.yml
vendored
@ -4,7 +4,6 @@ on:
|
||||
# JavaScript testing was introduced in WordPress 3.8.
|
||||
push:
|
||||
branches:
|
||||
- master
|
||||
- trunk
|
||||
- '3.[89]'
|
||||
- '[4-9].[0-9]'
|
||||
@ -13,7 +12,6 @@ on:
|
||||
- '[4-9].[0-9]*'
|
||||
pull_request:
|
||||
branches:
|
||||
- master
|
||||
- trunk
|
||||
- '3.[89]'
|
||||
- '[4-9].[0-9]'
|
||||
@ -32,31 +30,32 @@ on:
|
||||
- '.github/workflows/*.yml'
|
||||
workflow_dispatch:
|
||||
|
||||
# Cancels all previous workflow runs for pull requests that have not completed.
|
||||
concurrency:
|
||||
# The concurrency group contains the workflow name and the branch name for pull requests
|
||||
# or the commit hash for any other events.
|
||||
group: ${{ github.workflow }}-${{ github.event_name == 'pull_request' && github.head_ref || github.sha }}
|
||||
cancel-in-progress: true
|
||||
|
||||
jobs:
|
||||
# Runs the QUnit tests for WordPress.
|
||||
#
|
||||
# Performs the following steps:
|
||||
# - Cancels all previous workflow runs for pull requests that have not completed.
|
||||
# - Checks out the repository.
|
||||
# - Logs debug information about the runner container.
|
||||
# - Installs NodeJS 14.
|
||||
# - Sets up caching for NPM.
|
||||
# - Logs debug information about the GitHub Action runner.
|
||||
# - Installs NodeJS.
|
||||
# - Logs updated debug information.
|
||||
# _ Installs NPM dependencies using install-changed to hash the `package.json` file.
|
||||
# _ Installs NPM dependencies.
|
||||
# - Run the WordPress QUnit tests.
|
||||
# - todo: Configure Slack notifications for failing tests.
|
||||
test-js:
|
||||
name: QUnit Tests
|
||||
runs-on: ubuntu-latest
|
||||
timeout-minutes: 20
|
||||
if: ${{ github.repository == 'WordPress/wordpress-develop' || github.event_name == 'pull_request' }}
|
||||
|
||||
steps:
|
||||
- name: Cancel previous runs of this workflow (pull requests only)
|
||||
if: ${{ github.event_name == 'pull_request' }}
|
||||
uses: styfle/cancel-workflow-action@3d86a7cc43670094ac248017207be0295edbc31d # v0.8.0
|
||||
|
||||
- name: Checkout repository
|
||||
uses: actions/checkout@5a4ac9002d0be2fb38bd78e4b4dbde5606d7042f # v2.3.4
|
||||
uses: actions/checkout@2541b1294d2704b0964813337f33b291d3f8596b # v3.0.2
|
||||
|
||||
- name: Log debug information
|
||||
run: |
|
||||
@ -66,18 +65,10 @@ jobs:
|
||||
svn --version
|
||||
|
||||
- name: Install NodeJS
|
||||
uses: actions/setup-node@46071b5c7a2e0c34e49c3cb8a0e792e86e18d5ea # v2.1.5
|
||||
uses: actions/setup-node@eeb10cff27034e7acf239c5d29f62154018672fd # v3.3.0
|
||||
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') }}
|
||||
node-version-file: '.nvmrc'
|
||||
cache: npm
|
||||
|
||||
- name: Log debug information
|
||||
run: |
|
||||
@ -89,3 +80,16 @@ jobs:
|
||||
|
||||
- name: Run QUnit tests
|
||||
run: npm run grunt qunit:compiled
|
||||
|
||||
slack-notifications:
|
||||
name: Slack Notifications
|
||||
uses: WordPress/wordpress-develop/.github/workflows/slack-notifications.yml@trunk
|
||||
needs: [ test-js ]
|
||||
if: ${{ github.repository == 'WordPress/wordpress-develop' && github.event_name != 'pull_request' && always() }}
|
||||
with:
|
||||
calling_status: ${{ needs.test-js.result == 'success' && 'success' || needs.test-js.result == 'cancelled' && 'cancelled' || 'failure' }}
|
||||
secrets:
|
||||
SLACK_GHA_SUCCESS_WEBHOOK: ${{ secrets.SLACK_GHA_SUCCESS_WEBHOOK }}
|
||||
SLACK_GHA_CANCELLED_WEBHOOK: ${{ secrets.SLACK_GHA_CANCELLED_WEBHOOK }}
|
||||
SLACK_GHA_FIXED_WEBHOOK: ${{ secrets.SLACK_GHA_FIXED_WEBHOOK }}
|
||||
SLACK_GHA_FAILURE_WEBHOOK: ${{ secrets.SLACK_GHA_FAILURE_WEBHOOK }}
|
||||
|
79
.github/workflows/php-compatibility.yml
vendored
79
.github/workflows/php-compatibility.yml
vendored
@ -1,79 +0,0 @@
|
||||
name: PHP Compatibility
|
||||
|
||||
on:
|
||||
# PHP compatibility testing was introduced in WordPress 5.5.
|
||||
push:
|
||||
branches:
|
||||
- master
|
||||
- trunk
|
||||
- '5.[5-9]'
|
||||
- '[6-9].[0-9]'
|
||||
tags:
|
||||
- '5.[5-9]*'
|
||||
- '[6-9].[0-9]*'
|
||||
pull_request:
|
||||
branches:
|
||||
- master
|
||||
- trunk
|
||||
- '5.[5-9]'
|
||||
- '[6-9].[0-9]'
|
||||
paths:
|
||||
# This workflow only scans PHP files.
|
||||
- '**.php'
|
||||
# These files configure Composer. Changes could affect the outcome.
|
||||
- 'composer.*'
|
||||
# This file configures PHP Compatibility scanning. Changes could affect the outcome.
|
||||
- 'phpcompat.xml.dist'
|
||||
# Changes to workflow files should always verify all workflows are successful.
|
||||
- '.github/workflows/*.yml'
|
||||
workflow_dispatch:
|
||||
|
||||
jobs:
|
||||
|
||||
# Runs PHP compatibility testing.
|
||||
#
|
||||
# Violations are reported inline with annotations.
|
||||
#
|
||||
# Performs the following steps:
|
||||
# - Checks out the repository.
|
||||
# - Sets up PHP.
|
||||
# - Logs debug information about the runner container.
|
||||
# - Installs Composer dependencies (use cache if possible).
|
||||
# - Make Composer packages available globally.
|
||||
# - Logs PHP_CodeSniffer debug information.
|
||||
# - Runs the PHP compatibility tests.
|
||||
# - todo: Configure Slack notifications for failing scans.
|
||||
php-comatibility:
|
||||
name: Check PHP compatibility
|
||||
runs-on: ubuntu-latest
|
||||
if: ${{ github.repository == 'WordPress/wordpress-develop' || github.event_name == 'pull_request' }}
|
||||
|
||||
steps:
|
||||
- name: Checkout repository
|
||||
uses: actions/checkout@5a4ac9002d0be2fb38bd78e4b4dbde5606d7042f # v2.3.4
|
||||
|
||||
- name: Set up PHP
|
||||
uses: shivammathur/setup-php@afefcaf556d98dc7896cca380e181decb609ca44 # v2.10.0
|
||||
with:
|
||||
php-version: '7.4'
|
||||
coverage: none
|
||||
tools: composer, cs2pr
|
||||
|
||||
- name: Log debug information
|
||||
run: |
|
||||
php --version
|
||||
composer --version
|
||||
|
||||
- name: Install Composer dependencies
|
||||
uses: ramsey/composer-install@92a7904348d4ad30236f3611e33b7f0c6f9edd70 # v1.1.0
|
||||
with:
|
||||
composer-options: "--no-progress --no-ansi --no-interaction"
|
||||
|
||||
- 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
|
||||
run: phpcs --standard=phpcompat.xml.dist -q --report=checkstyle | cs2pr
|
79
.github/workflows/phpunit-tests.yml
vendored
79
.github/workflows/phpunit-tests.yml
vendored
@ -3,7 +3,6 @@ name: PHPUnit Tests
|
||||
on:
|
||||
push:
|
||||
branches:
|
||||
- master
|
||||
- trunk
|
||||
- '3.[7-9]'
|
||||
- '[4-9].[0-9]'
|
||||
@ -12,7 +11,6 @@ on:
|
||||
- '[4-9].[0-9]*'
|
||||
pull_request:
|
||||
branches:
|
||||
- master
|
||||
- trunk
|
||||
- '3.[7-9]'
|
||||
- '[4-9].[0-9]'
|
||||
@ -21,6 +19,13 @@ on:
|
||||
schedule:
|
||||
- cron: '0 0 * * 0'
|
||||
|
||||
# Cancels all previous workflow runs for pull requests that have not completed.
|
||||
concurrency:
|
||||
# The concurrency group contains the workflow name and the branch name for pull requests
|
||||
# or the commit hash for any other events.
|
||||
group: ${{ github.workflow }}-${{ github.event_name == 'pull_request' && github.head_ref || github.sha }}
|
||||
cancel-in-progress: true
|
||||
|
||||
env:
|
||||
PUPPETEER_SKIP_CHROMIUM_DOWNLOAD: ${{ true }}
|
||||
# Controls which NPM script to use for running PHPUnit tests. Options ar `php` and `php-composer`.
|
||||
@ -29,46 +34,31 @@ env:
|
||||
SLOW_TESTS: 'external-http,media,restapi'
|
||||
|
||||
jobs:
|
||||
# Sets up the workflow for testing.
|
||||
#
|
||||
# Performs the following steps:
|
||||
# - Cancels all previous workflow runs for pull requests that have not completed.
|
||||
setup-workflow:
|
||||
name: Setup Workflow
|
||||
runs-on: ubuntu-latest
|
||||
if: ${{ github.repository == 'WordPress/wordpress-develop' || github.event_name == 'pull_request' }}
|
||||
|
||||
steps:
|
||||
- name: Cancel previous runs of this workflow (pull requests only)
|
||||
if: ${{ github.event_name == 'pull_request' }}
|
||||
uses: styfle/cancel-workflow-action@3d86a7cc43670094ac248017207be0295edbc31d # v0.8.0
|
||||
|
||||
# Runs the PHPUnit tests for WordPress.
|
||||
#
|
||||
# Performs the following steps:
|
||||
# - Set environment variables.
|
||||
# - Sets environment variables.
|
||||
# - Sets up the environment variables needed for testing with memcached (if desired).
|
||||
# - Installs NodeJS 14.
|
||||
# - Sets up caching for NPM.
|
||||
# - Installs NodeJS.
|
||||
# - Installs NPM dependencies
|
||||
# - Configures caching for Composer.
|
||||
# - Installs Composer dependencies (if desired).
|
||||
# - Logs Docker debug information (about both the Docker installation within the runner).
|
||||
# - Installs Composer dependencies.
|
||||
# - Logs Docker debug information (about the Docker installation within the runner).
|
||||
# - Starts the WordPress Docker container.
|
||||
# - Starts the memcached server after the Docker network has been created (if desired).
|
||||
# - Logs WordPress Docker container debug information.
|
||||
# - Logs debug general information.
|
||||
# - Starts the Memcached server after the Docker network has been created (if desired).
|
||||
# - 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.
|
||||
# - 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.
|
||||
# - todo: Configure Slack notifications for failing tests.
|
||||
test-php:
|
||||
name: ${{ matrix.php }}${{ matrix.multisite && ' multisite' || '' }}${{ matrix.split_slow && ' slow tests' || '' }} ${{ matrix.memcached && ' with memcached' || '' }} on ${{ matrix.os }}
|
||||
name: ${{ matrix.php }}${{ matrix.multisite && ' multisite' || '' }}${{ matrix.split_slow && ' slow tests' || '' }}${{ matrix.memcached && ' with memcached' || '' }} on ${{ matrix.os }}
|
||||
runs-on: ${{ matrix.os }}
|
||||
timeout-minutes: 20
|
||||
if: ${{ github.repository == 'WordPress/wordpress-develop' || github.event_name == 'pull_request' }}
|
||||
strategy:
|
||||
fail-fast: false
|
||||
@ -117,21 +107,13 @@ jobs:
|
||||
echo "PHP_FPM_GID=$(id -g)" >> $GITHUB_ENV
|
||||
|
||||
- name: Checkout repository
|
||||
uses: actions/checkout@5a4ac9002d0be2fb38bd78e4b4dbde5606d7042f # v2.3.4
|
||||
uses: actions/checkout@2541b1294d2704b0964813337f33b291d3f8596b # v3.0.2
|
||||
|
||||
- name: Install NodeJS
|
||||
uses: actions/setup-node@46071b5c7a2e0c34e49c3cb8a0e792e86e18d5ea # v2.1.5
|
||||
uses: actions/setup-node@eeb10cff27034e7acf239c5d29f62154018672fd # v3.3.0
|
||||
with:
|
||||
node-version: 14
|
||||
|
||||
- name: Use cached Node 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') }}
|
||||
node-version-file: '.nvmrc'
|
||||
cache: npm
|
||||
|
||||
- name: Install Dependencies
|
||||
run: npm ci
|
||||
@ -141,7 +123,7 @@ jobs:
|
||||
run: echo "::set-output name=dir::$(composer config cache-files-dir)"
|
||||
|
||||
- name: Cache Composer dependencies
|
||||
uses: actions/cache@26968a09c0ea4f3e233fdddbafd1166051a095f6 # v2.1.4
|
||||
uses: actions/cache@c3f1317a9e7b1ef106c153ac8c0f00fed3ddbc0d # v3.0.4
|
||||
env:
|
||||
cache-name: cache-composer-dependencies
|
||||
with:
|
||||
@ -232,14 +214,27 @@ jobs:
|
||||
run: LOCAL_PHP_XDEBUG=true npm run test:${{ env.PHPUNIT_SCRIPT }} -- -v --group xdebug --exclude-group __fakegroup__
|
||||
|
||||
- name: Checkout the WordPress Test Reporter
|
||||
if: ${{ github.repository == 'WordPress/wordpress-develop' && github.ref == 'refs/heads/master' && matrix.report }}
|
||||
uses: actions/checkout@5a4ac9002d0be2fb38bd78e4b4dbde5606d7042f # v2.3.4
|
||||
if: ${{ github.repository == 'WordPress/wordpress-develop' && github.ref == 'refs/heads/trunk' && matrix.report }}
|
||||
uses: actions/checkout@2541b1294d2704b0964813337f33b291d3f8596b # v3.0.2
|
||||
with:
|
||||
repository: 'WordPress/phpunit-test-runner'
|
||||
path: 'test-runner'
|
||||
|
||||
- name: Submit test results to the WordPress.org host test results
|
||||
if: ${{ github.repository == 'WordPress/wordpress-develop' && github.ref == 'refs/heads/master' && matrix.report }}
|
||||
if: ${{ github.repository == 'WordPress/wordpress-develop' && github.ref == 'refs/heads/trunk' && matrix.report }}
|
||||
env:
|
||||
WPT_REPORT_API_KEY: "${{ secrets.WPT_REPORT_API_KEY }}"
|
||||
run: docker-compose run --rm -e WPT_REPORT_API_KEY -e WPT_PREPARE_DIR=/var/www -e WPT_TEST_DIR=/var/www php php test-runner/report.php
|
||||
|
||||
slack-notifications:
|
||||
name: Slack Notifications
|
||||
uses: WordPress/wordpress-develop/.github/workflows/slack-notifications.yml@trunk
|
||||
needs: [ test-php ]
|
||||
if: ${{ github.repository == 'WordPress/wordpress-develop' && github.event_name != 'pull_request' && always() }}
|
||||
with:
|
||||
calling_status: ${{ needs.test-php.result == 'success' && 'success' || needs.test-php.result == 'cancelled' && 'cancelled' || 'failure' }}
|
||||
secrets:
|
||||
SLACK_GHA_SUCCESS_WEBHOOK: ${{ secrets.SLACK_GHA_SUCCESS_WEBHOOK }}
|
||||
SLACK_GHA_CANCELLED_WEBHOOK: ${{ secrets.SLACK_GHA_CANCELLED_WEBHOOK }}
|
||||
SLACK_GHA_FIXED_WEBHOOK: ${{ secrets.SLACK_GHA_FIXED_WEBHOOK }}
|
||||
SLACK_GHA_FAILURE_WEBHOOK: ${{ secrets.SLACK_GHA_FAILURE_WEBHOOK }}
|
||||
|
101
.github/workflows/test-npm.yml
vendored
101
.github/workflows/test-npm.yml
vendored
@ -3,13 +3,11 @@ name: Test NPM
|
||||
on:
|
||||
push:
|
||||
branches:
|
||||
- master
|
||||
- trunk
|
||||
- '3.[7-9]'
|
||||
- '[4-9].[0-9]'
|
||||
pull_request:
|
||||
branches:
|
||||
- master
|
||||
- trunk
|
||||
- '3.[7-9]'
|
||||
- '[4-9].[0-9]'
|
||||
@ -25,32 +23,24 @@ on:
|
||||
- '.github/workflows/**.yml'
|
||||
workflow_dispatch:
|
||||
|
||||
# Cancels all previous workflow runs for pull requests that have not completed.
|
||||
concurrency:
|
||||
# The concurrency group contains the workflow name and the branch name for pull requests
|
||||
# or the commit hash for any other events.
|
||||
group: ${{ github.workflow }}-${{ github.event_name == 'pull_request' && github.head_ref || github.sha }}
|
||||
cancel-in-progress: true
|
||||
|
||||
env:
|
||||
PUPPETEER_SKIP_CHROMIUM_DOWNLOAD: ${{ true }}
|
||||
|
||||
jobs:
|
||||
# Prepares the workflow.
|
||||
#
|
||||
# Performs the following steps:
|
||||
# - Cancels all previous workflow runs for pull requests that have not completed.
|
||||
prepare-workflow:
|
||||
name: Prepare the workflow
|
||||
runs-on: ubuntu-latest
|
||||
if: ${{ github.repository == 'WordPress/wordpress-develop' || github.event_name == 'pull_request' }}
|
||||
|
||||
steps:
|
||||
- name: Cancel previous runs of this workflow (pull requests only)
|
||||
if: ${{ github.event_name == 'pull_request' }}
|
||||
uses: styfle/cancel-workflow-action@3d86a7cc43670094ac248017207be0295edbc31d # v0.8.0
|
||||
|
||||
# Verifies that installing NPM dependencies and building WordPress works as expected.
|
||||
#
|
||||
# Performs the following steps:
|
||||
# - Checks out the repository.
|
||||
# - 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 debug information about the GitHub Action runner.
|
||||
# - Installs NodeJS.
|
||||
# _ Installs NPM dependencies.
|
||||
# - Builds WordPress to run from the `build` directory.
|
||||
# - Cleans up after building WordPress to the `build` directory.
|
||||
# - Builds WordPress to run from the `src` directory.
|
||||
@ -58,8 +48,8 @@ jobs:
|
||||
test-npm:
|
||||
name: Test NPM on ${{ matrix.os }}
|
||||
runs-on: ${{ matrix.os }}
|
||||
timeout-minutes: 20
|
||||
if: ${{ github.repository == 'WordPress/wordpress-develop' || github.event_name == 'pull_request' }}
|
||||
needs: prepare-workflow
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
@ -67,7 +57,7 @@ jobs:
|
||||
|
||||
steps:
|
||||
- name: Checkout repository
|
||||
uses: actions/checkout@5a4ac9002d0be2fb38bd78e4b4dbde5606d7042f # v2.3.4
|
||||
uses: actions/checkout@2541b1294d2704b0964813337f33b291d3f8596b # v3.0.2
|
||||
|
||||
- name: Log debug information
|
||||
run: |
|
||||
@ -78,28 +68,10 @@ jobs:
|
||||
svn --version
|
||||
|
||||
- name: Install NodeJS
|
||||
uses: actions/setup-node@46071b5c7a2e0c34e49c3cb8a0e792e86e18d5ea # v2.1.5
|
||||
uses: actions/setup-node@eeb10cff27034e7acf239c5d29f62154018672fd # v3.3.0
|
||||
with:
|
||||
node-version: 14
|
||||
|
||||
- name: Cache NodeJS modules (Ubuntu & MacOS)
|
||||
uses: actions/cache@26968a09c0ea4f3e233fdddbafd1166051a095f6 # v2.1.4
|
||||
if: ${{ matrix.os != 'windows-latest' }}
|
||||
with:
|
||||
path: ~/.npm
|
||||
key: ${{ runner.os }}-npm-${{ hashFiles('**/package-lock.json') }}
|
||||
|
||||
- name: Get NPM cache directory (Windows only)
|
||||
if: ${{ matrix.os == 'windows-latest' }}
|
||||
id: npm-cache
|
||||
run: echo "::set-output name=dir::$(npm config get cache)"
|
||||
|
||||
- name: Cache NodeJS modules (Windows only)
|
||||
uses: actions/cache@26968a09c0ea4f3e233fdddbafd1166051a095f6 # v2.1.4
|
||||
if: ${{ matrix.os == 'windows-latest' }}
|
||||
with:
|
||||
path: ${{ steps.npm-cache.outputs.dir }}
|
||||
key: ${{ runner.os }}-npm-${{ hashFiles('**/package-lock.json') }}
|
||||
node-version-file: '.nvmrc'
|
||||
cache: npm
|
||||
|
||||
- name: Install Dependencies
|
||||
run: npm ci
|
||||
@ -114,18 +86,18 @@ jobs:
|
||||
run: npm run build:dev
|
||||
|
||||
- name: Clean after building in /src
|
||||
run: npm run grunt clean --dev
|
||||
run: npm run grunt clean -- --dev
|
||||
|
||||
# Verifies that installing NPM dependencies and building WordPress works as expected on MacOS.
|
||||
#
|
||||
# This is a separate job in order to that more strict conditions can be used.
|
||||
# This is separate from the job above in order to use stricter conditions about when to run.
|
||||
# This avoids unintentionally consuming excessive minutes, as MacOS jobs consume minutes at a 10x rate.
|
||||
#
|
||||
# Performs the following steps:
|
||||
# - Checks out the repository.
|
||||
# - 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 debug information about the GitHub Action runner.
|
||||
# - Installs NodeJS.
|
||||
# _ Installs NPM dependencies.
|
||||
# - Builds WordPress to run from the `build` directory.
|
||||
# - Cleans up after building WordPress to the `build` directory.
|
||||
# - Builds WordPress to run from the `src` directory.
|
||||
@ -133,11 +105,11 @@ jobs:
|
||||
test-npm-macos:
|
||||
name: Test NPM on MacOS
|
||||
runs-on: macos-latest
|
||||
timeout-minutes: 20
|
||||
if: ${{ github.repository == 'WordPress/wordpress-develop' }}
|
||||
needs: prepare-workflow
|
||||
steps:
|
||||
- name: Checkout repository
|
||||
uses: actions/checkout@5a4ac9002d0be2fb38bd78e4b4dbde5606d7042f # v2.3.4
|
||||
uses: actions/checkout@2541b1294d2704b0964813337f33b291d3f8596b # v3.0.2
|
||||
|
||||
- name: Log debug information
|
||||
run: |
|
||||
@ -148,16 +120,10 @@ jobs:
|
||||
svn --version
|
||||
|
||||
- name: Install NodeJS
|
||||
uses: actions/setup-node@46071b5c7a2e0c34e49c3cb8a0e792e86e18d5ea # v2.1.5
|
||||
uses: actions/setup-node@eeb10cff27034e7acf239c5d29f62154018672fd # v3.3.0
|
||||
with:
|
||||
node-version: 14
|
||||
|
||||
- name: Cache NodeJS modules
|
||||
uses: actions/cache@26968a09c0ea4f3e233fdddbafd1166051a095f6 # v2.1.4
|
||||
if: ${{ matrix.os != 'windows-latest' }}
|
||||
with:
|
||||
path: ~/.npm
|
||||
key: ${{ runner.os }}-npm-${{ hashFiles('**/package-lock.json') }}
|
||||
node-version-file: '.nvmrc'
|
||||
cache: npm
|
||||
|
||||
- name: Install Dependencies
|
||||
run: npm ci
|
||||
@ -172,4 +138,17 @@ jobs:
|
||||
run: npm run build:dev
|
||||
|
||||
- name: Clean after building in /src
|
||||
run: npm run grunt clean --dev
|
||||
run: npm run grunt clean -- --dev
|
||||
|
||||
slack-notifications:
|
||||
name: Slack Notifications
|
||||
uses: WordPress/wordpress-develop/.github/workflows/slack-notifications.yml@trunk
|
||||
needs: [ test-npm, test-npm-macos ]
|
||||
if: ${{ github.repository == 'WordPress/wordpress-develop' && github.event_name != 'pull_request' && always() }}
|
||||
with:
|
||||
calling_status: ${{ needs.test-npm.result == 'success' && needs.test-npm-macos.result == 'success' && 'success' || ( needs.test-npm.result == 'cancelled' || needs.test-npm-macos.result == 'cancelled' ) && 'cancelled' || 'failure' }}
|
||||
secrets:
|
||||
SLACK_GHA_SUCCESS_WEBHOOK: ${{ secrets.SLACK_GHA_SUCCESS_WEBHOOK }}
|
||||
SLACK_GHA_CANCELLED_WEBHOOK: ${{ secrets.SLACK_GHA_CANCELLED_WEBHOOK }}
|
||||
SLACK_GHA_FIXED_WEBHOOK: ${{ secrets.SLACK_GHA_FIXED_WEBHOOK }}
|
||||
SLACK_GHA_FAILURE_WEBHOOK: ${{ secrets.SLACK_GHA_FAILURE_WEBHOOK }}
|
||||
|
58
.github/workflows/test-old-branches.yml
vendored
58
.github/workflows/test-old-branches.yml
vendored
@ -1,58 +0,0 @@
|
||||
name: Test old branches
|
||||
|
||||
on:
|
||||
# Once weekly On Mondays at 00:00 UTC.
|
||||
schedule:
|
||||
- cron: '0 0 1,15 * *'
|
||||
|
||||
jobs:
|
||||
dispatch-workflows-for-old-branches:
|
||||
name: ${{ matrix.workflow }} for ${{ matrix.branch }}
|
||||
runs-on: ubuntu-latest
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
workflow: [
|
||||
'coding-standards.yml',
|
||||
'javascript-tests.yml',
|
||||
'phpunit-tests.yml',
|
||||
'test-npm.yml'
|
||||
]
|
||||
branch: [
|
||||
'5.7', '5.6', '5.5', '5.4', '5.3', '5.2', '5.1', '5.0',
|
||||
'4.9', '4.8', '4.7', '4.6', '4.5', '4.4', '4.3', '4.2', '4.1', '4.0',
|
||||
'3.9', '3.8', '3.7'
|
||||
]
|
||||
include:
|
||||
# PHP Compatibility testing was introduced in 5.5.
|
||||
- branch: '5.7'
|
||||
workflow: 'php-compatibility.yml'
|
||||
- branch: '5.6'
|
||||
workflow: 'php-compatibility.yml'
|
||||
- branch: '5.5'
|
||||
workflow: 'php-compatibility.yml'
|
||||
|
||||
# End to End testing was introduced in 5.3 but later removed as there were no meaningful assertions.
|
||||
# Only the officially supported major branch runs E2E tests so that more assertions can be added, and the
|
||||
# workflow does not continue to run needlessly on old branches.
|
||||
- branch: '5.7'
|
||||
workflow: 'end-to-end-tests.yml'
|
||||
exclude:
|
||||
# Coding standards and JavaScript testing did not take place in 3.7.
|
||||
- branch: '3.7'
|
||||
workflow: 'coding-standards.yml'
|
||||
- branch: '3.7'
|
||||
workflow: 'javascript-tests.yml'
|
||||
|
||||
steps:
|
||||
- name: Dispatch workflow run
|
||||
uses: actions/github-script@47f7cf65b5ced0830a325f705cad64f2f58dddf7 # v3.1.0
|
||||
with:
|
||||
github-token: ${{ secrets.GHA_OLD_BRANCH_DISPATCH }}
|
||||
script: |
|
||||
github.actions.createWorkflowDispatch({
|
||||
owner: context.repo.owner,
|
||||
repo: context.repo.repo,
|
||||
workflow_id: '${{ matrix.workflow }}',
|
||||
ref: '${{ matrix.branch }}'
|
||||
});
|
@ -8,6 +8,7 @@ jobs:
|
||||
# Comments on a pull request when the author is a new contributor.
|
||||
post-welcome-message:
|
||||
runs-on: ubuntu-latest
|
||||
timeout-minutes: 5
|
||||
if: ${{ github.repository == 'WordPress/wordpress-develop' }}
|
||||
|
||||
steps:
|
||||
|
Loading…
x
Reference in New Issue
Block a user