Skip to content

Commit e008c74

Browse files
Merge origin/main into master-sync
2 parents 6105199 + cce5daa commit e008c74

494 files changed

Lines changed: 26363 additions & 17881 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.depcheckrc.yml

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -49,14 +49,11 @@ ignores:
4949
# storybook
5050
- '@storybook/cli'
5151
- '@storybook/core'
52-
- '@storybook/addon-designs'
5352
- '@storybook/addon-essentials'
5453
- '@storybook/addon-a11y'
55-
- '@storybook/addon-mdx-gfm'
5654
- '@storybook/builder-webpack5'
5755
- '@storybook/manager-webpack5'
5856
- '@storybook/react-webpack5'
59-
- 'storybook-dark-mode'
6057
- 'react-syntax-highlighter'
6158
- 'style-loader'
6259
- 'css-loader'

.github/CODEOWNERS

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -150,3 +150,7 @@ test/e2e/fixture-server.js @MetaMask/qa
150150
test/e2e/helpers.js @MetaMask/qa
151151
test/e2e/mock-e2e-allowlist.js @MetaMask/qa
152152
test/e2e/mock-e2e.js @MetaMask/qa
153+
154+
# Wallet API Platform - Page Load Benchmark
155+
test/e2e/page-objects/benchmark @MetaMask/wallet-api-platform-engineers
156+
test/e2e/playwright/benchmark @MetaMask/wallet-api-platform-engineers

.github/CONTRIBUTING.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ When you're done with your project / bugfix / feature and ready to submit a PR,
1919
- [ ] **Meet the spec**: Make sure the PR adds functionality that matches the issue you're closing. This is especially important for bounties: sometimes design or implementation details are included in the conversation, so read carefully!
2020
- [ ] **Close the issue**: If this PR closes an open issue, fill out the "Related issues" section with `Fixes: #$ISSUE_NUMBER`. Ex. For closing issue 418, include the line `Fixes: #418`. If it doesn't close the issue but addresses it partially, just include a reference to the issue number, like `#418`.
2121
- [ ] **Keep it simple**: Try not to include multiple features in a single PR, and don't make extraneous changes outside the scope of your contribution. All those touched files make things harder to review ;)
22-
- [ ] **PR against `main`**: Submit your PR against the `main` branch. This is where we merge new features so they get some time to receive extra testing before being pushed to `master` for production. If your PR is a hot-fix that needs to be published urgently, you may submit a PR against the `master` branch, but this PR will receive tighter scrutiny before merging.
22+
- [ ] **PR against `main`**: Submit your PR against the `main` branch. This is where we merge new features so they get some time to receive extra testing before being pushed to `stable` for production. If your PR is a hot-fix that needs to be published urgently, you may submit a PR against the `stable` branch, but this PR will receive tighter scrutiny before merging.
2323
- [ ] **Get reviewed by MetaMask Internal Developers**: All PRs require 2 approvals from MetaMask Internal Developers before merging.
2424
- [ ] **Ensure the PR is correctly labeled.**: More detail about PR labels can be found [here](https://github.com/MetaMask/metamask-extension/blob/main/.github/guidelines/LABELING_GUIDELINES.md).
2525
- [ ] **PR Titles**: Must adhere to the [Conventional Commits specification](https://www.conventionalcommits.org)

.github/ISSUE_TEMPLATE/bug-report.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ body:
6767
attributes:
6868
label: Version
6969
description: What version of MetaMask are you running? You can find the version in "Settings" > "About"
70-
placeholder: '7.1.0'
70+
placeholder: '13.0.0'
7171
validations:
7272
required: true
7373
- type: dropdown
Lines changed: 79 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,79 @@
1+
#!/usr/bin/env bash
2+
3+
set -e
4+
set -u
5+
set -o pipefail
6+
7+
if [[ -z "${EXTENSION_BENCHMARK_STATS_TOKEN:-}" ]]; then
8+
printf '%s\n' 'EXTENSION_BENCHMARK_STATS_TOKEN environment variable must be set'
9+
exit 1
10+
fi
11+
12+
if [[ -z "${GITHUB_SHA:-}" ]]; then
13+
printf '%s\n' 'GITHUB_SHA environment variable must be set'
14+
exit 1
15+
fi
16+
17+
if [[ -z "${GITHUB_REPOSITORY_OWNER:-}" ]]; then
18+
printf '%s\n' 'GITHUB_REPOSITORY_OWNER environment variable must be set'
19+
exit 1
20+
fi
21+
22+
mkdir temp
23+
24+
git config --global user.email "metamaskbot@users.noreply.github.com"
25+
26+
git config --global user.name "MetaMask Bot"
27+
28+
git clone --depth 1 https://github.com/MetaMask/extension_benchmark_stats.git temp
29+
30+
cd temp
31+
32+
git fetch origin main:main
33+
34+
git checkout main
35+
36+
BENCHMARK_FILE="../test-artifacts/benchmarks/benchmark-results.json"
37+
STATS_FILE="stats/page_load_data.json"
38+
TEMP_FILE="stats/page_load_data.temp.json"
39+
40+
# Ensure the JSON file exists
41+
if [[ ! -f "${STATS_FILE}" ]]; then
42+
echo "{}" > "${STATS_FILE}"
43+
fi
44+
45+
# Validate JSON files before modification
46+
jq . "${STATS_FILE}" > /dev/null || {
47+
echo "Error: Existing stats JSON is invalid"
48+
exit 1
49+
}
50+
jq . "${BENCHMARK_FILE}" > /dev/null || {
51+
echo "Error: New benchmark JSON is invalid"
52+
exit 1
53+
}
54+
55+
# Check if the SHA already exists in the stats file
56+
if jq -e "has(\"${GITHUB_SHA}\")" "${STATS_FILE}" > /dev/null; then
57+
echo "SHA ${GITHUB_SHA} already exists in stats file. No new commit needed."
58+
exit 0
59+
fi
60+
61+
# Append new benchmark data correctly using jq
62+
jq --arg sha "${GITHUB_SHA}" --argjson data "$(cat "${BENCHMARK_FILE}")" \
63+
'. + {($sha): $data}' "${STATS_FILE}" > "${TEMP_FILE}"
64+
65+
# Overwrite the original JSON file with the corrected version
66+
mv "${TEMP_FILE}" "${STATS_FILE}"
67+
68+
# Only add the JSON file
69+
git add stats/page_load_data.json
70+
71+
git commit --message "Adding page load benchmark data at commit: ${GITHUB_SHA}"
72+
73+
repo_slug="${GITHUB_REPOSITORY_OWNER}/extension_benchmark_stats"
74+
75+
git push "https://metamaskbot:${EXTENSION_BENCHMARK_STATS_TOKEN}@github.com/${repo_slug}" main
76+
77+
cd ..
78+
79+
rm -rf temp

.github/scripts/check-template-and-add-labels.ts

Lines changed: 57 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -185,6 +185,22 @@ async function main(): Promise<void> {
185185
labelable,
186186
invalidPullRequestTemplateLabel,
187187
);
188+
189+
// Skip changelog check if PR has "no-changelog" label
190+
const hasNoChangelogLabel = labelable.labels?.some(
191+
(label) => label.name === "no-changelog"
192+
);
193+
194+
// Require changelog entry
195+
if (hasNoChangelogLabel) {
196+
console.log(`PR ${labelable.number} has "no-changelog" label. Skipping changelog entry check.`);
197+
} else if (!hasChangelogEntry(labelable.body)) {
198+
const errorMessage = `PR is missing a valid "CHANGELOG entry:" line.`;
199+
console.log(errorMessage);
200+
201+
core.setFailed(errorMessage);
202+
process.exit(1);
203+
}
188204
} else {
189205
const errorMessage = `PR body does not match template ('pull-request-template.md').\n\nMake sure PR's body includes all section titles.\n\nSections titles are listed here: https://github.com/MetaMask/metamask-extension/blob/main/.github/scripts/shared/template.ts#L40-L47`;
190206
console.log(errorMessage);
@@ -274,9 +290,14 @@ function extractReleaseVersionFromBugReportIssueBody(
274290
const cleanedBody = body.replace(/\r?\n/g, ' ');
275291

276292
// Extract version from the cleaned body
277-
const regex = /### Version\s+((.*?)(?= |$))/;
293+
const regex = /### Version\s+(.*?)(?=\s+###|$)/;
278294
const versionMatch = cleanedBody.match(regex);
279-
const version = versionMatch?.[1];
295+
const fullVersionString = versionMatch?.[1]?.trim();
296+
297+
// Extract just the x.x.x part from the full version string
298+
const versionRegex = /(\d+\.\d+\.\d+)/;
299+
const semanticVersionMatch = fullVersionString?.match(versionRegex);
300+
const version = semanticVersionMatch?.[1];
280301

281302
// Check if version is in the format x.y.z
282303
if (version && !/^(\d+\.)?(\d+\.)?(\*|\d+)$/.test(version)) {
@@ -379,3 +400,37 @@ async function userBelongsToMetaMaskOrg(
379400

380401
return Boolean(userBelongsToMetaMaskOrgResult?.user?.organization?.id);
381402
}
403+
404+
// This function checks if the PR description has a changelog entry
405+
function hasChangelogEntry(body: string): boolean {
406+
// Remove HTML comments (including multiline)
407+
const uncommentedBody = body.replace(/<!--[\s\S]*?-->/g, "");
408+
409+
// Split body into lines
410+
const lines = uncommentedBody.split(/\r?\n/);
411+
412+
// Find the line starting with "CHANGELOG entry:"
413+
const changelogLine = lines.find(line => line.trim().startsWith("CHANGELOG entry:"));
414+
415+
if (!changelogLine) {
416+
console.log("Changelog entry line missing");
417+
return false;
418+
}
419+
420+
// Extract everything after the prefix, tolerating extra spaces after the colon
421+
const match = changelogLine.match(/^\s*CHANGELOG entry:\s*(.*)$/);
422+
const entry = match?.[1]?.trim() ?? "";
423+
424+
if (entry === "") {
425+
console.log("Changelog entry is empty");
426+
return false;
427+
}
428+
429+
if (entry.toLowerCase() === "undefined") {
430+
console.log("Changelog entry is explicitly undefined");
431+
return false;
432+
}
433+
434+
console.log(`Changelog entry found: ${entry}`);
435+
return true; // allow any non-empty value, including "null"
436+
}

.github/scripts/get-next-semver-version.sh

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,16 @@ then
99
exit 0
1010
fi
1111

12-
# Get the version from package.json
13-
VERSION_PACKAGE=$(node -p "require(process.env.GITHUB_WORKSPACE + '/package.json').version")
12+
# Pattern for Version-vX.Y.Z branches
13+
VERSION_BRANCHES_VERSION_V=$(git branch -r | grep -o 'Version-v[0-9]*\.[0-9]*\.[0-9]*' | grep -o '[0-9]*\.[0-9]*\.[0-9]*' | sort --version-sort | tail -n 1)
14+
# Default pattern for release/x.y.z branches
15+
VERSION_BRANCHES_RELEASE=$(git branch -r | grep -o 'release/[0-9]*\.[0-9]*\.[0-9]*' | grep -o '[0-9]*\.[0-9]*\.[0-9]*' | sort --version-sort | tail -n 1)
1416

15-
echo "NEXT_SEMVER_VERSION=${VERSION_PACKAGE}" >> "$GITHUB_ENV"
17+
# Compare versions and keep the highest one
18+
HIGHEST_VERSION=$(printf "%s\n%s" "$VERSION_BRANCHES_VERSION_V" "$VERSION_BRANCHES_RELEASE" | sort --version-sort | tail -n 1)
19+
echo "HIGHEST_VERSION=${HIGHEST_VERSION}, VERSION_BRANCHES_VERSION_V=${VERSION_BRANCHES_VERSION_V}, VERSION_BRANCHES_RELEASE=${VERSION_BRANCHES_RELEASE}"
20+
21+
# Increment the minor version of the highest version found and reset the patch version to 0
22+
NEXT_VERSION=$(echo "$HIGHEST_VERSION" | awk -F. -v OFS=. '{$2++; $3=0; print}')
23+
24+
echo "NEXT_SEMVER_VERSION=${NEXT_VERSION}" >> "$GITHUB_ENV"

.github/workflows/add-release-label.yml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,8 @@ jobs:
2424
id: get-next-semver-version
2525
env:
2626
FORCE_NEXT_SEMVER_VERSION: ${{ vars.FORCE_NEXT_SEMVER_VERSION }}
27-
run: ./development/get-next-semver-version.sh "$FORCE_NEXT_SEMVER_VERSION"
27+
run: ./get-next-semver-version.sh "$FORCE_NEXT_SEMVER_VERSION"
28+
working-directory: '.github/scripts'
2829

2930
- name: Add release label to PR and linked issues
3031
id: add-release-label-to-pr-and-linked-issues

.github/workflows/automated-rca.yml

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -10,13 +10,9 @@ permissions:
1010

1111
jobs:
1212
automated-rca:
13-
uses: MetaMask/github-tools/.github/workflows/post-gh-rca.yml@727c028d5fdb2b86f6b1cf205b97fa8e79f7de61
13+
uses: MetaMask/github-tools/.github/workflows/post-gh-rca.yml@5da154078ddf6c022ed89dc3dbf378594afb8266
1414
with:
15-
google-form-base-url: 'https://docs.google.com/forms/d/e/1FAIpQLSfnfEWH7JCFFtvjCHixgyqJdTU3LW3BmTwdF1dDezTNf7m4ig/viewform'
1615
repo-owner: ${{ github.repository_owner }}
1716
repo-name: ${{ github.event.repository.name }}
1817
issue-number: ${{ github.event.issue.number }}
1918
issue-labels: '["Sev0-urgent", "Sev1-high"]'
20-
entry-issue: 'entry.340898780'
21-
entry-team: 'entry.765806202'
22-
entry-regression: 'entry.1756851972'

.github/workflows/benchmark-pr.yml

Lines changed: 67 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,67 @@
1+
name: Benchmark PR Performance
2+
3+
on:
4+
workflow_call:
5+
inputs:
6+
browser-loads:
7+
description: 'Number of browser loads to perform'
8+
required: false
9+
type: string
10+
default: '10'
11+
page-loads:
12+
description: 'Number of page loads per browser'
13+
required: false
14+
type: string
15+
default: '10'
16+
secrets:
17+
PR_COMMENT_TOKEN:
18+
required: true
19+
EXTENSION_BENCHMARK_STATS_TOKEN:
20+
required: true
21+
22+
jobs:
23+
benchmark-pr:
24+
name: Run Page Load Benchmarks
25+
runs-on: ubuntu-latest
26+
env:
27+
PR_COMMENT_TOKEN: ${{ secrets.PR_COMMENT_TOKEN }}
28+
OWNER: ${{ github.repository_owner }}
29+
REPOSITORY: ${{ github.event.repository.name }}
30+
PR_NUMBER: ${{ github.event.pull_request.number }}
31+
GITHUB_SHA: ${{ github.event.pull_request.head.sha }}
32+
steps:
33+
- name: Checkout and setup environment
34+
uses: MetaMask/action-checkout-and-setup@v1
35+
with:
36+
is-high-risk-environment: false
37+
skip-allow-scripts: true
38+
yarn-custom-url: ${{ vars.YARN_URL }}
39+
40+
- name: Download artifact 'build-dist-browserify'
41+
uses: actions/download-artifact@v4
42+
with:
43+
name: build-dist-browserify
44+
45+
- name: Install Playwright browsers
46+
run: yarn playwright install chromium
47+
48+
- name: Run page load benchmarks
49+
run: yarn test:e2e:benchmark
50+
51+
- name: Compare and comment
52+
if: ${{ github.event_name == 'pull_request' }}
53+
run: yarn tsx development/benchmark-pr-comment.ts
54+
env:
55+
PR_COMMENT_TOKEN: ${{ secrets.PR_COMMENT_TOKEN }}
56+
OWNER: ${{ github.repository_owner }}
57+
REPOSITORY: ${{ github.event.repository.name }}
58+
PR_NUMBER: ${{ github.event.pull_request.number }}
59+
GITHUB_SHA: ${{ github.event.pull_request.head.sha }}
60+
61+
- name: Upload benchmark results
62+
if: github.ref == 'refs/heads/main'
63+
run: .github/scripts/benchmark-stats-commit.sh
64+
env:
65+
EXTENSION_BENCHMARK_STATS_TOKEN: ${{ secrets.EXTENSION_BENCHMARK_STATS_TOKEN }}
66+
GITHUB_SHA: ${{ github.sha }}
67+
GITHUB_REPOSITORY_OWNER: ${{ github.repository_owner }}

0 commit comments

Comments
 (0)