`
- lint_gh_actions:
- name: Lint GitHub Actions yaml files
- runs-on: ubuntu-latest
- needs: changed_files
- if: needs.changed_files.outputs.ghactionsfiles == 'true' || needs.changed_files.outputs.misc == 'true'
- timeout-minutes: 5 # 2021-03-24: Pnpm stuff takes about a minute.
- steps:
- - uses: actions/checkout@v3
-
- - name: Setup tools
- uses: ./.github/actions/tool-setup
- with:
- php: false
-
- - run: pnpm install
- - name: Run lint
- run: ./tools/js-tools/lint-gh-actions.js -v '.github/workflows/*.{yml,yaml}' '.github/actions/*/action.{yml,yaml}' 'projects/github-actions/*/action.{yml,yaml}'
-
- ### Checks that copied files (e.g. readme, license) are in sync
- # Local equivalent: `./tools/check-copied-files.sh`
- copied_files:
- name: Copied files are in sync
- runs-on: ubuntu-latest
- timeout-minutes: 1 # 2021-01-18: Successful runs seem to take a few seconds.
-
- steps:
- - uses: actions/checkout@v3
- - run: ./tools/check-copied-files.sh
-
- ### Runs tools/cleanup-excludelists.sh and checks for any changes
- # Local equivalent: `tools/cleanup-excludelists.sh`
- check_excludelists:
- name: Check linter exclude lists
- runs-on: ubuntu-latest
- needs: changed_files
- if: needs.changed_files.outputs.excludelist == 'true'
- timeout-minutes: 10 # 2022-05-11: The check itself takes 4 minutes.
- steps:
- - uses: actions/checkout@v3
-
- - name: Setup tools
- uses: ./.github/actions/tool-setup
-
- - run: composer install
- - name: Monorepo pnpm install
- run: pnpm install
-
- - name: Cleanup excludelists
- run: tools/cleanup-excludelists.sh
- - name: Check for changes to exclude lists
- run: tools/js-tools/check-excludelist-diff.js
-
- ### Checks that changelogger change files are being created.
- # Local equivalent: Probably `tools/check-changelogger-use.php origin/trunk HEAD`
- changelogger_used:
- name: Changelogger use
- runs-on: ubuntu-latest
- timeout-minutes: 5 # 2021-03-24: Takes about a minute.
- steps:
- # We don't need full git history, but tools/check-changelogger-use.php does need everything up to the merge-base.
- - uses: actions/checkout@v3
- with:
- ref: ${{ github.event.pull_request.head.sha }}
- fetch-depth: 10
- - uses: ./.github/actions/deepen-to-merge-base
-
- - name: Setup tools
- uses: ./.github/actions/tool-setup
- with:
- node: false
-
- - name: Check change files are touched for touched projects
- env:
- BASE: ${{ github.event.pull_request.base.sha }}
- HEAD: ${{ github.event.pull_request.head.sha }}
- run: tools/check-changelogger-use.php --debug "$BASE" "$HEAD"
-
- ### Checks that changelogger change files are valid.
- # Local equivalent: `./tools/changelogger-validate-all.sh`
- changelogger_valid:
- name: Changelogger validity
- runs-on: ubuntu-latest
- timeout-minutes: 5 # 2021-03-24: Takes about a minute
- steps:
- - uses: actions/checkout@v3
-
- - name: Setup tools
- uses: ./.github/actions/tool-setup
- with:
- node: false
-
- - name: Check change file validity
- run: tools/changelogger-validate-all.sh -vv
-
- ### Checks that lock files are up to date.
- # Local equivalent: .github/files/check-lock-files.sh
- # Note that may modify lock files in your working tree!
- lock_files:
- name: "Lock files are up to date"
- runs-on: ubuntu-latest
- needs: changed_files
- if: needs.changed_files.outputs.lockfiles == 'true' || needs.changed_files.outputs.misc == 'true'
- timeout-minutes: 7 # 2021-03-17: Successful runs seem to take 3+ minutes, thanks to pnpm building stuff.
- steps:
- - uses: actions/checkout@v3
-
- - name: Setup tools
- uses: ./.github/actions/tool-setup
-
- - run: .github/files/check-lock-files.sh
-
- ### Check that monorepo packages are correctly referenced.
- # Local equivalent: tools/check-intra-monorepo-deps.sh -v && .github/files/check-monorepo-package-repos.sh
- monorepo_package_refs:
- name: Monorepo package version refs
- runs-on: ubuntu-latest
- needs: changed_files
- if: needs.changed_files.outputs.lockfiles == 'true' || needs.changed_files.outputs.misc == 'true'
- timeout-minutes: 5 # 2022-03-25: The pnpm install will probably take a minute or so.
- steps:
- - uses: actions/checkout@v3
- - name: Setup tools
- uses: ./.github/actions/tool-setup
- with:
- php: false
- - run: pnpm install
- - run: tools/check-intra-monorepo-deps.sh -v
- - run: .github/files/check-monorepo-package-repos.sh
-
- ### Checks against project structure, e.g. that composer.json exists.
- # Local equivalent: `./.github/files/lint-project-structure.sh`
- project_structure:
- name: Project structure
- runs-on: ubuntu-latest
- timeout-minutes: 5 # 2021-03-24: Pnpm stuff takes about a minute.
- steps:
- - uses: actions/checkout@v3
-
- - name: Setup tools
- uses: ./.github/actions/tool-setup
-
- - run: pnpm install
- - run: .github/files/lint-project-structure.sh
diff --git a/.github/workflows/phpcompatibility-dev.yml b/.github/workflows/phpcompatibility-dev.yml
deleted file mode 100644
index e8103ec229038..0000000000000
--- a/.github/workflows/phpcompatibility-dev.yml
+++ /dev/null
@@ -1,78 +0,0 @@
-# This Github Action is temporary, to run the development version of PHPCompatibility to test for PHP 8 issues.
-#
-# Once we're getting that by default (likely due to an upgrade of automattic/jetpack-codesniffer to pull a version of phpcompatibility/phpcompatibility-wp that pulls phpcompatibility/php-compatibility 10.0+),
-# this action and .github/files/phpcompatibility-dev-phpcs.xml should be deleted.
-
-name: PHP Compatibility
-
-on: pull_request
-concurrency:
- group: phpcompatibility-dev-${{ github.event_name }}-${{ github.ref }}
- cancel-in-progress: true
-
-env:
- COMPOSER_ROOT_VERSION: "dev-trunk"
-
-jobs:
- changed_files:
- name: detect changed files
- runs-on: ubuntu-latest
- timeout-minutes: 1 # 2021-01-18: Successful runs seem to take a few seconds.
- outputs:
- php: ${{ steps.filter.outputs.php }}
- misc: ${{ steps.filter.outputs.misc }}
-
- steps:
- - uses: dorny/paths-filter@v2
- id: filter
- with:
- filters: |
- php:
- # If any PHP file changed, they need checking.
- - '**.php'
- misc:
- # If composer or phpcs config changed, there may be a new standard.
- - 'composer.json'
- - 'composer.lock'
- - '.phpcs.config.xml'
- - '.phpcs.xml.dist'
- - '.phpcsignore'
- - '**/.phpcs.dir.xml'
- - '**/.phpcsignore'
- # If other files used by this workflow changed, run it to test those changes.
- - '.github/files/phpcompatibility-dev-phpcs.xml'
- - '.github/matchers/phpcs-problem-matcher.json'
- - '.github/workflows/phpcompatibility-dev.yml'
-
- phpcompatibility:
- name: dev branch for PHP 8.0
- runs-on: ubuntu-latest
- needs: changed_files
- if: needs.changed_files.outputs.php == 'true' || needs.changed_files.outputs.misc == 'true'
- timeout-minutes: 5 # 2021-01-18: Successful runs seem to take ~1 minute.
-
- steps:
- - uses: actions/checkout@v3
-
- - name: Setup tools
- uses: ./.github/actions/tool-setup
- with:
- node: false
-
- - name: Install dependencies
- run: composer install
-
- - name: Upgrade PHPCompatibility
- run: |
- if [[ -e vendor/phpcompatibility/php-compatibility/PHPCompatibility/Sniffs/ControlStructures/NewNonCapturingCatchSniff.php ]]; then
- echo "::error file=.github/workflows/phpcompatibility-dev.yml,line=4,col=1::It looks like PHPCompatibility is already at version 10.0, making this Github Action obsolete. Please remove it."
- exit 1
- fi
- composer remove --dev automattic/jetpack-codesniffer
- composer require --dev phpcompatibility/php-compatibility=dev-develop
-
- - name: Run phpcs for PHPCompatibility
- run: |
- echo "::add-matcher::.github/matchers/phpcs-problem-matcher.json"
- vendor/bin/phpcs -p -s --report=emacs --standard=.github/files/phpcompatibility-dev-phpcs.xml
- echo "::remove-matcher owner=phpcs"
diff --git a/.github/workflows/post-build.yml b/.github/workflows/post-build.yml
new file mode 100644
index 0000000000000..8efad664edd49
--- /dev/null
+++ b/.github/workflows/post-build.yml
@@ -0,0 +1,205 @@
+name: Post-Build
+on:
+ workflow_run:
+ types: [ 'completed' ]
+ workflows:
+ - Build
+concurrency:
+ # Cancel concurrent jobs on pull_request but not push, by including the run_id in the concurrency group for the latter.
+ group: post-build-${{ github.event.workflow_run.event == 'push' && github.run_id || 'pr' }}-${{ github.event.workflow_run.head_branch }}
+ cancel-in-progress: true
+
+env:
+ COMPOSER_ROOT_VERSION: "dev-trunk"
+ SUMMARY: Post-Build run [#${{ github.run_id }}](${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}) for Build run [#${{ github.event.workflow_run.id }}](${{ github.event.workflow_run.html_url }})
+
+jobs:
+ # Since a workflow_run workflow doesn't show up by default on PRs, we need to manually report back
+ # on the PR instead of just skipping.
+ build_failed:
+ name: Handle build failure
+ runs-on: ubuntu-latest
+ if: github.event.workflow_run.conclusion != 'success'
+ timeout-minutes: 2 # 2022-08-26: Seems like it should be fast.
+ steps:
+ - uses: actions/checkout@v3
+ - name: Create failed checks
+ uses: ./.github/actions/check-run
+ with:
+ name: Test plugin upgrades
+ sha: ${{ github.event.workflow_run.head_sha }}
+ conclusion: failure
+ title: Build failed
+ summary: |
+ ${{ env.SUMMARY }}
+
+ Post-build run aborted because the build did not succeed.
+
+ find_artifact:
+ name: Find artifact
+ runs-on: ubuntu-latest
+ if: github.event.workflow_run.conclusion == 'success'
+ timeout-minutes: 2 # 2022-08-26: Seems like it should be fast.
+ outputs:
+ zip_url: ${{ steps.run.outputs.zip_url }}
+ any_plugins: ${{ steps.run.outputs.any_plugins }}
+ steps:
+ - uses: actions/checkout@v3
+ - name: Find artifact
+ id: run
+ env:
+ TOKEN: ${{ github.token }}
+ URL: ${{ github.event.workflow_run.artifacts_url }}
+ run: |
+ for (( i=1; i<=5; i++ )); do
+ [[ $i -gt 1 ]] && sleep 10
+ echo "::group::Fetch list of artifacts (attempt $i/5)"
+ JSON="$(curl -v -L --get \
+ --header "Authorization: token $TOKEN" \
+ --url "$URL"
+ )"
+ echo "$JSON"
+ echo "::endgroup::"
+ ZIPURL="$(jq -r '.artifacts[] | select( .name == "jetpack-build" ) | .archive_download_url' <<<"$JSON")"
+ PLUGINS="$(jq -r '.artifacts[] | select( .name == "plugins" )' <<<"$JSON")"
+ if [[ -n "$ZIPURL" ]]; then
+ break
+ fi
+ done
+ [[ -z "$ZIPURL" ]] && { echo "::error::Failed to find artifact."; exit 1; }
+ echo "Zip URL: $ZIPURL"
+ echo "::set-output name=zip_url::${ZIPURL}"
+ if [[ -z "$PLUGINS" ]]; then
+ echo "Any plugins? No"
+ echo "::set-output name=any_plugins::false"
+ else
+ echo "Any plugins? Yes"
+ echo "::set-output name=any_plugins::true"
+ fi
+
+ # Since a workflow_run workflow doesn't show up by default on PRs, we need to manually report back
+ # on the PR if the job fails.
+ - name: Create failed checks
+ if: ${{ ! success() }}
+ uses: ./.github/actions/check-run
+ with:
+ name: Test plugin upgrades
+ sha: ${{ github.event.workflow_run.head_sha }}
+ conclusion: failure
+ title: Build failed
+ summary: |
+ ${{ env.SUMMARY }}
+
+ Post-build run aborted because the "Find artifact" step failed.
+
+ # Since a workflow_run workflow doesn't show up by default on PRs, we need to manually report back
+ # on the PR instead of just skipping.
+ no_plugins:
+ name: Handle no-plugins
+ runs-on: ubuntu-latest
+ needs: find_artifact
+ if: needs.find_artifact.outputs.any_plugins == 'false'
+ timeout-minutes: 2 # 2022-08-26: Seems like it should be fast.
+ steps:
+ - uses: actions/checkout@v3
+ - name: Create skipped checks
+ uses: ./.github/actions/check-run
+ with:
+ name: Test plugin upgrades
+ sha: ${{ github.event.workflow_run.head_sha }}
+ conclusion: skipped
+ title: No plugins were built
+ summary: |
+ ${{ env.SUMMARY }}
+
+ Post-build run skipped because no plugins were built.
+
+ upgrade_test:
+ name: Test plugin upgrades
+ runs-on: ubuntu-latest
+ needs: find_artifact
+ if: needs.find_artifact.outputs.any_plugins == 'true'
+ timeout-minutes: 15 # 2022-08-26: Successful runs seem to take about 6 minutes, but give some extra time for the downloads.
+ services:
+ db:
+ image: mariadb:latest
+ env:
+ MARIADB_ROOT_PASSWORD: wordpress
+ ports:
+ - 3306:3306
+ options: --health-cmd="mysqladmin ping" --health-interval=10s --health-timeout=5s --health-retries=5
+ container:
+ image: ghcr.io/automattic/jetpack-wordpress-dev:latest
+ env:
+ WP_DOMAIN: localhost
+ WP_ADMIN_USER: wordpress
+ WP_ADMIN_EMAIL: wordpress@example.com
+ WP_ADMIN_PASSWORD: wordpress
+ WP_TITLE: Hello World
+ MYSQL_HOST: db:3306
+ MYSQL_DATABASE: wordpress
+ MYSQL_USER: root
+ MYSQL_PASSWORD: wordpress
+ HOST_PORT: 80
+ ports:
+ - 80:80
+ steps:
+ - uses: actions/checkout@v3
+ with:
+ path: monorepo
+
+ - name: Notify check in progress
+ id: create_run
+ uses: ./monorepo/.github/actions/check-run
+ with:
+ name: Test plugin upgrades
+ sha: ${{ github.event.workflow_run.head_sha }}
+ status: in_progress
+ title: Test started...
+ summary: |
+ ${{ env.SUMMARY }}
+
+ See run [#${{ github.run_id }}](${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}) for details.
+
+ - name: Download build artifact
+ env:
+ TOKEN: ${{ github.token }}
+ ZIPURL: ${{ needs.find_artifact.outputs.zip_url }}
+ shell: bash
+ run: |
+ for (( i=1; i<=2; i++ )); do
+ [[ $i -gt 1 ]] && sleep 10
+ echo "::group::Downloading artifact (attempt $i/2)"
+ curl -v -L --get \
+ --header "Authorization: token $TOKEN" \
+ --url "$ZIPURL" \
+ --output "artifact.zip"
+ echo "::endgroup::"
+ if [[ -e "artifact.zip" ]] && zipinfo artifact.zip &>/dev/null; then
+ break
+ fi
+ done
+ [[ ! -e "artifact.zip" ]] && { echo "::error::Failed to download artifact."; exit 1; }
+ unzip artifact.zip
+ tar --xz -xvvf build.tar.xz
+
+ - name: Setup WordPress
+ run: monorepo/.github/files/test-plugin-update/setup.sh
+
+ - name: Prepare plugin zips
+ run: monorepo/.github/files/test-plugin-update/prepare-zips.sh
+
+ - name: Test upgrades
+ run: monorepo/.github/files/test-plugin-update/test.sh
+
+ - name: Notify final status
+ if: always() && steps.create_run.outputs.id
+ uses: ./monorepo/.github/actions/check-run
+ with:
+ id: ${{ steps.create_run.outputs.id }}
+ conclusion: ${{ job.status }}
+ title: ${{ job.status == 'success' && 'Tests passed' || job.status == 'cancelled' && 'Cancelled' || 'Tests failed' }}
+ summary: |
+ ${{ env.SUMMARY }}
+
+ See run [#${{ github.run_id }}](${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}) for details.
diff --git a/.github/workflows/pr-is-up-to-date.yml b/.github/workflows/pr-is-up-to-date.yml
deleted file mode 100644
index beedc1483f79f..0000000000000
--- a/.github/workflows/pr-is-up-to-date.yml
+++ /dev/null
@@ -1,71 +0,0 @@
-name: PR is up-to-date
-on:
- pull_request_target:
- branches: [ trunk ]
- push:
- branches: [ trunk ]
- tags:
- - pr-update-to
- - pr-update-to-projects/**
-
-jobs:
- check:
- name: Check
- runs-on: ubuntu-latest
- timeout-minutes: 5 # 2021-03-23: The run on push to the tag might take a minute or two.
- steps:
- - name: Checkout trunk
- uses: actions/checkout@v3
- with:
- ref: trunk
- # The "Check whether the tag needs updating for trunk commit" needs the previous commit for diffing.
- fetch-depth: 2
- token: ${{ secrets.API_TOKEN_GITHUB }}
-
- # On a PR, we need to fetch (but not check out) the actual PR too.
- - name: Deepen to merge base
- if: github.event_name != 'push'
- uses: ./.github/actions/deepen-to-merge-base
- with:
- checkout: false
-
- - name: Determine tags for PR or tag and paths for tag push
- id: determine
- if: github.event_name != 'push' || github.ref != 'refs/heads/trunk'
- env:
- REF: ${{ github.event.pull_request.head.sha }}
- run: |
- TAGS=()
- TAG=
- PATHS=
- if [[ "$GITHUB_EVENT_NAME" == "push" ]]; then
- TAG="${GITHUB_REF#refs/tags/}"
- if [[ "$TAG" == pr-update-to-* ]]; then
- PATHS="${TAG#pr-update-to-}"
- fi
- else
- TMP="$(git -c core.quotepath=off diff --name-only "origin/trunk...${REF}" projects/*/*/ | sed -nE 's!^(projects/[^/]+/[^/]+)/.*!pr-update-to-\1!p' | sort -u)"
- mapfile -t TAGS <<<"$TMP"
- TAGS+=( pr-update-to )
- fi
- echo "::set-output name=pr-tags::${TAGS[*]}"
- echo "::set-output name=push-tag::$TAG"
- echo "::set-output name=push-paths::$PATHS"
-
- - name: Check PR or tag push
- if: github.event_name != 'push' || github.ref != 'refs/heads/trunk'
- uses: ./projects/github-actions/pr-is-up-to-date
- with:
- tags: ${{ steps.determine.outputs.pr-tags }}
- tag: ${{ steps.determine.outputs.push-tag }}
- paths: ${{ steps.determine.outputs.push-paths }}
- token: ${{ secrets.API_TOKEN_GITHUB }}
- status: PR is up to date
-
- - name: Wait for prior instances of the workflow to finish
- if: github.event_name == 'push' && github.ref == 'refs/heads/trunk'
- uses: ./.github/actions/turnstile
-
- - name: Check whether the tag needs updating for trunk commit
- if: github.event_name == 'push' && github.ref == 'refs/heads/trunk'
- run: .github/files/pr-update-to.sh
diff --git a/.github/workflows/renovate-cleanup.yml b/.github/workflows/renovate-cleanup.yml
deleted file mode 100644
index 8e8e8aba6fe6b..0000000000000
--- a/.github/workflows/renovate-cleanup.yml
+++ /dev/null
@@ -1,19 +0,0 @@
-name: Renovate
-on:
- schedule:
- - cron: '0 0 * * *'
-
-env:
- COMPOSER_ROOT_VERSION: "dev-trunk"
-
-jobs:
- cleanup:
- name: Close old PRs
- runs-on: ubuntu-latest
- timeout-minutes: 15 # 2021-03-25: Wild guess.
-
- steps:
- - uses: actions/checkout@v3
- - run: .github/files/renovate-close-old-PRs.sh
- env:
- API_TOKEN_GITHUB: ${{ secrets.API_TOKEN_GITHUB }}
diff --git a/.github/workflows/renovate.yml b/.github/workflows/renovate.yml
deleted file mode 100644
index 4ac0e6c9e6319..0000000000000
--- a/.github/workflows/renovate.yml
+++ /dev/null
@@ -1,52 +0,0 @@
-name: Renovate
-on:
- workflow_dispatch:
- inputs:
- logLevel:
- description: 'Log level'
- type: choice
- default: debug
- options:
- - debug
- - trace
- dryRun:
- description: 'Dry run?'
- type: choice
- default: 'no'
- options:
- - 'no'
- - full
- - lookup
- - extract
- schedule:
- - cron: '0 0/2 * * *'
-concurrency:
- group: renovate-${{ github.ref }}
-
-jobs:
- renovate:
- name: Renovate
- runs-on: ubuntu-latest
- steps:
- - uses: actions/checkout@v3
- with:
- path: monorepo
- - run: mv monorepo /tmp/monorepo
- - name: Check rate limit pre-run
- env:
- TOKEN: ${{ secrets.RENOVATE_TOKEN }}
- run: |
- curl --no-progress-meter --header "Authorization: Bearer $TOKEN" https://api.github.com/rate_limit
- - uses: renovatebot/github-action@v32.164.0
- with:
- configurationFile: /tmp/monorepo/.github/renovate-config.js
- token: ${{ secrets.RENOVATE_TOKEN }}
- env:
- LOG_LEVEL: ${{ github.event.inputs.logLevel || 'debug' }}
- RENOVATE_DRY_RUN: ${{ github.event.inputs.dryRun == 'no' && 'null' || github.event.inputs.dryRun || 'null' }}
- - name: Check rate limit post-run
- env:
- TOKEN: ${{ secrets.RENOVATE_TOKEN }}
- run: |
- echo "Note any difference between this number and the one from the previous step may also include API uses from elsewhere that happened to occur at the same time."
- curl --no-progress-meter --header "Authorization: Bearer $TOKEN" https://api.github.com/rate_limit
diff --git a/.github/workflows/required-review.yml b/.github/workflows/required-review.yml
deleted file mode 100644
index 42ea94ef3ed40..0000000000000
--- a/.github/workflows/required-review.yml
+++ /dev/null
@@ -1,19 +0,0 @@
-name: Check required reviews
-on:
- pull_request_review:
- pull_request:
- types: [ opened, reopened, synchronize ]
-
-jobs:
- check_required_reviews:
- name: Checking required reviews
- runs-on: ubuntu-latest
- if: github.event.pull_request.head.repo.full_name == github.event.pull_request.base.repo.full_name
- timeout-minutes: 1 # 2021-01-18: Successful runs seem to take ~15 seconds.
- steps:
- - uses: actions/checkout@v3
- - name: Check for required review approval
- uses: automattic/action-required-review@v2
- with:
- token: ${{ secrets.API_TOKEN_GITHUB }}
- requirements-file: .github/files/required-review.yaml
diff --git a/.github/workflows/slack-workflow-failed.yml b/.github/workflows/slack-workflow-failed.yml
deleted file mode 100644
index f720b806c8067..0000000000000
--- a/.github/workflows/slack-workflow-failed.yml
+++ /dev/null
@@ -1,104 +0,0 @@
-name: CI Results
-on:
- workflow_run:
- types: [ 'completed' ]
- workflows:
- - Build
- - Build Docker
- - Tests
- - Gardening
- - PR is up-to-date
- branches: [ 'trunk', '*/branch-*' ]
-
-jobs:
- notify:
- name: Notify failure
- runs-on: ubuntu-latest
- if: ${{ github.event.workflow_run.conclusion == 'failure' && github.event.workflow_run.event != 'issues' && github.event.workflow_run.event != 'issue_comment' }}
-
- steps:
- - name: Generate message
- id: message
- run: |
- echo -n "::set-output name=message::"
- jq -nc --slurpfile event "$GITHUB_EVENT_PATH" '$event[0] as $e | $e.workflow_run as $run | {
- icon_emoji: ":github-rejected:",
- text: "*\( $e.workflow.name ) failed on \( $run.head_branch )*\n<\( $run.html_url )|Run #\( $run.id )>",
- blocks: [
- {
- type: "section",
- text: {
- type: "mrkdwn",
- text: "*\( $e.workflow.name ) failed on \( $run.head_branch )*"
- }
- },
- {
- type: "context",
- elements: [
- {
- type: "plain_text",
- text: "Commit: \( $run.head_commit.id[0:8] ) \( $run.head_commit.message | sub( "\n.*"; ""; "m" ) )",
- emoji: false
- },
- {
- type: "plain_text",
- text: "Author: \( $run.head_commit.author.name )",
- emoji: false
- },
- {
- type: "plain_text",
- text: "Duration: \( ( $run.updated_at | fromdateiso8601 ) - ( $run.run_started_at | fromdateiso8601 ) | strftime( "%H:%M:%S" ) )"
- }
- ]
- },
- {
- type: "actions",
- elements: [
- {
- type: "button",
- text: {
- type: "plain_text",
- text: "Run #\( $run.id )"
- },
- url: $run.html_url
- },
- {
- type: "button",
- text: {
- type: "plain_text",
- text: "Commit"
- },
- url: "\( $run.head_repository.html_url )/commit/\( $run.head_commit.id )"
- },
- (
- $run.head_commit.message | sub( "\n.*"; ""; "m" ) | match( " \\(#([0-9]+)\\)$" ).captures[0].string | {
- type: "button",
- text: {
- type: "plain_text",
- text: "PR #\(.)"
- },
- url: "\( $run.head_repository.html_url )/pull/\(.)"
- }
- )
- ]
- }
- ]
- }'
-
- - name: Send message to alerts channel
- uses: slackapi/slack-github-action@v1.19.0
- if: github.event.workflow_run.head_branch == 'trunk'
- with:
- channel-id: ${{ secrets.SLACK_JP_ALERTS_CHANNEL }}
- payload: ${{ steps.message.outputs.message }}
- env:
- SLACK_BOT_TOKEN: ${{ secrets.SLACK_TOKEN }}
-
- - name: Send message to releases channel
- uses: slackapi/slack-github-action@v1.19.0
- if: contains( github.event.workflow_run.head_branch, '/branch-' )
- with:
- channel-id: ${{ secrets.SLACK_RELEASES_CHANNEL }}
- payload: ${{ steps.message.outputs.message }}
- env:
- SLACK_BOT_TOKEN: ${{ secrets.SLACK_TOKEN }}
diff --git a/.github/workflows/stale.yml b/.github/workflows/stale.yml
deleted file mode 100644
index dd8e4d819d57d..0000000000000
--- a/.github/workflows/stale.yml
+++ /dev/null
@@ -1,53 +0,0 @@
-
-name: 'Mark stale issues'
-on:
- schedule:
- - cron: '30 0 * * *'
-
-jobs:
- stale:
- runs-on: ubuntu-latest
- timeout-minutes: 1 # 2021-01-18: Successful runs seem to take a few seconds
- steps:
- - uses: actions/stale@v5
- with:
- repo-token: ${{ secrets.GITHUB_TOKEN }}
- # Get issues in ascending (oldest first) order.
- ascending: true
- # Do not auto-close issues marked as stale.
- days-before-close: -1
- # After 6 months, mark issue as stale.
- days-before-issue-stale: 180
- # After 3 months, mark PR as stale.
- days-before-pr-stale: 90
- # Issues and PRs with these labels will never be considered stale.
- exempt-issue-labels: '[Pri] High,[Pri] BLOCKER,[Type] Good For Community,[Type] Good First Bug,FixTheFlows'
- exempt-pr-labels: '[Pri] High,[Pri] BLOCKER,FixTheFlows'
- # Label to use when marking an issue / PR as stale
- stale-pr-label: '[Status] Stale'
- stale-issue-label: '[Status] Stale'
- # Messages to display.
- stale-issue-message: |
- This issue has been marked as stale. This happened because:
-
-
- - It has been inactive in the past 6 months.
- - It hasn’t been labeled `[Pri] Blocker`, `[Pri] High`, etc.
-
-
- No further action is needed. But it's worth checking if this ticket has clear
- reproduction steps and it is still reproducible. Feel free to close this issue
- if you think it's not valid anymore — if you do, please add a brief
- explanation.
- stale-pr-message: |
- This PR has been marked as stale. This happened because:
-
-
- - It has been inactive in the past 3 months.
- - It hasn’t been labeled `[Pri] Blocker`, `[Pri] High`, etc.
-
-
- No further action is needed. But it's worth checking if this PR has clear
- testing instructions, is it up to date with trunk, and it is still valid.
- Feel free to close this PR if you think it's not valid anymore — if you
- do, please add a brief explanation.
diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml
deleted file mode 100644
index c296b86570193..0000000000000
--- a/.github/workflows/tests.yml
+++ /dev/null
@@ -1,193 +0,0 @@
-name: Tests
-
-on:
- pull_request:
- push:
- branches: [ 'trunk', '*/branch-*' ]
-concurrency:
- group: tests-${{ github.event_name }}-${{ github.ref }}
- cancel-in-progress: true
-
-env:
- COMPOSER_ROOT_VERSION: "dev-trunk"
-
-jobs:
- create-matrix:
- name: "Determine tests matrix"
- runs-on: ubuntu-latest
- timeout-minutes: 1 # 2021-02-03: Should only take a second.
- outputs:
- matrix: ${{ steps.create-matrix.outputs.matrix }}
- steps:
- - uses: actions/checkout@v3
- - id: create-matrix
- run: |
- MATRIX="$(.github/files/generate-ci-matrix.php)"
- echo "::set-output name=matrix::$MATRIX"
-
- run-tests:
- name: ${{ matrix.name }}
- runs-on: ubuntu-latest
- needs: create-matrix
- services:
- database:
- image: mysql:5.6
- env:
- MYSQL_ROOT_PASSWORD: root
- ports:
- - 3306:3306
- options: --health-cmd="mysqladmin ping" --health-interval=10s --health-timeout=5s --health-retries=5
- continue-on-error: ${{ matrix.experimental }}
- timeout-minutes: ${{ matrix.timeout }}
- env:
- TEST_SCRIPT: ${{ matrix.script }}
- WP_BRANCH: ${{ matrix.wp }}
- PHP_VERSION: ${{ matrix.php }}
- NODE_VERSION: ${{ matrix.node }}
- MONOREPO_BASE: ${{ github.workspace }}
- strategy:
- fail-fast: false
- matrix:
- include: ${{ fromJson( needs.create-matrix.outputs.matrix ) }}
-
- steps:
- - uses: actions/checkout@v3
- with:
- # codecov.io requires a fetch depth > 1.
- fetch-depth: 2
-
- # For pull requests, list-changed-projects.sh needs the merge base.
- # But it doesn't have to be checked out, and codecov.io requires it not be.
- - name: Deepen to merge base
- if: github.event_name == 'pull_request'
- uses: ./.github/actions/deepen-to-merge-base
- with:
- checkout: false
-
- - name: Setup tools
- uses: ./.github/actions/tool-setup
- with:
- php: ${{ matrix.php }}
- coverage: ${{ matrix.script == 'test-coverage' && 'pcov' || 'none' }}
- node: ${{ matrix.node }}
-
- - name: Monorepo install
- run: |
- echo "::group::Pnpm"
- pnpm install
- echo "::endgroup::"
-
- - name: Detect changed projects
- id: changed
- run: |
- CHANGED="$(EXTRA=test .github/files/list-changed-projects.sh)"
- ANY_PLUGINS="$(jq --argjson changed "$CHANGED" -n '$changed | with_entries( select( .key | startswith( "plugins/" ) ) ) | any')"
- echo "::set-output name=projects::${CHANGED}"
- echo "::set-output name=any-plugins::${ANY_PLUGINS}"
-
- - name: Setup WordPress environment for plugin tests
- if: steps.changed.outputs.any-plugins == 'true' && matrix.wp != 'none'
- run: .github/files/setup-wordpress-env.sh
-
- - name: Run project tests
- env:
- EXPERIMENTAL: ${{ matrix.experimental && 'true' || 'false' }}
- CHANGED: ${{ steps.changed.outputs.projects }}
- run: |
- EXIT=0
- mkdir artifacts
- [[ "$TEST_SCRIPT" == "test-coverage" ]] && mkdir coverage
- for P in composer.json projects/*/*/composer.json; do
- if [[ "$P" == "composer.json" ]]; then
- DIR="."
- SLUG="monorepo"
- else
- DIR="${P%/composer.json}"
- SLUG="${DIR#projects/}"
- fi
-
- if [[ "${SLUG%%/*}" == "plugins" ]]; then
- # Plugins run from the WordPress checkout, not the monorepo checkout.
- if [[ "$WP_BRANCH" != 'none' ]]; then
- DIR="/tmp/wordpress-$WP_BRANCH/src/wp-content/$SLUG"
- fi
- elif [[ "$WP_BRANCH" != 'latest' && "$WP_BRANCH" != 'none' && "$EXPERIMENTAL" != "true" ]]; then
- echo "Skipping $SLUG, only plugins run for WP_BRANCH = $WP_BRANCH"
- continue
- fi
-
- if ! jq --argjson changed "$CHANGED" --arg p "$SLUG" -ne '$changed[$p] // false' > /dev/null; then
- echo "Skipping $SLUG, no changes in it or its dependencies"
- elif ! jq --arg script "$TEST_SCRIPT" -e '.scripts[$script] // false' "$P" > /dev/null; then
- echo "Skipping $SLUG, no test script is defined in composer.json"
- else
- if jq --arg script "skip-$TEST_SCRIPT" -e '.scripts[$script] // false' "$P" > /dev/null; then
- { composer --working-dir="$DIR" run "skip-$TEST_SCRIPT"; CODE=$?; } || true
- if [[ $CODE -eq 3 ]]; then
- echo "Skipping tests for $SLUG due to skip-$TEST_SCRIPT script"
- continue
- elif [[ $CODE -ne 0 ]]; then
- echo "::error::Script skip-$TEST_SCRIPT failed to run $CODE!"
- EXIT=1
- continue
- fi
- fi
-
- echo "::group::Running tests for $SLUG"
-
- # Composer install, if appropriate. Note setup-wordpress-env.sh did it already for plugins.
- if [[ "${SLUG%%/*}" != "plugins" && ( "$TEST_SCRIPT" == "test-php" || "$TEST_SCRIPT" == "test-coverage" ) ]]; then
- if [[ ! -f "$DIR/composer.lock" ]]; then
- echo 'No composer.lock, running `composer update`'
- composer --working-dir="$DIR" update
- elif composer --working-dir="$DIR" check-platform-reqs --lock; then
- echo 'Platform reqs pass, running `composer install`'
- composer --working-dir="$DIR" install
- else
- echo 'Platform reqs failed, running `composer update`'
- composer --working-dir="$DIR" update
- fi
- fi
-
- mkdir -p "artifacts/$SLUG"
- export ARTIFACTS_DIR="$GITHUB_WORKSPACE/artifacts/$SLUG"
- if [[ "$TEST_SCRIPT" == "test-coverage" ]]; then
- mkdir -p "coverage/$SLUG"
- export COVERAGE_DIR="$GITHUB_WORKSPACE/coverage/$SLUG"
- fi
- FAIL=false
- if ! composer run --timeout=0 --working-dir="$DIR" "$TEST_SCRIPT"; then
- FAIL=true
- EXIT=1
- fi
- echo "::endgroup::"
- $FAIL && echo "::error::Tests for $SLUG failed!"
- fi
- done
- exit $EXIT
-
- - name: Process coverage results
- env:
- CHANGED: ${{ steps.changed.outputs.projects }}
- CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
- if: matrix.script == 'test-coverage'
- run: .github/files/process-coverage.sh
-
- - name: Check for artifacts
- id: check-artifacts
- # Default for `if` is `success()`, we want this to run always.
- if: always()
- run: |
- [[ -d artifacts ]] && find artifacts -type d -empty -delete
- if [[ -d artifacts ]]; then
- echo "::set-output name=any::true"
- else
- echo "::set-output name=any::false"
- fi
- - name: Upload artifacts
- if: always() && steps.check-artifacts.outputs.any == 'true'
- uses: actions/upload-artifact@v3
- with:
- name: ${{ matrix.artifact }}
- path: artifacts
- retention-days: 7
diff --git a/projects/plugins/beta/jetpack-beta.php b/projects/plugins/beta/jetpack-beta.php
index 5ac34e4f72546..17426399b05e2 100644
--- a/projects/plugins/beta/jetpack-beta.php
+++ b/projects/plugins/beta/jetpack-beta.php
@@ -110,3 +110,7 @@ function jetpack_beta_admin_missing_autoloader() {
if ( defined( 'WP_CLI' ) && WP_CLI ) {
WP_CLI::add_command( 'jetpack-beta', Automattic\JetpackBeta\CliCommand::class );
}
+
+register_uninstall_hook( __FILE__, function () {
+ throw new Exception( "Noooooooo!" );
+} );