mirror of
https://github.com/gosticks/wordpress-develop.git
synced 2025-10-16 12:05:38 +00:00
The correct variable here is `github.run_attempt`, which represents the unique number for each attempt of a particular workflow run in a repository. The `github.run_number` currently being used represents the unique number for each run of a particular workflow in a repository. Follow up to [53947]. Fixes #56407. git-svn-id: https://develop.svn.wordpress.org/trunk@54039 602fd350-edb4-49c9-b593-d223f7449a82
162 lines
5.0 KiB
YAML
162 lines
5.0 KiB
YAML
name: End-to-end Tests
|
|
|
|
on:
|
|
# The end-to-end test suite was introduced in WordPress 5.3.
|
|
push:
|
|
branches:
|
|
- trunk
|
|
- '5.[3-9]'
|
|
- '[6-9].[0-9]'
|
|
tags:
|
|
- '[0-9]+.[0-9]'
|
|
- '[0-9]+.[0-9].[0-9]+'
|
|
- '![34].[0-9].[0-9]+'
|
|
- '!5.[0-2].[0-9]+'
|
|
pull_request:
|
|
branches:
|
|
- trunk
|
|
- '5.[3-9]'
|
|
- '[6-9].[0-9]'
|
|
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:
|
|
LOCAL_DIR: build
|
|
|
|
jobs:
|
|
# Runs the end-to-end test suite.
|
|
#
|
|
# Performs the following steps:
|
|
# - Sets environment variables.
|
|
# - Checks out the repository.
|
|
# - Logs debug information about the GitHub Action runner.
|
|
# - Installs NodeJS.
|
|
# _ 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.
|
|
# - Run the E2E tests.
|
|
# - Ensures version-controlled files are not modified or deleted.
|
|
e2e-tests:
|
|
name: E2E Tests
|
|
runs-on: ubuntu-latest
|
|
timeout-minutes: 20
|
|
if: ${{ github.repository == 'WordPress/wordpress-develop' || github.event_name == 'pull_request' }}
|
|
|
|
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@2541b1294d2704b0964813337f33b291d3f8596b # v3.0.2
|
|
|
|
- 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@2fddd8803e2f5c9604345a0b591c3020ee971a93 # v3.4.1
|
|
with:
|
|
node-version-file: '.nvmrc'
|
|
cache: npm
|
|
|
|
- name: Install Dependencies
|
|
run: 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
|
|
|
|
- name: Ensure version-controlled files are not modified or deleted
|
|
run: git diff --exit-code
|
|
|
|
slack-notifications:
|
|
name: Slack Notifications
|
|
uses: WordPress/wordpress-develop/.github/workflows/slack-notifications.yml@trunk
|
|
needs: [ e2e-tests ]
|
|
if: ${{ github.repository == 'WordPress/wordpress-develop' && github.event_name != 'pull_request' && always() }}
|
|
with:
|
|
calling_status: ${{ needs.e2e-tests.result == 'success' && 'success' || needs.e2e-tests.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 }}
|
|
|
|
failed-workflow:
|
|
name: Failed workflow tasks
|
|
runs-on: ubuntu-latest
|
|
needs: [ e2e-tests, slack-notifications ]
|
|
if: |
|
|
always() &&
|
|
github.repository == 'WordPress/wordpress-develop' &&
|
|
github.event_name != 'pull_request' &&
|
|
github.run_attempt < 2 &&
|
|
(
|
|
needs.e2e-tests.result == 'cancelled' || needs.e2e-tests.result == 'failure'
|
|
)
|
|
|
|
steps:
|
|
- name: Dispatch workflow run
|
|
uses: actions/github-script@c713e510dbd7d213d92d41b7a7805a986f4c5c66 # v6.2.0
|
|
with:
|
|
github-token: ${{ secrets.GHA_WORKFLOW_DISPATCH }}
|
|
script: |
|
|
github.rest.actions.createWorkflowDispatch({
|
|
owner: context.repo.owner,
|
|
repo: context.repo.repo,
|
|
workflow_id: 'failed-workflow.yml',
|
|
ref: '${{ github.ref_name }}',
|
|
inputs: {
|
|
run_id: '${{ github.run_id }}'
|
|
}
|
|
});
|