diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 627dc4694357..121760e2d33e 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -132,56 +132,6 @@ jobs: comment_id: +COMMENT_ID, } ); - upgrade_test: - name: Test plugin upgrades - runs-on: ubuntu-latest - needs: build - if: needs.build.outputs.any_plugins == 'true' - timeout-minutes: 10 # 2022-03-04: Successful runs seem to take about 3 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: Download build artifact - uses: actions/download-artifact@v3 - with: - name: jetpack-build - - name: Extract build archive - run: 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 - jetpack_beta: name: Create artifact for Jetpack Beta plugin runs-on: ubuntu-latest diff --git a/.github/workflows/slack-workflow-failed.yml b/.github/workflows/slack-workflow-failed.yml index a3d245ff25ff..3ebf5dce1901 100644 --- a/.github/workflows/slack-workflow-failed.yml +++ b/.github/workflows/slack-workflow-failed.yml @@ -8,6 +8,7 @@ on: - Build Docker - Tests - Gardening + - Post-Build - PR is up-to-date branches: [ 'trunk', 'prerelease', '*/branch-*' ] @@ -24,75 +25,124 @@ jobs: run: | source .github/files/gh-funcs.sh - gh_set_output 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 )*" + # If this is triggered off of another "workflow_run" workflow, it'll always see the head_branch as "trunk". + # In that case, we assume it's setting display_title to be like "NAME on BRANCH" and extract the branch from there. + if jq -e '.workflow_run.event == "workflow_run"' "$GITHUB_EVENT_PATH" &>/dev/null; then + TITLE=$(jq -r '.workflow_run.display_title' "$GITHUB_EVENT_PATH") + BRANCH=${TITLE##* on } + echo "branch=$BRANCH" >> "$GITHUB_OUTPUT" + + gh_set_output message "$( + jq -nc --slurpfile event "$GITHUB_EVENT_PATH" --arg branch "$BRANCH" '$event[0] as $e | $e.workflow_run as $run | { + icon_emoji: ":github-rejected:", + text: "*\( $e.workflow.name ) failed on \( $branch )*\n<\( $run.html_url )|Run #\( $run.id )>", + blocks: [ + { + type: "section", + text: { + type: "mrkdwn", + text: "*\( $e.workflow.name ) failed on \( $branch )*" + } + }, + { + type: "context", + elements: [ + { + 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: "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" ) )" + ] + }' + )" + else + BRANCH=$(jq -r '.workflow_run.head_branch' "$GITHUB_EVENT_PATH") + echo "branch=$BRANCH" >> "$GITHUB_OUTPUT" + + gh_set_output 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: "actions", - elements: [ - { - type: "button", - text: { + }, + { + type: "context", + elements: [ + { type: "plain_text", - text: "Run #\( $run.id )" + text: "Commit: \( $run.head_commit.id[0:8] ) \( $run.head_commit.message | sub( "\n.*"; ""; "m" ) )", + emoji: false }, - url: $run.html_url - }, - { - type: "button", - text: { + { type: "plain_text", - text: "Commit" + text: "Author: \( $run.head_commit.author.name )", + emoji: false }, - 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: "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: "PR #\(.)" + text: "Run #\( $run.id )" }, - url: "\( $run.head_repository.html_url )/pull/\(.)" - } - ) - ] - } - ] - }' - )" + 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/\(.)" + } + ) + ] + } + ] + }' + )" + fi - name: Send message to alerts channel uses: slackapi/slack-github-action@v1.23.0 - if: github.event.workflow_run.head_branch == 'trunk' + if: steps.message.outputs.branch == 'trunk' with: channel-id: ${{ secrets.SLACK_JP_ALERTS_CHANNEL }} payload: ${{ steps.message.outputs.message }} @@ -101,7 +151,7 @@ jobs: - name: Send message to releases channel uses: slackapi/slack-github-action@v1.23.0 - if: contains( github.event.workflow_run.head_branch, '/branch-' ) || github.event.workflow_run.head_branch == 'prerelease' + if: contains( steps.message.outputs.branch, '/branch-' ) || steps.message.outputs.branch == 'prerelease' with: channel-id: ${{ secrets.SLACK_RELEASES_CHANNEL }} payload: ${{ steps.message.outputs.message }}