<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head><meta http-equiv="content-type" content="text/html; charset=utf-8" />
<title>[59815] trunk/.github/workflows: Build/Test Tools: Add a workflow that tests the process of upgrading WordPress to a build of the current branch.</title>
</head>
<body>

<style type="text/css"><!--
#msg dl.meta { border: 1px #006 solid; background: #369; padding: 6px; color: #fff; }
#msg dl.meta dt { float: left; width: 6em; font-weight: bold; }
#msg dt:after { content:':';}
#msg dl, #msg dt, #msg ul, #msg li, #header, #footer, #logmsg { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt;  }
#msg dl a { font-weight: bold}
#msg dl a:link    { color:#fc3; }
#msg dl a:active  { color:#ff0; }
#msg dl a:visited { color:#cc6; }
h3 { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; font-weight: bold; }
#msg pre { white-space: pre-line; overflow: auto; background: #ffc; border: 1px #fa0 solid; padding: 6px; }
#logmsg { background: #ffc; border: 1px #fa0 solid; padding: 1em 1em 0 1em; }
#logmsg p, #logmsg pre, #logmsg blockquote { margin: 0 0 1em 0; }
#logmsg p, #logmsg li, #logmsg dt, #logmsg dd { line-height: 14pt; }
#logmsg h1, #logmsg h2, #logmsg h3, #logmsg h4, #logmsg h5, #logmsg h6 { margin: .5em 0; }
#logmsg h1:first-child, #logmsg h2:first-child, #logmsg h3:first-child, #logmsg h4:first-child, #logmsg h5:first-child, #logmsg h6:first-child { margin-top: 0; }
#logmsg ul, #logmsg ol { padding: 0; list-style-position: inside; margin: 0 0 0 1em; }
#logmsg ul { text-indent: -1em; padding-left: 1em; }#logmsg ol { text-indent: -1.5em; padding-left: 1.5em; }
#logmsg > ul, #logmsg > ol { margin: 0 0 1em 0; }
#logmsg pre { background: #eee; padding: 1em; }
#logmsg blockquote { border: 1px solid #fa0; border-left-width: 10px; padding: 1em 1em 0 1em; background: white;}
#logmsg dl { margin: 0; }
#logmsg dt { font-weight: bold; }
#logmsg dd { margin: 0; padding: 0 0 0.5em 0; }
#logmsg dd:before { content:'\00bb';}
#logmsg table { border-spacing: 0px; border-collapse: collapse; border-top: 4px solid #fa0; border-bottom: 1px solid #fa0; background: #fff; }
#logmsg table th { text-align: left; font-weight: normal; padding: 0.2em 0.5em; border-top: 1px dotted #fa0; }
#logmsg table td { text-align: right; border-top: 1px dotted #fa0; padding: 0.2em 0.5em; }
#logmsg table thead th { text-align: center; border-bottom: 1px solid #fa0; }
#logmsg table th.Corner { text-align: left; }
#logmsg hr { border: none 0; border-top: 2px dashed #fa0; height: 1px; }
#header, #footer { color: #fff; background: #636; border: 1px #300 solid; padding: 6px; }
#patch { width: 100%; }
#patch h4 {font-family: verdana,arial,helvetica,sans-serif;font-size:10pt;padding:8px;background:#369;color:#fff;margin:0;}
#patch .propset h4, #patch .binary h4 {margin:0;}
#patch pre {padding:0;line-height:1.2em;margin:0;}
#patch .diff {width:100%;background:#eee;padding: 0 0 10px 0;overflow:auto;}
#patch .propset .diff, #patch .binary .diff  {padding:10px 0;}
#patch span {display:block;padding:0 10px;}
#patch .modfile, #patch .addfile, #patch .delfile, #patch .propset, #patch .binary, #patch .copfile {border:1px solid #ccc;margin:10px 0;}
#patch ins {background:#dfd;text-decoration:none;display:block;padding:0 10px;}
#patch del {background:#fdd;text-decoration:none;display:block;padding:0 10px;}
#patch .lines, .info {color:#888;background:#fff;}
--></style>
<div id="msg">
<dl class="meta" style="font-size: 105%">
<dt style="float: left; width: 6em; font-weight: bold">Revision</dt> <dd><a style="font-weight: bold" href="https://core.trac.wordpress.org/changeset/59815">59815</a><script type="application/ld+json">{"@context":"http://schema.org","@type":"EmailMessage","description":"Review this Commit","action":{"@type":"ViewAction","url":"https://core.trac.wordpress.org/changeset/59815","name":"Review Commit"}}</script></dd>
<dt style="float: left; width: 6em; font-weight: bold">Author</dt> <dd>johnbillion</dd>
<dt style="float: left; width: 6em; font-weight: bold">Date</dt> <dd>2025-02-12 14:59:06 +0000 (Wed, 12 Feb 2025)</dd>
</dl>

<pre style='padding-left: 1em; margin: 2em 0; border-left: 2px solid #ccc; line-height: 1.25; font-size: 105%; font-family: sans-serif'>Build/Test Tools: Add a workflow that tests the process of upgrading WordPress to a build of the current branch.

This complements the existing workflow which tests upgrading to an already released version.

Props johnbillion, peterwilsoncc, mukesh27, desrosj, audrasjb, joemcgill.

See <a href="https://core.trac.wordpress.org/ticket/62221">#62221</a></pre>

<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkgithubworkflowsreusableupgradetestingyml">trunk/.github/workflows/reusable-upgrade-testing.yml</a></li>
</ul>

<h3>Added Paths</h3>
<ul>
<li><a href="#trunkgithubworkflowsreusablebuildpackageyml">trunk/.github/workflows/reusable-build-package.yml</a></li>
<li><a href="#trunkgithubworkflowsupgradedeveloptestingyml">trunk/.github/workflows/upgrade-develop-testing.yml</a></li>
</ul>

</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkgithubworkflowsreusablebuildpackageyml"></a>
<div class="addfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Added: trunk/.github/workflows/reusable-build-package.yml</h4>
<pre class="diff"><span>
<span class="info" style="display: block; padding: 0 10px; color: #888">--- trunk/.github/workflows/reusable-build-package.yml                                (rev 0)
+++ trunk/.github/workflows/reusable-build-package.yml  2025-02-12 14:59:06 UTC (rev 59815)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -0,0 +1,60 @@
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+##
+# A reusable workflow that builds and packages WordPress. The resulting package can be used to test upgrading and installing.
+##
+name: Build and package WordPress
+
+on:
+  workflow_call:
+
+# Disable permissions for all available scopes by default.
+# Any needed permissions should be configured at the job level.
+permissions: {}
+
+jobs:
+  # Builds and packages WordPress.
+  #
+  # Performs the following steps:
+  # - Checks out the repository.
+  # - Sets up Node.js.
+  # - Runs the build script.
+  # - Prepares the directory structure for the ZIP.
+  # - Creates a ZIP of the built files.
+  # - Uploads the ZIP as a GitHub Actions artifact.
+  build:
+    name: WordPress
+    permissions:
+      contents: read
+    runs-on: ubuntu-24.04
+    timeout-minutes: 20
+
+    steps:
+      - name: Checkout repository
+        uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
+        with:
+          show-progress: ${{ runner.debug == '1' && 'true' || 'false' }}
+          persist-credentials: false
+
+      - name: Set up Node.js
+        uses: actions/setup-node@1d0ff469b7ec7b3cb9d8673fde0c81c44821de2a # v4.2.0
+        with:
+          node-version-file: '.nvmrc'
+          cache: npm
+
+      - name: Install npm Dependencies
+        run: npm ci
+
+      - name: Build WordPress
+        run: npm run build
+
+      - name: Prepare the directory structure for the ZIP
+        run: mv build wordpress
+
+      - name: Create ZIP of built files
+        run: zip -q -r develop.zip wordpress/.
+
+      - name: Upload ZIP as a GitHub Actions artifact
+        uses: actions/upload-artifact@65c4c4a1ddee5b72f698fdd19549f0f0fb45cf08 # v4.6.0
+        with:
+          name: wordpress-develop
+          path: develop.zip
+          if-no-files-found: error
</ins><span class="cx" style="display: block; padding: 0 10px">Property changes on: trunk/.github/workflows/reusable-build-package.yml
</span><span class="cx" style="display: block; padding: 0 10px">___________________________________________________________________
</span></span></pre></div>
<a id="svneolstyle"></a>
<div class="addfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Added: svn:eol-style</h4></div>
<ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+native
</ins><span class="cx" style="display: block; padding: 0 10px">\ No newline at end of property
</span><a id="trunkgithubworkflowsreusableupgradetestingyml"></a>
<div class="modfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Modified: trunk/.github/workflows/reusable-upgrade-testing.yml</h4>
<pre class="diff"><span>
<span class="info" style="display: block; padding: 0 10px; color: #888">--- trunk/.github/workflows/reusable-upgrade-testing.yml      2025-02-12 03:38:09 UTC (rev 59814)
+++ trunk/.github/workflows/reusable-upgrade-testing.yml        2025-02-12 14:59:06 UTC (rev 59815)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -14,7 +14,7 @@
</span><span class="cx" style="display: block; padding: 0 10px">         required: true
</span><span class="cx" style="display: block; padding: 0 10px">         type: 'string'
</span><span class="cx" style="display: block; padding: 0 10px">       new-version:
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-        description: 'The version of WordPress to update to.'
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+        description: 'The version of WordPress to update to. Use "latest" to update to the latest version, "develop" to update to the current branch, or provide a specific version number to update to.'
</ins><span class="cx" style="display: block; padding: 0 10px">         type: 'string'
</span><span class="cx" style="display: block; padding: 0 10px">         default: 'latest'
</span><span class="cx" style="display: block; padding: 0 10px">       php:
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -49,8 +49,13 @@
</span><span class="cx" style="display: block; padding: 0 10px">   # - Downloads the specified version of WordPress.
</span><span class="cx" style="display: block; padding: 0 10px">   # - Creates a `wp-config.php` file.
</span><span class="cx" style="display: block; padding: 0 10px">   # - Installs WordPress.
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+  # - Checks the version of WordPress before the upgrade.
</ins><span class="cx" style="display: block; padding: 0 10px">   # - Updates to the latest minor version.
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+  # - Updates the database after the minor update.
+  # - Checks the version of WordPress after the minor update.
</ins><span class="cx" style="display: block; padding: 0 10px">   # - Updates to the version of WordPress being tested.
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+  # - Updates the database.
+  # - Checks the version of WordPress after the upgrade.
</ins><span class="cx" style="display: block; padding: 0 10px">   upgrade-tests:
</span><span class="cx" style="display: block; padding: 0 10px">     name: ${{ inputs.wp }} to ${{ inputs.new-version }} / PHP ${{ inputs.php }} with ${{ 'mariadb' == inputs.db-type && 'MariaDB' || 'MySQL' }} ${{ inputs.db-version }}${{ inputs.multisite && ' multisite' || '' }}
</span><span class="cx" style="display: block; padding: 0 10px">     permissions: {}
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -96,11 +101,38 @@
</span><span class="cx" style="display: block; padding: 0 10px">           --url=http://localhost/ --title="Upgrade Test" --admin_user=admin \
</span><span class="cx" style="display: block; padding: 0 10px">           --admin_password=password --admin_email=me@example.org --skip-email
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+      - name: Pre-upgrade version check
+        run: wp core version
+
</ins><span class="cx" style="display: block; padding: 0 10px">       - name: Update to the latest minor version
</span><span class="cx" style="display: block; padding: 0 10px">         run: wp core update --minor
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+      - name: Update the database after the minor update
+        run: wp core update-db ${{ inputs.multisite && '--network' || '' }}
+
+      - name: Post-upgrade version check after the minor update
+        run: wp core version
+
+      - name: Download build artifact for the current branch
+        if: ${{ inputs.new-version == 'develop' }}
+        uses: actions/download-artifact@fa0a91b85d4f404e444e00e005971372dc801d16 # v4.1.8
+        with:
+          name: wordpress-develop
+
+      - name: Upgrade to WordPress at current branch
+        if: ${{ inputs.new-version == 'develop' }}
+        run: |
+          wp core update develop.zip
+
</ins><span class="cx" style="display: block; padding: 0 10px">       - name: Upgrade to WordPress ${{ inputs.new-version }}
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+        if: ${{ inputs.new-version != 'develop' }}
</ins><span class="cx" style="display: block; padding: 0 10px">         run: |
</span><span class="cx" style="display: block; padding: 0 10px">           wp core update ${{ 'latest' != inputs.new-version && '--version="${WP_VERSION}"' || '' }}
</span><span class="cx" style="display: block; padding: 0 10px">         env:
</span><span class="cx" style="display: block; padding: 0 10px">           WP_VERSION: ${{ inputs.new-version }}
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+
+      - name: Update the database
+        run: wp core update-db ${{ inputs.multisite && '--network' || '' }}
+
+      - name: Post-upgrade version check
+        run: wp core version
</ins></span></pre></div>
<a id="trunkgithubworkflowsupgradedeveloptestingyml"></a>
<div class="addfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Added: trunk/.github/workflows/upgrade-develop-testing.yml</h4>
<pre class="diff"><span>
<span class="info" style="display: block; padding: 0 10px; color: #888">--- trunk/.github/workflows/upgrade-develop-testing.yml                               (rev 0)
+++ trunk/.github/workflows/upgrade-develop-testing.yml 2025-02-12 14:59:06 UTC (rev 59815)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -0,0 +1,129 @@
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+# Confirms that updating WordPress using WP-CLI works successfully.
+#
+# This workflow tests upgrading from a previous version to the current wordpress-develop checkout, not to a version available on WordPress.org.
+name: Upgrade Develop Version Tests
+
+on:
+  push:
+    branches:
+      - trunk
+      - '6.[8-9]'
+      - '[7-9].[0-9]'
+    tags:
+      - '[0-9]+.[0-9]'
+      - '[0-9]+.[0-9].[0-9]+'
+    paths:
+      # Any change to a source PHP file should run checks.
+      - 'src/**.php'
+      # Confirm any changes to relevant workflow files.
+      - '.github/workflows/upgrade-develop-testing.yml'
+      - '.github/workflows/reusable-upgrade-testing.yml'
+  pull_request:
+    branches:
+      - trunk
+      - '6.[8-9]'
+      - '[7-9].[0-9]'
+    paths:
+      # Any change to a source PHP file should run checks.
+      - 'src/**.php'
+      # Confirm any changes to relevant workflow files.
+      - '.github/workflows/upgrade-develop-testing.yml'
+      - '.github/workflows/reusable-upgrade-testing.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
+
+# Disable permissions for all available scopes by default.
+# Any needed permissions should be configured at the job level.
+permissions: {}
+
+jobs:
+  # Build WordPress from the current branch ready for the upgrade tests.
+  build:
+    name: Build
+    uses: ./.github/workflows/reusable-build-package.yml
+    permissions:
+      contents: read
+
+  # Run upgrade tests for the current branch.
+  upgrade-tests-develop:
+    name: Upgrade from ${{ matrix.wp }}
+    uses: ./.github/workflows/reusable-upgrade-testing.yml
+    if: ${{ github.repository == 'WordPress/wordpress-develop' || github.event_name == 'pull_request' }}
+    needs: [ build ]
+    strategy:
+      fail-fast: false
+      matrix:
+        os: [ 'ubuntu-24.04' ]
+        php: [ '7.2', '8.4' ]
+        db-type: [ 'mysql' ]
+        db-version: [ '5.7', '8.4' ]
+        wp: [ '6.5', '6.6', '6.7' ]
+        multisite: [ false, true ]
+
+        exclude:
+          # The PHP <= 7.3/MySQL 8.4 jobs currently fail due to mysql_native_password being disabled by default. See https://core.trac.wordpress.org/ticket/61218.
+          - php: '7.2'
+            db-version: '8.4'
+    with:
+      os: ${{ matrix.os }}
+      php: ${{ matrix.php }}
+      db-type: ${{ matrix.db-type }}
+      db-version: ${{ matrix.db-version }}
+      wp: ${{ matrix.wp }}
+      new-version: develop
+      multisite: ${{ matrix.multisite }}
+
+  slack-notifications:
+    name: Slack Notifications
+    uses: ./.github/workflows/slack-notifications.yml
+    permissions:
+      actions: read
+      contents: read
+    needs: [ upgrade-tests-develop ]
+    if: ${{ github.repository == 'WordPress/wordpress-develop' && github.event_name != 'pull_request' && always() }}
+    with:
+      calling_status: ${{ contains( needs.*.result, 'cancelled' ) && 'cancelled' || contains( needs.*.result, 'failure' ) && 'failure' || 'success' }}
+    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-24.04
+    permissions:
+      actions: write
+    needs: [ slack-notifications ]
+    if: |
+      always() &&
+      github.repository == 'WordPress/wordpress-develop' &&
+      github.event_name != 'pull_request' &&
+      github.run_attempt < 2 &&
+      (
+        contains( needs.*.result, 'cancelled' ) ||
+        contains( needs.*.result, 'failure' )
+      )
+
+    steps:
+      - name: Dispatch workflow run
+        uses: actions/github-script@60a0d83039c74a4aee543508d2ffcb1c3799cdea # v7.0.1
+        with:
+          retries: 2
+          retry-exempt-status-codes: 418
+          script: |
+            github.rest.actions.createWorkflowDispatch({
+              owner: context.repo.owner,
+              repo: context.repo.repo,
+              workflow_id: 'failed-workflow.yml',
+              ref: 'trunk',
+              inputs: {
+                run_id: `${context.runId}`,
+              }
+            });
</ins><span class="cx" style="display: block; padding: 0 10px">Property changes on: trunk/.github/workflows/upgrade-develop-testing.yml
</span><span class="cx" style="display: block; padding: 0 10px">___________________________________________________________________
</span></span></pre></div>
<a id="svneolstyle"></a>
<div class="addfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Added: svn:eol-style</h4></div>
<ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+native
</ins><span class="cx" style="display: block; padding: 0 10px">\ No newline at end of property
</span></div>

</body>
</html>