Skip to content

Commit 183ff11

Browse files
temp+chore: cp-12.20.0 bump solana-wallet-standard to 0.5.0 & multichain-api-client to 0.6.2 (#33572)
<!-- Please submit this PR as a draft initially. Do not mark it as "Ready for review" until the template has been completely filled out, and PR status checks have passed at least once. --> ## **Description** <!-- Write a short description of the changes included in this pull request, also include relevant motivation and context. Have in mind the following questions: 1. What is the reason for the change? 2. What is the improvement/solution? --> bump @metamask/solana-wallet-standard to [0.5.0](MetaMask/solana-wallet-standard#44) bump @metamask/multichain-api-client to [0.6.2](MetaMask/multichain-api-client#62) [![Open in GitHub Codespaces](https://github.com/codespaces/badge.svg)](https://codespaces.new/MetaMask/metamask-extension/pull/33572?quickstart=1) ## **Related issues** ## **Manual testing steps** 1. Go to this page... 2. 3. ## **Screenshots/Recordings** <!-- If applicable, add screenshots and/or recordings to visualize the before and after of your change. --> ### **Before** <!-- [screenshots/recordings] --> ### **After** <!-- [screenshots/recordings] --> ## **Pre-merge author checklist** - [ ] I've followed [MetaMask Contributor Docs](https://github.com/MetaMask/contributor-docs) and [MetaMask Extension Coding Standards](https://github.com/MetaMask/metamask-extension/blob/main/.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 - [ ] I’ve applied the right labels on the PR (see [labeling guidelines](https://github.com/MetaMask/metamask-extension/blob/main/.github/guidelines/LABELING_GUIDELINES.md)). Not required for external contributors. ## **Pre-merge reviewer checklist** - [ ] I've manually tested the PR (e.g. pull and build branch, run the app, test code being changed). - [ ] I confirm that this PR addresses all acceptance criteria described in the ticket it closes and includes the necessary testing evidence such as recordings and or screenshots.
1 parent 02beca8 commit 183ff11

File tree

733 files changed

+44546
-46216
lines changed

Some content is hidden

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

733 files changed

+44546
-46216
lines changed

.circleci/config.yml

Lines changed: 636 additions & 8 deletions
Large diffs are not rendered by default.
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
#!/usr/bin/env bash
22

3+
export CIRCLE_BRANCH=""
34
export CONTENTFUL_ACCESS_SPACE_ID=""
45
export CONTENTFUL_ACCESS_TOKEN=""
56
export ETHERSCAN_API_KEY=""
@@ -12,17 +13,22 @@ export FIREBASE_PROJECT_ID=""
1213
export FIREBASE_STORAGE_BUCKET=""
1314
export INFURA_BETA_PROJECT_ID=""
1415
export INFURA_FLASK_PROJECT_ID=""
16+
export INFURA_MMI_PROJECT_ID=""
1517
export INFURA_PROD_PROJECT_ID=""
1618
export INFURA_PROJECT_ID=""
19+
export MMI_CONFIGURATION_SERVICE_URL=""
1720
export PUBNUB_PUB_KEY=""
1821
export SEGMENT_BETA_WRITE_KEY=""
1922
export SEGMENT_FLASK_WRITE_KEY=""
23+
export SEGMENT_MMI_WRITE_KEY=""
24+
export SEGMENT_PROD_LEGACY_WRITE_KEY=""
2025
export SEGMENT_PROD_WRITE_KEY=""
2126
export SEGMENT_WRITE_KEY=""
2227
export ANALYTICS_DATA_DELETION_SOURCE_ID=""
2328
export ANALYTICS_DATA_DELETION_ENDPOINT=""
2429
export SENTRY_AUTH_TOKEN=""
2530
export SENTRY_DSN=""
31+
export SENTRY_MMI_DSN=""
2632
export SENTRY_DSN_DEV=""
2733
export VAPID_KEY=""
2834
export TZ="UTC"
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
#!/usr/bin/env bash
2+
3+
set -e
4+
set -u
5+
set -o pipefail
6+
7+
# Takes in 3 args
8+
# - 1 - Base PR Branch Name
9+
# - 2 - Commit Hash
10+
# - 3 - PR Number
11+
12+
BASE_PR_BRANCH_NAME="${1}"
13+
COMMIT_HASH_TO_CHERRY_PICK="${2}"
14+
PR_BRANCH_NAME="chore/cherry-pick-${3}"
15+
PR_TITLE="chore: cherry-pick #${3}"
16+
PR_BODY="This PR cherry-picks #${3}"
17+
18+
git config user.name "MetaMask Bot"
19+
git config user.email "metamaskbot@users.noreply.github.com"
20+
21+
git checkout "${BASE_PR_BRANCH_NAME}"
22+
git pull
23+
git checkout -b "${PR_BRANCH_NAME}"
24+
git cherry-pick "${COMMIT_HASH_TO_CHERRY_PICK}"
25+
26+
git push --set-upstream origin "${PR_BRANCH_NAME}"
27+
28+
gh pr create \
29+
--draft \
30+
--title "${PR_TITLE}" \
31+
--body "${PR_BODY}" \
32+
--head "${BASE_PR_BRANCH_NAME}"

.circleci/scripts/enable-vnc.sh

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
#!/usr/bin/env bash
2+
3+
# This script is based on the documentation from CircleCI, which does not work as written
4+
# https://circleci.com/docs/browser-testing/#interacting-with-the-browser-over-vnc
5+
6+
set -e
7+
set -u
8+
set -o pipefail
9+
set -x
10+
11+
cd "${HOME}/project"
12+
13+
# Install a VNC server
14+
readonly LOCK_FILE="installed.lock"
15+
if [ ! -f "${LOCK_FILE}" ]; then
16+
sudo apt update
17+
sudo apt install -y x11vnc
18+
19+
touch "${LOCK_FILE}"
20+
fi
21+
22+
# Start VNC server
23+
if ! pgrep x11vnc > /dev/null; then
24+
x11vnc -display "$DISPLAY" -bg -forever -nopw -quiet -listen localhost -xkb -rfbport 5901 -passwd password
25+
fi

.circleci/scripts/firefox.cfg

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
// IMPORTANT: Start your code on the 2nd line
2+
3+
lockPref("app.update.enabled", false);
4+
lockPref("app.update.auto", false);
5+
lockPref("app.update.mode", 0);
6+
lockPref("app.update.service.enabled", false);
7+
8+
pref("browser.rights.3.shown", true);
9+
10+
pref("browser.startup.homepage_override.mstone","ignore");
11+
12+
lockPref("plugins.hide_infobar_for_outdated_plugin", true);
13+
clearPref("plugins.update.url");
Lines changed: 164 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,164 @@
1+
import { exec as execCallback } from 'child_process';
2+
import fs from 'fs';
3+
import path from 'path';
4+
import { promisify } from 'util';
5+
6+
const exec = promisify(execCallback);
7+
8+
// The CIRCLE_PR_NUMBER variable is only available on forked Pull Requests
9+
const PR_NUMBER =
10+
process.env.CIRCLE_PR_NUMBER ||
11+
process.env.CIRCLE_PULL_REQUEST?.split('/').pop();
12+
13+
const GITHUB_DEFAULT_BRANCH = 'main';
14+
const SOURCE_BRANCH = `refs/pull/${PR_NUMBER}/head`;
15+
16+
const CHANGED_FILES_DIR = 'changed-files';
17+
18+
type PRInfo = {
19+
base: {
20+
ref: string;
21+
};
22+
body: string;
23+
labels: { name: string }[];
24+
};
25+
26+
/**
27+
* Get JSON info about the given pull request
28+
*
29+
* @returns JSON info from GitHub
30+
*/
31+
async function getPrInfo(): Promise<PRInfo | null> {
32+
if (!PR_NUMBER) {
33+
return null;
34+
}
35+
36+
return await (
37+
await fetch(
38+
`https://api.github.com/repos/${process.env.CIRCLE_PROJECT_USERNAME}/${process.env.CIRCLE_PROJECT_REPONAME}/pulls/${PR_NUMBER}`,
39+
)
40+
).json();
41+
}
42+
43+
/**
44+
* Fetches the git repository with a specified depth.
45+
*
46+
* @param depth - The depth to use for the fetch command.
47+
* @returns True if the fetch is successful, otherwise false.
48+
*/
49+
async function fetchWithDepth(depth: number): Promise<boolean> {
50+
try {
51+
await exec(`git fetch --depth ${depth} origin "${GITHUB_DEFAULT_BRANCH}"`);
52+
await exec(
53+
`git fetch --depth ${depth} origin "${SOURCE_BRANCH}:${SOURCE_BRANCH}"`,
54+
);
55+
return true;
56+
} catch (error: unknown) {
57+
console.error(`Failed to fetch with depth ${depth}:`, error);
58+
return false;
59+
}
60+
}
61+
62+
/**
63+
* Attempts to fetch the necessary commits until the merge base is found.
64+
* It tries different fetch depths and performs a full fetch if needed.
65+
*
66+
* @throws If an unexpected error occurs during the execution of git commands.
67+
*/
68+
async function fetchUntilMergeBaseFound() {
69+
const depths = [1, 10, 100];
70+
for (const depth of depths) {
71+
console.log(`Attempting git diff with depth ${depth}...`);
72+
await fetchWithDepth(depth);
73+
74+
try {
75+
await exec(`git merge-base origin/HEAD HEAD`);
76+
return;
77+
} catch (error: unknown) {
78+
if (error instanceof Error && 'code' in error) {
79+
console.error(
80+
`Error 'no merge base' encountered with depth ${depth}. Incrementing depth...`,
81+
);
82+
} else {
83+
throw error;
84+
}
85+
}
86+
}
87+
await exec(`git fetch --unshallow origin "${GITHUB_DEFAULT_BRANCH}"`);
88+
}
89+
90+
/**
91+
* Performs a git diff command to get the list of files changed between the current branch and the origin.
92+
* It first ensures that the necessary commits are fetched until the merge base is found.
93+
*
94+
* @returns The output of the git diff command, listing the file paths with status (A, M, D).
95+
* @throws If unable to get the diff after fetching the merge base or if an unexpected error occurs.
96+
*/
97+
async function gitDiff(): Promise<string> {
98+
await fetchUntilMergeBaseFound();
99+
const { stdout: diffResult } = await exec(
100+
`git diff --name-status "origin/HEAD...${SOURCE_BRANCH}"`,
101+
);
102+
if (!diffResult) {
103+
throw new Error('Unable to get diff after full checkout.');
104+
}
105+
return diffResult;
106+
}
107+
108+
function writePrBodyAndInfoToFile(prInfo: PRInfo) {
109+
const prBodyPath = path.resolve(CHANGED_FILES_DIR, 'pr-body.txt');
110+
const labels = prInfo.labels.map(label => label.name).join(', ');
111+
const updatedPrBody = `PR labels: {${labels}}\nPR base: {${prInfo.base.ref}}\n${prInfo.body.trim()}`;
112+
fs.writeFileSync(prBodyPath, updatedPrBody);
113+
console.log(`PR body and info saved to ${prBodyPath}`);
114+
}
115+
116+
/**
117+
* Main run function, stores the output of git diff and the body of the matching PR to a file.
118+
*
119+
* @returns Returns a promise that resolves when the git diff output and PR body is successfully stored.
120+
*/
121+
async function storeGitDiffOutputAndPrBody() {
122+
try {
123+
// Create the directory
124+
// This is done first because our CirleCI config requires that this directory is present,
125+
// even if we want to skip this step.
126+
fs.mkdirSync(CHANGED_FILES_DIR, { recursive: true });
127+
128+
console.log(`Determining whether to run git diff...`);
129+
if (!PR_NUMBER) {
130+
console.log('Not a PR, skipping git diff');
131+
return;
132+
}
133+
134+
const prInfo = await getPrInfo();
135+
136+
const baseRef = prInfo?.base.ref;
137+
if (!baseRef) {
138+
console.log('Not a PR, skipping git diff');
139+
return;
140+
}
141+
// We perform git diff even if the PR base is not main or skip-e2e-quality-gate label is applied
142+
// because we rely on the git diff results for other jobs
143+
console.log('Attempting to get git diff...');
144+
const diffOutput = await gitDiff();
145+
console.log(diffOutput);
146+
147+
// Store the output of git diff
148+
const outputPath = path.resolve(CHANGED_FILES_DIR, 'changed-files.txt');
149+
fs.writeFileSync(outputPath, diffOutput.trim());
150+
console.log(`Git diff results saved to ${outputPath}`);
151+
152+
writePrBodyAndInfoToFile(prInfo);
153+
154+
process.exit(0);
155+
} catch (error: any) {
156+
console.error('An error occurred:', error.message);
157+
process.exit(1);
158+
}
159+
}
160+
161+
// If main module (i.e. this is the TS file that was run directly)
162+
if (require.main === module) {
163+
storeGitDiffOutputAndPrBody();
164+
}

.github/scripts/push-firefox-bundle-script.sh renamed to .circleci/scripts/push-firefox-bundle-script.sh

Lines changed: 14 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,33 @@
11
#!/usr/bin/env bash
22

33
set -e
4+
set -o pipefail
45

5-
if [[ -z "${FIREFOX_BUNDLE_SCRIPT_TOKEN}" ]]; then
6-
echo "::error::FIREFOX_BUNDLE_SCRIPT_TOKEN not provided. Set the 'FIREFOX_BUNDLE_SCRIPT_TOKEN' environment variable."
6+
if [[ "${CI:-}" != 'true' ]]
7+
then
8+
printf '%s\n' 'CI environment variable must be set to true'
9+
exit 1
10+
fi
11+
12+
if [[ "${CIRCLECI:-}" != 'true' ]]
13+
then
14+
printf '%s\n' 'CIRCLECI environment variable must be set to true'
715
exit 1
816
fi
917

1018
git config --global user.name "MetaMask Bot"
1119
git config --global user.email metamaskbot@users.noreply.github.com
1220
version=$(git show -s --format='%s' HEAD | grep -Eo 'v[0-9]+\.[0-9]+\.[0-9]+')
1321

14-
git clone "https://${FIREFOX_BUNDLE_SCRIPT_TOKEN}@github.com/MetaMask/firefox-bundle-script.git"
22+
git clone git@github.com:MetaMask/firefox-bundle-script.git
1523
cd firefox-bundle-script
1624
git checkout release
17-
cp ../.github/scripts/bundle.sh ./bundle.sh
25+
cp ../.circleci/scripts/bundle.sh ./bundle.sh
1826

1927
# sed works differently on macOS and Linux
2028
# macOS requires an empty string argument for -i
2129
# so we need to handle this case based on the OS
22-
if sed --version 2> /dev/null | grep -q GNU; then
30+
if sed --version 2>/dev/null | grep -q GNU; then
2331
SED_OPTS=(-i)
2432
else
2533
SED_OPTS=(-i '')
@@ -28,7 +36,7 @@ fi
2836
# Insert exported environment variables
2937
awk -F '=' '/^\s*export / {gsub(/^export /, ""); print $1}' bundle.sh | while read -r var; do
3038
if [[ -n "${!var}" ]]; then
31-
sed "${SED_OPTS[@]}" "s|^\(\s*export ${var}=\).*|\1\"${!var}\"|" bundle.sh
39+
sed "${SED_OPTS[@]}" "s|^\(\s*export $var=\).*|\1\"${!var}\"|" bundle.sh
3240
fi
3341
done
3442

0 commit comments

Comments
 (0)