Skip to content

Commit

Permalink
Merge branch 'trunk' into fix/crm/3468-dashboard-contact-graph-fix
Browse files Browse the repository at this point in the history
  • Loading branch information
gogdzl committed Oct 25, 2024
2 parents 7535b25 + ac3ba4a commit e92a96f
Show file tree
Hide file tree
Showing 5,046 changed files with 337,416 additions and 85,107 deletions.
The diff you're trying to view is too large. We only load the first 3000 changed files.
18 changes: 18 additions & 0 deletions .github/ISSUE_TEMPLATE/bug-report.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
name: Bug Report
description: Report issues with one of our products.
labels: [ 'Needs triage', '[Type] Bug' ]
type: 'Bug'
body:
- type: markdown
attributes:
Expand Down Expand Up @@ -91,12 +92,29 @@ body:
- There is no user impact
validations:
required: true

- type: markdown
attributes:
value: |
<br>
- type: textarea
id: workaround-detail
attributes:
label: If the above answer is "Yes...", outline the workaround.
placeholder: |
Provide details of the specific steps to take that resolve the issue, e.g.:
- Open "Setting X".
- Toggle "Option Y".
- Click "Button Z".
- type: markdown
attributes:
value: |
<br>
## Optional Information
The following section is optional.
- type: dropdown
id: site-type
Expand Down
1 change: 1 addition & 0 deletions .github/ISSUE_TEMPLATE/enhancement.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ name: Enhancement Request
description: Suggest a change to a feature you like!
title: "Enhancement:"
labels: ["[Type] Enhancement"]
type: 'Enhancement'
body:
- type: dropdown
id: plugin-type
Expand Down
1 change: 1 addition & 0 deletions .github/ISSUE_TEMPLATE/feature-request.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ name: Feature Request
description: Suggest an idea for this project!
title: "Feature Request:"
labels: ["[Type] Feature Request"]
type: 'Enhancement'
body:
- type: dropdown
id: plugin-type
Expand Down
2 changes: 1 addition & 1 deletion .github/actions/tool-setup/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ runs:
- name: Setup pnpm
if: steps.versions.outputs.node-version != 'false'
uses: pnpm/action-setup@v3.0.0
uses: pnpm/action-setup@v4.0.0
with:
version: ${{ steps.versions.outputs.pnpm-version }}
- name: Setup Node
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,12 @@ const getCheckComments = require( './get-check-comments.js' );
* meaning that Jetpack is being built. Or `packages/jetpack-mu-wpcom`,
* for the jetpack-mu-wpcom-plugin used on WordPress.com is being built.
*
* @param {GitHub} github - Initialized Octokit REST client.
* @param {string} owner - Repository owner.
* @param {string} repo - Repository name.
* @param {string} number - PR number.
* @param {Core} core - A reference to the @actions/core package
* @returns {Promise} Promise resolving to an array of project strings needing testing.
* @param {GitHub} github - Initialized Octokit REST client.
* @param {string} owner - Repository owner.
* @param {string} repo - Repository name.
* @param {string} number - PR number.
* @param {Core} core - A reference to the @actions/core package
* @return {Promise} Promise resolving to an array of project strings needing testing.
*/
async function touchedProjectsNeedingTesting( github, owner, repo, number, core ) {
const changed = JSON.parse( process.env.CHANGED );
Expand Down Expand Up @@ -46,7 +46,7 @@ async function touchedProjectsNeedingTesting( github, owner, repo, number, core
* @param {github} github - Pre-authenticated octokit/rest.js client with pagination plugins
* @param {object} context - Context of the workflow run
* @param {core} core - A reference to the @actions/core package
* @returns {Promise} Promise resolving to an object with the following properties:
* @return {Promise} Promise resolving to an object with the following properties:
* - {commentId} - a comment ID, or 0 if no comment is found.
* - {projects} - an array of project strings needing testing.
*/
Expand Down
6 changes: 3 additions & 3 deletions .github/files/build-reminder-comment/get-check-comments.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ const cache = {};
* @param {string} number - Issue number.
* @param {string} testCommentIndicator - A piece of text unique to all test reminder comments.
* @param {core} core - A reference to the @actions/core package
* @returns {Promise<Array>} Promise resolving to an array of comment IDs.
* @return {Promise<Array>} Promise resolving to an array of comment IDs.
*/
async function getCheckComments( github, owner, repo, number, testCommentIndicator, core ) {
const testCommentIDs = [];
Expand All @@ -30,11 +30,11 @@ async function getCheckComments( github, owner, repo, number, testCommentIndicat
issue_number: +number,
per_page: 100,
} ) ) {
response.data.map( comment => {
for ( const comment of response.data ) {
if ( comment.body.includes( testCommentIndicator ) ) {
testCommentIDs.push( comment.id );
}
} );
}
}

cache[ cacheKey ] = testCommentIDs;
Expand Down
Binary file modified .github/files/e2e-tests/notification-rules.enc
Binary file not shown.
29 changes: 24 additions & 5 deletions .github/files/generate-ci-matrix.php
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,9 @@
// {string} Name for the job. Required, and must be unique.
'name' => null,

// {string} Runner name as found in https://github.com/actions/runner-images/.
'runner' => 'ubuntu-latest',

// {string} Composer script for the job. Required.
'script' => null,

Expand Down Expand Up @@ -58,7 +61,7 @@
$matrix = array();

// Add PHP tests.
foreach ( array( '7.0', '7.2', '7.3', '7.4', '8.0', '8.1', '8.2', '8.3' ) as $php ) {
foreach ( array( '7.2', '7.3', '7.4', '8.0', '8.1', '8.2', '8.3' ) as $php ) {
$matrix[] = array(
'name' => "PHP tests: PHP $php WP latest",
'script' => 'test-php',
Expand All @@ -68,6 +71,17 @@
);
}

// TODO: When WordPress 6.5 is no longer supported, this can be removed. Runs too slow on ubuntu-24.04 (ubuntu-latest).
$matrix[] = array(
'name' => 'PHP tests: PHP 7.0 WP previous',
'runner' => 'ubuntu-22.04',
'script' => 'test-php',
'php' => '7.0',
'wp' => 'previous',
'timeout' => 20, // 2023-08-17: Successful runs seem to take up to ~12 minutes.
'force-package-tests' => true,
);

foreach ( array( 'previous', 'trunk' ) as $wp ) {
$phpver = $versions['PHP_VERSION'];
$matrix[] = array(
Expand All @@ -89,10 +103,15 @@
'with-woocommerce' => true,
);

/**
* Here is the place where wpcomsh tests would be introduced by adding 'with-wpcomsh' property set to true.
* This adds a new run into the matrix that would enable wpcomsh loading with unit tests.
*/
// Add wpcomsh tests.
$matrix[] = array(
'name' => 'PHP tests: PHP 8.1 WP latest with wpcomsh',
'script' => 'test-php',
'php' => '8.1',
'wp' => 'latest',
'timeout' => 20,
'with-wpcomsh' => true,
);

// Add JS tests.
$matrix[] = array(
Expand Down
169 changes: 89 additions & 80 deletions .github/files/gh-autorelease/files/autorelease.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,32 +2,42 @@

set -eo pipefail

: "${GH_TOKEN:?Build argument needs to be set and non-empty.}"
: "${GITHUB_REF:?Build argument needs to be set and non-empty.}"
: "${GITHUB_SHA:?Build argument needs to be set and non-empty.}"
: "${API_TOKEN_GITHUB:?Build argument needs to be set and non-empty.}"
: "${GITHUB_API_URL:?Build argument needs to be set and non-empty.}"
: "${GITHUB_REPOSITORY:?Build argument needs to be set and non-empty.}"

## Determine tag
if [[ ! "$GITHUB_REF" =~ ^refs/tags/v?[0-9]+(\.[0-9]+)+(-[a-z0-9._-]+)?$ ]]; then
echo "::error::Expected GITHUB_REF like \`refs/tags/v1.2.3\` or \`refs/tags/1.2.3\`, got \`$GITHUB_REF\`"
if [[ ! -f composer.json ]]; then
echo '::error::No composer.json. Did it get excluded from the mirror?'
exit 1
fi
TAG="${GITHUB_REF#refs/tags/}"

## Check for alphas
if [[ "$TAG" =~ -(alpha|a\.[0-9]*[02468])$ ]]; then
echo "Not creating a release for alpha version $TAG"
exit 0
fi
echo "Creating release for $TAG"
## Determine tag
ROLLING_MODE=
if [[ "$GITHUB_REF" =~ ^refs/tags/v?[0-9]+(\.[0-9]+)+(-[a-z0-9._-]+)?$ ]]; then
TAG="${GITHUB_REF#refs/tags/}"

## Determine slug and title format.
if [[ ! -f composer.json ]]; then
echo '::error::No composer.json. Did it get excluded from the mirror?'
## Check for alphas
if [[ "$TAG" =~ -(alpha|a\.[0-9]*[02468])$ ]]; then
echo "Not creating a release for alpha version $TAG"
exit 0
fi
elif [[ "$GITHUB_REF" == "refs/heads/trunk" ]]; then
if ! jq -e '.extra.autorelease["rolling-release"]? // false' composer.json > /dev/null; then
echo "::notice::Skipping trunk release because autorelease rolling mode is not enabled."
exit 0
fi
ROLLING_MODE=true
CURRENT_VER=$( sed -nEe 's/^## \[?([^]]*)\]? - .*/\1/;T;p;q' CHANGELOG.md || true )
GIT_SUFFIX=$( git log -1 --format="%ct.g%h" . )
TAG="$CURRENT_VER+rolling.$GIT_SUFFIX"
else
echo "::error::Expected GITHUB_REF like \`refs/tags/v1.2.3\` or \`refs/tags/1.2.3\` or \`refs/heads/trunk\` for rolling releases, got \`$GITHUB_REF\`"
exit 1
fi

echo "Creating release for $TAG"

## Determine slug and title format.
SLUG="$(jq -r '.extra.autorelease.slug? // .extra["wp-plugin-slug"] // .extra["beta-plugin-slug"] // ( .name | sub( "^.*/"; "" ) )' composer.json)"
if [[ -z "$SLUG" ]]; then
echo '::error::Failed to get slug from composer.json.'
Expand All @@ -48,76 +58,75 @@ echo "::group::Creating $SLUG.zip"
git archive -v --output="$SLUG.zip" --prefix="$SLUG/" HEAD 2>&1
echo "::endgroup::"

## Create the release note.
# Extract the changelog section.
echo "::group::Extracting release notes"
if [[ ! -f CHANGELOG.md ]]; then
echo '::endgroup::'
echo '::error::No CHANGELOG.md for release notes.'
exit 1
fi
SCRIPT="
/^## \\[?$(sed 's/[.\[\]\\*^$\/()+?{}|]/\\&/g' <<<"${TAG#v}")\\]? - / {
bc
if [[ -z "$ROLLING_MODE" ]]; then
## Create the release note.
# Extract the changelog section.
echo "::group::Extracting release notes"
if [[ ! -f CHANGELOG.md ]]; then
echo '::endgroup::'
echo '::error::No CHANGELOG.md for release notes.'
exit 1
fi
SCRIPT="
/^## \\[?$(sed 's/[.\[\]\\*^$\/()+?{}|]/\\&/g' <<<"${TAG#v}")\\]? - / {
bc
:a
n
/^## / {
q
}
:c
s/^## \[([^]]+)\]/## \1/
p
ba
}
"
ENTRY=$(sed -n -E -e "$SCRIPT" CHANGELOG.md)
if [[ -z "$ENTRY" ]]; then
echo '::endgroup::'
echo "::error::Failed to find section for ${TAG#v} in CHANGELOG.md"
exit 1
fi

# Strip unwanted sections.
SCRIPT="
:a
n
/^## / {
q
/^### .* This section will not be copied to readme\.txt/ {
:b
n
/^#/ ba
bb
}
:c
s/^## \[([^]]+)\]/## \1/
p
ba
}
"
ENTRY=$(sed -n -E -e "$SCRIPT" CHANGELOG.md)
if [[ -z "$ENTRY" ]]; then
echo '::endgroup::'
echo "::error::Failed to find section for ${TAG#v} in CHANGELOG.md"
exit 1
"
ENTRY=$(sed -n -E -e "$SCRIPT" <<<"$ENTRY")

echo "Release notes:"
echo "-----"
echo "$ENTRY"
echo "-----"
echo "::endgroup::"
else
## Using a brief explanation for the rolling release note.
ENTRY="### Rolling release based on the trunk branch."
fi

if [[ -n "$ROLLING_MODE" ]]; then
echo "::group::Deleting stale rolling release"

for R in $( gh release list --limit 100 --json tagName --jq '.[].tagName | select( contains( "rolling" ) )' ); do
echo "Found $R, deleting"
gh release delete "$R" --cleanup-tag --yes
done

echo "::endgroup::"
fi

# Strip unwanted sections.
SCRIPT="
:a
/^### .* This section will not be copied to readme\.txt/ {
:b
n
/^#/ ba
bb
}
p
"
ENTRY=$(sed -n -E -e "$SCRIPT" <<<"$ENTRY")

echo "Release notes:"
echo "-----"
echo "$ENTRY"
echo "-----"
echo "::endgroup::"

echo "::group::Creating release"
curl -v -L \
--write-out '%{response_code}' \
--output out.json \
--request POST \
--header "authorization: Bearer $API_TOKEN_GITHUB" \
--header 'content-type: application/json' \
--header 'accept: application/vnd.github.v3+json' \
--url "${GITHUB_API_URL}/repos/${GITHUB_REPOSITORY}/releases" \
--data "$(jq -n --arg tag "$TAG" --arg sha "$GITHUB_SHA" --arg title "$TITLE" --arg body "$ENTRY" '{ tag_name: $tag, target_commitish: $sha, name: $title, body: $body}')" \
2>&1 > code.txt
cat out.json
echo
[[ "$(<code.txt)" =~ ^2[0-9][0-9]$ ]] || exit 1
echo "::endgroup::"
gh release create "$TAG" "$SLUG.zip" \
--notes "$ENTRY" \
--target "$GITHUB_SHA" \
--title "$TITLE"

echo "::group::Uploading artifact to release"
curl -v --fail -L \
--request POST \
--header "authorization: Bearer $API_TOKEN_GITHUB" \
--header "content-type: application/zip" \
--url "$(jq -r '.upload_url | sub( "{\\?[^}]*}$"; "" )' out.json)?name=$SLUG.zip" \
--data-binary "@$SLUG.zip" \
2>&1
echo "::endgroup::"
4 changes: 3 additions & 1 deletion .github/files/gh-autorelease/workflows/autorelease.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@ on:
- 'v?[0-9]+.[0-9]+.[0-9]+-*'
- 'v?[0-9]+.[0-9]+.[0-9]+.[0-9]+'
- 'v?[0-9]+.[0-9]+.[0-9]+.[0-9]+-*'
branches:
- 'trunk'

jobs:
publish:
Expand All @@ -18,5 +20,5 @@ jobs:
- uses: actions/checkout@v4
- name: Create release
env:
API_TOKEN_GITHUB: ${{ secrets.GITHUB_TOKEN }}
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: ./.github/files/autorelease.sh
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,9 @@ jobs:
fi
exit $EXIT
- name: Install svn
run: command -v svn || sudo apt-get install -y subversion

- uses: actions/checkout@v4
with:
path: src
Expand Down
Loading

0 comments on commit e92a96f

Please sign in to comment.