Skip to content

Commit

Permalink
Merge pull request #25098 from MetaMask/Version-v12.0.0
Browse files Browse the repository at this point in the history
Version v12.0.0
  • Loading branch information
danjm authored Jul 30, 2024
2 parents aeabaa2 + 8b3bbd3 commit d5806d4
Show file tree
Hide file tree
Showing 1,287 changed files with 134,693 additions and 42,008 deletions.
269 changes: 213 additions & 56 deletions .circleci/config.yml

Large diffs are not rendered by default.

17 changes: 17 additions & 0 deletions .eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,10 @@ module.exports = {
ignorePatterns: readFileSync('.prettierignore', 'utf8').trim().split('\n'),
// eslint's parser, esprima, is not compatible with ESM, so use the babel parser instead
parser: '@babel/eslint-parser',
plugins: ['@metamask/design-tokens'],
rules: {
'@metamask/design-tokens/color-no-hex': 'warn',
},
overrides: [
/**
* == Modules ==
Expand Down Expand Up @@ -439,5 +443,18 @@ module.exports = {
],
},
},
/**
* Don't check for static hex values in .test, .spec or .stories files
*/
{
files: [
'**/*.test.{js,ts,tsx}',
'**/*.spec.{js,ts,tsx}',
'**/*.stories.{js,ts,tsx}',
],
rules: {
'@metamask/design-tokens/color-no-hex': 'off',
},
},
],
};
34 changes: 29 additions & 5 deletions .github/CODEOWNERS
Validating CODEOWNERS rules …
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ offscreen/scripts/offscreen.ts @MetaMask/snaps-devs
# empower our CI steps. ANY addition of orbs to our CircleCI config
# should be brought to the attention of engineering leadership for
# discussion
.circleci/ @MetaMask/library-admins @kumavis @brad-decker
.circleci/ @MetaMask/library-admins @kumavis

# The privacy-snapshot.json file includes a list of all hosts that the
# extension communicates with during the E2E test suite runs. It is not a
Expand All @@ -50,13 +50,37 @@ privacy-snapshot.json @MetaMask/extension-privacy-reviewers

# For now, restricting approvals inside the .devcontainer folder to devs
# who were involved with the Codespaces project.
.devcontainer/ @MetaMask/library-admins @HowardBraham @plasmacorral @brad-decker
.devcontainer/ @MetaMask/library-admins @HowardBraham @plasmacorral

# Confirmations UX team to own code for confirmations on UI.
ui/pages/confirmations @MetaMask/confirmations-ux @MetaMask/confirmations-system-team
# Confirmations team to own code for confirmations on UI.
ui/pages/confirmations @MetaMask/confirmations

# MMI team is responsible for code related with Institutioanl version of MetaMask
ui/pages/institutional @MetaMask/mmi
ui/components/institutional @MetaMask/mmi
ui/ducks/institutional @MetaMask/mmi
ui/selectors/institutional @MetaMask/mmi
ui/selectors/institutional @MetaMask/mmi

# Design System to own code for the component-library folder
# Slack handle: @metamask-design-system-team | Slack channel: #metamask-design-system
ui/components/component-library @MetaMask/design-system-engineers

# The Notifications team is responsible for code related to notifications,
# authentication, and profile syncing inside the Extension.

# Controllers
**/controllers/authentication/** @MetaMask/notifications
**/controllers/metamask-notifications/** @MetaMask/notifications
**/controllers/push-platform-notifications/** @MetaMask/notifications
**/controllers/user-storage/** @MetaMask/notifications

# UI
**/metamask-notifications/** @MetaMask/notifications
**/multichain/notification*/** @MetaMask/notifications
**/pages/notification*/** @MetaMask/notifications
**/utils/notification.util.ts @MetaMask/notifications

# Accounts team is responsible for code related with snap management accounts
# Slack handle: @accounts-team-devs | Slack channel: #metamask-accounts-team

app/scripts/lib/snap-keyring @MetaMask/accounts-engineers
1 change: 1 addition & 0 deletions .github/ISSUE_TEMPLATE/bug-report.yml
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,7 @@ body:
- GridPlus Lattice1
- AirGap Vault
- imToken
- OneKey
- Other (please elaborate in the "Additional Context" section)
- type: textarea
id: additional
Expand Down
3 changes: 2 additions & 1 deletion .github/guidelines/LABELING_GUIDELINES.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,10 @@ It's essential to ensure that PRs have the appropriate labels before they are co
### Mandatory release version labels:
- **release-x.y.z**: This label is automatically added to a PR and its linked issues upon the PR's merge. The `x.y.z` in the label represents the version in which the changes from the PR will be included. This label is auto-generated by a [GitHub action](../workflows/add-release-label.yml), which determines the version by incrementing the minor version number from the most recent release. Manual intervention is only required in specific cases. For instance, if a merged PR is cherry-picked into a release branch, typically done to address Release Candidate (RC) bugs, the label would need to be manually updated to reflect the correct version.
- **regression-prod-x.y.z**: This label is automatically added to a bug report issue at the time of its creation. The `x.y.z` in the label represents the version in which the bug first appeared. This label is auto-generated by a [GitHub action](../workflows/check-template-and-add-labels.yml), which determines the `x.y.z` value based on the version information provided in the bug report issue form. Manual intervention is only necessary under certain circumstances. For example, if a user submits a bug report and specifies the version they are currently using, but the bug was actually introduced in a prior version, the label would need to be manually updated to accurately reflect the version where the bug originated.
- **regression-RC-x.y.z**: This label is manually added to a bug report issue by release engineers when a bug is found during release regerssion testing phase. The `x.y.z` in the label represents the release candidate (RC) version in which the bug's been discovered.

### Optional labels:
- **regression-develop**: This label can manually be added to a bug report issue at the time of its creation if the bug is present on development branch (i.e. `develop`), but is not yet released in production.
- **regression-develop**: This label can manually be added to a bug report issue at the time of its creation if the bug is present on the development branch, i.e., `develop`, but is not yet released in production.
- **needs-qa**: If the PR includes a new features, complex testing steps, or large refactors, this label must be added to indicated PR requires a full manual QA prior being merged and added to a release.

### Labels prohibited when PR needs to be merged:
Expand Down
2 changes: 1 addition & 1 deletion .github/pull-request-template.md
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ Fixes:

## **Pre-merge author checklist**

- [ ] Ive followed [MetaMask Coding Standards](https://github.com/MetaMask/metamask-extension/blob/develop/.github/guidelines/CODING_GUIDELINES.md).
- [ ] I've followed [MetaMask Contributor Docs](https://github.com/MetaMask/contributor-docs) and [MetaMask Extension Coding Standards](https://github.com/MetaMask/metamask-extension/blob/develop/.github/guidelines/CODING_GUIDELINES.md).
- [ ] I've completed the PR template to the best of my ability
- [ ] I’ve included tests if applicable
- [ ] I’ve documented my code using [JSDoc](https://jsdoc.app/) format if applicable
Expand Down
17 changes: 16 additions & 1 deletion .github/scripts/check-template-and-add-labels.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,15 @@ import { retrieveIssue } from './shared/issue';
import {
Labelable,
LabelableType,
findLabel,
addLabelToLabelable,
removeLabelFromLabelable,
removeLabelFromLabelableIfPresent,
} from './shared/labelable';
import {
Label,
externalContributorLabel,
flakyTestsLabel,
invalidIssueTemplateLabel,
invalidPullRequestTemplateLabel,
} from './shared/label';
Expand Down Expand Up @@ -90,6 +92,19 @@ async function main(): Promise<void> {
}

if (labelable.type === LabelableType.Issue) {

// If labelable is a flaky test report, no template is needed (we just add a link to circle.ci in the description), we skip the template checks
const flakyTestsLabelFound = findLabel(labelable, flakyTestsLabel);
if (flakyTestsLabelFound?.id) {
console.log(`Issue ${labelable?.number} was created to report a flaky test. Issue's description doesn't need to match issue template in that case as the issue's description only includes a link redirecting to circle.ci. Skip template checks.`);
await removeLabelFromLabelableIfPresent(
octokit,
labelable,
invalidIssueTemplateLabel,
);
process.exit(0); // Stop the process and exit with a success status code
}

if (templateType === TemplateType.GeneralIssue) {
console.log("Issue matches 'general-issue.yml' template.");
await removeLabelFromLabelableIfPresent(
Expand Down Expand Up @@ -298,5 +313,5 @@ async function userBelongsToMetaMaskOrg(
function isReleaseCandidateIssue(
issue: Labelable,
): boolean {
return Boolean(issue.labels.find(label => label.name === 'regression-RC'));
return Boolean(issue.labels.find(label => label.name.startsWith('regression-RC')));
}
6 changes: 6 additions & 0 deletions .github/scripts/shared/label.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,12 @@ export const externalContributorLabel: Label = {
description: 'Issue or PR created by user outside org',
};

export const flakyTestsLabel: Label = {
name: 'flaky tests',
color: 'BE564E',
description: 'Flaky test report',
};

export const invalidIssueTemplateLabel: Label = {
name: 'INVALID-ISSUE-TEMPLATE',
color: 'EDEDED',
Expand Down
20 changes: 16 additions & 4 deletions .github/scripts/shared/labelable.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,20 @@ export interface Labelable {
}[];
}

// This function tries to find a label on a labelable object (i.e. a pull request or an issue) if present
export function findLabel(
labelable: Labelable,
labelToFind: Label,
): {
id: string;
name: string;
} | undefined {
// Check if label is present on labelable
return labelable.labels.find(
(label) => label.name === labelToFind.name,
);
}

// This function adds label to a labelable object (i.e. a pull request or an issue)
export async function addLabelToLabelable(
octokit: InstanceType<typeof GitHub>,
Expand Down Expand Up @@ -77,10 +91,8 @@ export async function removeLabelFromLabelableIfPresent(
labelable: Labelable,
labelToRemove: Label,
): Promise<void> {
// Check if label is present on issue
const labelFound = labelable?.labels?.find(
(label) => label.name === labelToRemove?.name,
);
// Check if label is present on labelable
const labelFound = findLabel(labelable, labelToRemove);

if (labelFound?.id) {
// Remove label from labelable
Expand Down
6 changes: 6 additions & 0 deletions .github/workflows/add-release-label.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,12 @@ jobs:
runs-on: ubuntu-latest
if: github.event.pull_request.merged == true
steps:
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: 'lts/*'

- run: corepack enable
- name: Checkout repository
uses: actions/checkout@v4
with:
Expand Down
29 changes: 29 additions & 0 deletions .github/workflows/check-attributions.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
name: Check Attributions

on:
push:
branches: Version-v*
pull_request:
branches: Version-v*
types:
- opened
- reopened
- synchronize
- ready_for_review

jobs:
check-attributions:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4
- run: corepack enable
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version-file: '.nvmrc'
cache: 'yarn'
- name: Install dependencies from cache
run: yarn --immutable
- name: Check attributions changes
run: yarn attributions:check
10 changes: 8 additions & 2 deletions .github/workflows/check-pr-labels.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: "Check PR has required labels"
name: 'Check PR has required labels'
on:
pull_request:
branches:
Expand All @@ -17,10 +17,16 @@ jobs:
pull-requests: read

steps:
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: 'lts/*'
- run: corepack enable

- name: Checkout repository
uses: actions/checkout@v4
with:
fetch-depth: 1 # This retrieves only the latest commit.
fetch-depth: 1 # This retrieves only the latest commit.

- name: Set up Node.js
uses: actions/setup-node@v4
Expand Down
6 changes: 6 additions & 0 deletions .github/workflows/check-template-and-add-labels.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,12 @@ jobs:
check-template-and-add-labels:
runs-on: ubuntu-latest
steps:
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: 'lts/*'
- run: corepack enable

- name: Checkout repository
uses: actions/checkout@v4
with:
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/cla.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ jobs:
contents: write
steps:
- name: "CLA Signature Bot"
uses: MetaMask/cla-signature-bot@v3.0.2
uses: MetaMask/cla-signature-bot@v4.0.0
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
Expand Down
6 changes: 6 additions & 0 deletions .github/workflows/close-bug-report.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,12 @@ jobs:
runs-on: ubuntu-latest
if: github.event.pull_request.merged == true && startsWith(github.event.pull_request.head.ref, 'Version-v')
steps:
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: 'lts/*'
- run: corepack enable

- name: Checkout repository
uses: actions/checkout@v4
with:
Expand Down
6 changes: 6 additions & 0 deletions .github/workflows/codespaces.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,12 @@ jobs:
name: Generate cache image
runs-on: ubuntu-latest
steps:
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: 'lts/*'
- run: corepack enable

- name: Checkout repository
uses: actions/checkout@v4
with:
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/create-bug-report.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ jobs:
{
"title": "v${{ env.version }} Bug Report",
"body": "This bug report was automatically created by a GitHub action upon the creation of release branch \`Version-v${{ env.version }}\` (release cut).\n\n**Expected actions for release engineers:**\n\n1. Convert this issue into a Zenhub epic and link all bugs identified during the release regression testing phase to this epic.\n\n2. After completing the first regression run, move this epic to \"Regression Completed\" on the [Extension Release Regression board](https://app.zenhub.com/workspaces/extension-release-regression-6478c62d937eaa15e95c33c5/board?filterLogic=any&labels=release-${{ env.version }},release-task).\n\nNote that once the release is prepared for store submission, meaning the \`Version-v${{ env.version }}\` branch merges into \`master\`, another GitHub action will automatically close this epic.",
"labels": ["type-bug", "regression-RC", "release-${{ env.version }}"]
"labels": ["type-bug", "team-extension-platform", "regression-RC-${{ env.version }}"]
}
EOF
)
Expand Down
6 changes: 6 additions & 0 deletions .github/workflows/fitness-functions.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,12 @@ jobs:
runs-on: ubuntu-latest

steps:
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: 'lts/*'
- run: corepack enable

- name: Checkout code
uses: actions/checkout@v4
with:
Expand Down
Loading

0 comments on commit d5806d4

Please sign in to comment.