Skip to content

Commit

Permalink
Merge branch 'develop' into optimize-setuplocale
Browse files Browse the repository at this point in the history
  • Loading branch information
davidmurdoch authored Sep 18, 2024
2 parents ba6741c + 107f8da commit 5982850
Show file tree
Hide file tree
Showing 1,135 changed files with 41,591 additions and 25,782 deletions.
145 changes: 77 additions & 68 deletions .circleci/config.yml

Large diffs are not rendered by default.

25 changes: 25 additions & 0 deletions .circleci/scripts/enable-vnc.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
#!/usr/bin/env bash

# This script is based on the documentation from CircleCI, which does not work as written
# https://circleci.com/docs/browser-testing/#interacting-with-the-browser-over-vnc

set -e
set -u
set -o pipefail
set -x

cd "${HOME}/project"

# Install a VNC server
readonly LOCK_FILE="installed.lock"
if [ ! -f "${LOCK_FILE}" ]; then
sudo apt update
sudo apt install -y x11vnc

touch "${LOCK_FILE}"
fi

# Start VNC server
if ! pgrep x11vnc > /dev/null; then
x11vnc -display "$DISPLAY" -bg -forever -nopw -quiet -listen localhost -xkb -rfbport 5901 -passwd password
fi
45 changes: 41 additions & 4 deletions .circleci/scripts/git-diff-develop.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,26 @@ import { promisify } from 'util';

const exec = promisify(execCallback);

const MAIN_BRANCH = 'develop';

/**
* Get the target branch for the given pull request.
*
* @returns The name of the branch targeted by the PR.
*/
async function getBaseRef(): Promise<string | null> {
if (!process.env.CIRCLE_PULL_REQUEST) {
return null;
}

// We're referencing the CIRCLE_PULL_REQUEST environment variable within the script rather than
// passing it in because this makes it easier to use Bash parameter expansion to extract the
// PR number from the URL.
const result = await exec(`gh pr view --json baseRefName "\${CIRCLE_PULL_REQUEST##*/}" --jq '.baseRefName'`);
const baseRef = result.stdout.trim();
return baseRef;
}

/**
* Fetches the git repository with a specified depth.
*
Expand Down Expand Up @@ -76,14 +96,31 @@ async function gitDiff(): Promise<string> {
*/
async function storeGitDiffOutput() {
try {
console.log("Attempting to get git diff...");
const diffOutput = await gitDiff();
console.log(diffOutput);

// Create the directory
// This is done first because our CirleCI config requires that this directory is present,
// even if we want to skip this step.
const outputDir = 'changed-files';
fs.mkdirSync(outputDir, { recursive: true });

console.log(`Determining whether this run is for a PR targetting ${MAIN_BRANCH}`)
if (!process.env.CIRCLE_PULL_REQUEST) {
console.log("Not a PR, skipping git diff");
return;
}

const baseRef = await getBaseRef();
if (baseRef === null) {
console.log("Not a PR, skipping git diff");
return;
} else if (baseRef !== MAIN_BRANCH) {
console.log(`This is for a PR targeting '${baseRef}', skipping git diff`);
return;
}

console.log("Attempting to get git diff...");
const diffOutput = await gitDiff();
console.log(diffOutput);

// Store the output of git diff
const outputPath = path.resolve(outputDir, 'changed-files.txt');
fs.writeFileSync(outputPath, diffOutput.trim());
Expand Down
8 changes: 8 additions & 0 deletions .circleci/scripts/test-run-e2e-timeout-minutes.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
import { filterE2eChangedFiles } from '../../test/e2e/changedFilesUtil';

const changedOrNewTests = filterE2eChangedFiles();

//15 minutes, plus 3 minutes for every changed file, up to a maximum of 30 minutes
const extraTime = Math.min(15 + changedOrNewTests.length * 3, 30);

console.log(extraTime);
16 changes: 14 additions & 2 deletions .circleci/scripts/test-run-e2e.sh
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,23 @@ then
exit 1
fi

# Skip running e2e tests if we're doing "Rerun job with SSH" and we're not on the first node
if netstat -tnlp | grep -q 'circleci-agent' && [ "$CIRCLE_NODE_INDEX" -ne 0 ]
then
printf '"Rerun job with SSH" and not on the first node, shutting down\n'
circleci-agent step halt
exit 1
fi

TIMEOUT_MINUTES=$(yarn tsx .circleci/scripts/test-run-e2e-timeout-minutes.ts)
echo "TIMEOUT_MINUTES: $TIMEOUT_MINUTES"

# Run the actual test command from the parameters
timeout 20m "$@" --retries 1
timeout "${TIMEOUT_MINUTES}"m "$@" --retries 1

# Error code 124 means the command timed out
if [ $? -eq 124 ]; then
if [ $? -eq 124 ]
then
# Once deleted, if someone tries to "Rerun failed tests" the result will be
# "Error: can not rerun failed tests: no failed tests could be found"
echo 'Timeout error, deleting the test results'
Expand Down
4 changes: 2 additions & 2 deletions .circleci/scripts/validate-locales-only.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@ const { readChangedFiles } = require('../../test/e2e/changedFilesUtil.js');
* Fails the build if any changed files are outside of the /_locales/ directory.
* Fails if no changed files are detected.
*/
async function validateLocalesOnlyChangedFiles() {
const changedFiles = await readChangedFiles();
function validateLocalesOnlyChangedFiles() {
const changedFiles = readChangedFiles();
if (!changedFiles || changedFiles.length === 0) {
console.error('Failure: No changed files detected.');
process.exit(1);
Expand Down
1 change: 1 addition & 0 deletions .depcheckrc.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ ignores:
- '@sentry/cli' # invoked as `sentry-cli`
- 'chromedriver'
- 'depcheck' # ooo meta
- 'ethers' # ethers @5.7.0 expected by @account-abstraction/contracts, but conflicts with transitive ethers@6.x
- 'ganache-cli'
- 'geckodriver'
- 'jest'
Expand Down
23 changes: 22 additions & 1 deletion .github/CODEOWNERS
Validating CODEOWNERS rules …
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@

* @MetaMask/extension-devs
development/ @MetaMask/extension-devs @kumavis
lavamoat/ @MetaMask/extension-devs @MetaMask/supply-chain @MetaMask/snaps-devs
lavamoat/ @MetaMask/extension-devs @MetaMask/supply-chain

# The offscreen.ts script file that is included in the offscreen document html
# file is responsible, at present, for loading the snaps execution environment
Expand Down Expand Up @@ -93,3 +93,24 @@ app/scripts/controllers/swaps @MetaMask/swaps-engineers
shared/constants/permissions.ts @MetaMask/snaps-devs
ui/helpers/utils/permission.js @MetaMask/snaps-devs
ui/hooks/useTransactionInsights.js @MetaMask/snaps-devs

# Wallet UX
ui/components/multichain @MetaMask/wallet-ux
ui/components/app/whats-new-popup @MetaMask/wallet-ux
ui/css @MetaMask/wallet-ux
ui/pages/home @MetaMask/wallet-ux
ui/pages/onboarding-flow @MetaMask/wallet-ux

# Assets
ui/components/app/add-network @MetaMask/metamask-assets
ui/components/app/auto-detect-nft @MetaMask/metamask-assets
ui/components/app/auto-detect-token @MetaMask/metamask-assets
ui/components/app/import-token @MetaMask/metamask-assets
ui/components/app/nft-default-image @MetaMask/metamask-assets
ui/components/app/nft-details @MetaMask/metamask-assets
ui/components/app/nft-options @MetaMask/metamask-assets
ui/components/app/nfts-detection-notice-import-nfts @MetaMask/metamask-assets
ui/components/app/nfts-items @MetaMask/metamask-assets
ui/components/app/nfts-tab @MetaMask/metamask-assets
ui/components/ui/deprecated-networks @MetaMask/metamask-assets
ui/components/ui/nft-collection-image @MetaMask/metamask-assets
89 changes: 0 additions & 89 deletions .github/scripts/add-team-label.ts

This file was deleted.

4 changes: 2 additions & 2 deletions .github/scripts/check-template-and-add-labels.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ enum RegressionStage {
Production
}

const knownBots = ["metamaskbot", "dependabot", "github-actions", "sentry-io"];
const knownBots = ["metamaskbot", "dependabot", "github-actions", "sentry-io", "devin-ai-integration"];

main().catch((error: Error): void => {
console.error(error);
Expand Down Expand Up @@ -82,7 +82,7 @@ async function main(): Promise<void> {
}

// If author is not part of the MetaMask organisation
if (!(await userBelongsToMetaMaskOrg(octokit, labelable?.author))) {
if (!knownBots.includes(labelable?.author) && !(await userBelongsToMetaMaskOrg(octokit, labelable?.author))) {
// Add external contributor label to the issue
await addLabelToLabelable(octokit, labelable, externalContributorLabel);
}
Expand Down
4 changes: 3 additions & 1 deletion .github/workflows/add-team-label.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@ on:

jobs:
add-team-label:
uses: metamask/github-tools/.github/workflows/add-team-label.yml@main
uses: metamask/github-tools/.github/workflows/add-team-label.yml@058012b49ff2fbd9649c566ba43b29497f93b21d
permissions:
pull-requests: write
secrets:
PERSONAL_ACCESS_TOKEN: ${{ secrets.RELEASE_LABEL_TOKEN }}
2 changes: 1 addition & 1 deletion .github/workflows/create-bug-report.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ jobs:
payload=$(cat <<EOF
{
"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.",
"body": "**What is this bug report issue for?**\n\n1. This issue is used to track release dates on this [Github Project board](https://github.com/orgs/MetaMask/projects/86/views/1), which content then gets pulled into our metrics system.\n\n2. This issue is also used by our Zapier automations, to determine if automated notifications shall be sent on Slack for release \`${{ env.version }}\`. Notifications will only be sent as long as this issue is open.\n\n**Who created and/or closed this issue?**\n\n- This issue was automatically created by a GitHub action upon the creation of the release branch \`Version-v${{ env.version }}\`, indicating the release was cut.\n\n- This issue gets automatically closed by another GitHub action, once the \`Version-v${{ env.version }}\` branch merges into \`master\`, indicating the release is prepared for store submission.",
"labels": ["type-bug", "team-extension-platform", "regression-RC-${{ env.version }}"]
}
EOF
Expand Down
20 changes: 0 additions & 20 deletions .github/workflows/run-integration-tests.yml

This file was deleted.

Loading

0 comments on commit 5982850

Please sign in to comment.