Skip to content

Commit 7952774

Browse files
Merge branch 'main' into fix/font-size-increase
2 parents 5a8f65f + ccd3cbc commit 7952774

File tree

153 files changed

+4239
-2152
lines changed

Some content is hidden

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

153 files changed

+4239
-2152
lines changed

.circleci/config.yml

+2-1
Original file line numberDiff line numberDiff line change
@@ -857,7 +857,8 @@ jobs:
857857
command: |
858858
TESTFILES=$(circleci tests glob "test/e2e/playwright/swap/**/*.spec.ts")
859859
echo "$TESTFILES"
860-
echo "$TESTFILES" | timeout 20m circleci tests run --command="xvfb-run xargs yarn playwright test --project=swap" verbose
860+
echo "$TESTFILES" | timeout 20m circleci tests run --command="xvfb-run xargs yarn playwright test --project=swap" verbose || true
861+
# above line makes it never fail, and these tests are going away soon
861862
no_output_timeout: 10m
862863
- slack/notify:
863864
event: fail

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

+3
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,12 @@ on:
44
pull_request:
55
types:
66
- opened
7+
- reopened
8+
- synchronize
79

810
jobs:
911
add-team-label:
12+
if: ${{ !github.event.pull_request.head.repo.fork }}
1013
uses: metamask/github-tools/.github/workflows/add-team-label.yml@18af6e4b56a18230d1792480e249ebc50b324927
1114
secrets:
1215
TEAM_LABEL_TOKEN: ${{ secrets.TEAM_LABEL_TOKEN }}

.github/workflows/build-beta.yml

+12-11
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,13 @@ jobs:
77
build-beta:
88
name: Build beta
99
runs-on: ubuntu-latest
10+
env:
11+
# For a `pull_request` event, the branch is `github.head_ref``.
12+
# For a `push` event, the branch is `github.ref_name`.
13+
BRANCH: ${{ github.head_ref || github.ref_name }}
14+
# For a `pull_request` event, the head commit hash is `github.event.pull_request.head.sha`.
15+
# For a `push` event, the head commit hash is `github.sha`.
16+
HEAD_COMMIT_HASH: ${{ github.event.pull_request.head.sha || github.sha }}
1017
steps:
1118
- name: Checkout repository
1219
uses: actions/checkout@v4
@@ -16,17 +23,11 @@ jobs:
1623
# However, we need the head commit (the latest commit pushed to the source branch)
1724
# because in the workflow, we would like to parse the latest commit message.
1825
# Specifying `ref` ensures that the head commit is checked out directly.
19-
# For a `pull_request` event, the head commit hash is `github.event.pull_request.head.sha`.
20-
# For a `push` event, the head commit hash is `github.sha`.
21-
ref: ${{ github.event.pull_request.head.sha || github.sha }}
26+
ref: ${{ env.HEAD_COMMIT_HASH }}
2227

2328
- name: Needs beta build
24-
# For a `pull_request` event, the branch is `github.head_ref``.
25-
# For a `push` event, the branch is `github.ref_name`.
26-
if: ${{ (github.head_ref || github.ref_name) != 'master' }}
29+
if: ${{ env.BRANCH != 'master' }}
2730
id: needs-beta-build
28-
env:
29-
BRANCH: ${{ github.head_ref || github.ref_name }}
3031
run: |
3132
version="${BRANCH/Version-v/}"
3233
commit_message=$(git show -s --format=%s HEAD)
@@ -45,7 +46,7 @@ jobs:
4546
uses: MetaMask/action-checkout-and-setup@v1
4647
with:
4748
is-high-risk-environment: true
48-
ref: ${{ github.event.pull_request.head.sha || github.sha }}
49+
ref: ${{ env.HEAD_COMMIT_HASH }}
4950

5051
- name: Run beta build
5152
if: ${{ steps.needs-beta-build.outputs.NEEDS_BETA_BUILD == 'true' }}
@@ -64,7 +65,7 @@ jobs:
6465
run: yarn validate-source-maps
6566

6667
- name: Upload 'dist-beta' to S3
67-
if: ${{ steps.needs-beta-build.outputs.NEEDS_BETA_BUILD == 'true' }}
68+
if: ${{ steps.needs-beta-build.outputs.NEEDS_BETA_BUILD == 'true' && vars.AWS_REGION && vars.AWS_IAM_ROLE && vars.AWS_S3_BUCKET }}
6869
uses: metamask/github-tools/.github/actions/upload-s3@1233659b3850eb84824d7375e2e0c58eb237701d
6970
with:
7071
aws-region: ${{ vars.AWS_REGION }}
@@ -73,7 +74,7 @@ jobs:
7374
path: dist
7475

7576
- name: Upload 'builds-beta' to S3
76-
if: ${{ steps.needs-beta-build.outputs.NEEDS_BETA_BUILD == 'true' }}
77+
if: ${{ steps.needs-beta-build.outputs.NEEDS_BETA_BUILD == 'true' && vars.AWS_REGION && vars.AWS_IAM_ROLE && vars.AWS_S3_BUCKET }}
7778
uses: metamask/github-tools/.github/actions/upload-s3@1233659b3850eb84824d7375e2e0c58eb237701d
7879
with:
7980
aws-region: ${{ vars.AWS_REGION }}

.github/workflows/build-storybook.yml

+9-4
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,10 @@ jobs:
1010
build-storybook:
1111
name: Build storybook
1212
runs-on: ubuntu-latest
13+
env:
14+
# For a `pull_request` event, the branch is `github.head_ref``.
15+
# For a `push` event, the branch is `github.ref_name`.
16+
BRANCH: ${{ github.head_ref || github.ref_name }}
1317
steps:
1418
- name: Checkout and setup high risk environment
1519
uses: MetaMask/action-checkout-and-setup@v1
@@ -20,6 +24,7 @@ jobs:
2024
run: yarn storybook:build
2125

2226
- name: Upload 'storybook-build' to S3
27+
if: ${{ vars.AWS_REGION && vars.AWS_IAM_ROLE && vars.AWS_S3_BUCKET }}
2328
uses: metamask/github-tools/.github/actions/upload-s3@1233659b3850eb84824d7375e2e0c58eb237701d
2429
with:
2530
aws-region: ${{ vars.AWS_REGION }}
@@ -28,9 +33,9 @@ jobs:
2833
path: storybook-build
2934

3035
- name: Deploy storybook
31-
# For a `pull_request` event, the branch is `github.head_ref``.
32-
# For a `push` event, the branch is `github.ref_name`.
33-
if: ${{ (github.head_ref || github.ref_name) == 'main' }}
36+
if: ${{ env.BRANCH == 'main' && env.STORYBOOK_TOKEN }}
37+
env:
38+
STORYBOOK_TOKEN: ${{ secrets.STORYBOOK_TOKEN }}
3439
run: |
35-
git remote add storybook https://${{ secrets.STORYBOOK_TOKEN }}@github.com/MetaMask/metamask-storybook.git
40+
git remote add storybook "https://${STORYBOOK_TOKEN}@github.com/MetaMask/metamask-storybook.git"
3641
yarn storybook:deploy

.github/workflows/identify-codeowners.yml

+2-1
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,8 @@ on:
44
pull_request:
55
types:
66
- opened
7-
- synchronize
87
- reopened
8+
- synchronize
99
- ready_for_review
1010

1111
jobs:
@@ -19,6 +19,7 @@ jobs:
1919
skip-allow-scripts: true
2020

2121
- name: Identify codeowners
22+
if: ${{ env.PR_COMMENT_TOKEN }}
2223
env:
2324
PR_COMMENT_TOKEN: ${{ secrets.PR_COMMENT_TOKEN }}
2425
run: yarn tsx ./.github/scripts/identify-codeowners.ts

.github/workflows/main.yml

+5-4
Original file line numberDiff line numberDiff line change
@@ -17,9 +17,6 @@ on:
1717
jobs:
1818
prep-deps:
1919
runs-on: ubuntu-latest
20-
# For a `pull_request` event, the branch is `github.head_ref``.
21-
# For a `push` event, the branch is `github.ref_name`.
22-
if: ${{ (github.head_ref || github.ref_name) != 'l10n_crowdin_action' }}
2320
steps:
2421
- name: Checkout and setup environment
2522
uses: MetaMask/action-checkout-and-setup@v1
@@ -176,6 +173,9 @@ jobs:
176173
# For a `pull_request` event, the branch is `github.head_ref``.
177174
# For a `push` event, the branch is `github.ref_name`.
178175
BRANCH: ${{ github.head_ref || github.ref_name }}
176+
# For a `pull_request` event, the fork is `github.event.pull_request.head.repo.fork`.
177+
# For a `push` event, the fork is `github.event.repository.fork`.
178+
IS_FORK: ${{ github.event.pull_request.head.repo.fork || github.event.repository.fork }}
179179
permissions:
180180
contents: read
181181
# id-token permission is required for uploading to s3
@@ -197,10 +197,11 @@ jobs:
197197
run: yarn tsx test/e2e/mv3-perf-stats/bundle-size.ts --out test-artifacts/chrome
198198

199199
- name: Record bundle size at commit
200-
if: ${{ env.BRANCH == 'main' }}
200+
if: ${{ env.BRANCH == 'main' && !env.IS_FORK }}
201201
run: ./.github/scripts/bundle-stats-commit.sh
202202

203203
- name: Upload 'bundle-size' to S3
204+
if: ${{ vars.AWS_REGION && vars.AWS_IAM_ROLE && vars.AWS_S3_BUCKET }}
204205
uses: metamask/github-tools/.github/actions/upload-s3@1233659b3850eb84824d7375e2e0c58eb237701d
205206
with:
206207
aws-region: ${{ vars.AWS_REGION }}

.github/workflows/needs-e2e.yml

+30-12
Original file line numberDiff line numberDiff line change
@@ -9,23 +9,16 @@ on:
99

1010
jobs:
1111
needs-e2e:
12-
name: Needs E2E
1312
runs-on: ubuntu-latest
1413
outputs:
1514
needs-e2e: ${{ steps.needs-e2e.outputs.NEEDS_E2E }}
1615
env:
17-
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
18-
# For a `pull_request` event, the branch is `github.head_ref``.
19-
# For a `push` event, the branch is `github.ref_name`.
20-
BRANCH: ${{ github.head_ref || github.ref_name }}
2116
# For a `pull_request` event, the head commit hash is `github.event.pull_request.head.sha`.
2217
# For a `push` event, the head commit hash is `github.sha`.
2318
HEAD_COMMIT_HASH: ${{ github.event.pull_request.head.sha || github.sha }}
2419
steps:
25-
- name: Checkout and setup environment
26-
uses: MetaMask/action-checkout-and-setup@v1
20+
- uses: actions/checkout@v4
2721
with:
28-
is-high-risk-environment: false
2922
# By default, the checkout action checks out the last merge commit for pull requests.
3023
# Source: https://docs.github.com/en/actions/writing-workflows/choosing-when-your-workflow-runs/events-that-trigger-workflows#pull_request
3124
# However, we need the head commit (the latest commit pushed to the source branch)
@@ -37,15 +30,38 @@ jobs:
3730
id: needs-e2e
3831
run: |
3932
if git show --format='%B' --no-patch "${HEAD_COMMIT_HASH}" | grep --fixed-strings --quiet '[skip e2e]'; then
40-
printf '%s\n' "${HEAD_COMMIT_HASH} contains the tag '[skip e2e]' so e2e tests will not run"
33+
printf '%s\n' "Commit message of '${HEAD_COMMIT_HASH}' contains the substring '[skip e2e]' so e2e tests will not run"
4134
echo "NEEDS_E2E=false" >> "$GITHUB_OUTPUT"
4235
else
43-
printf '%s\n' "${HEAD_COMMIT_HASH} does not contain the tag '[skip e2e]' so e2e tests will run"
36+
printf '%s\n' "Commit message of '${HEAD_COMMIT_HASH}' does not contain the substring '[skip e2e]' so e2e tests will run"
4437
echo "NEEDS_E2E=true" >> "$GITHUB_OUTPUT"
4538
fi
4639
40+
changed-files:
41+
# For a `pull_request` event, the branch is `github.head_ref``.
42+
# For a `push` event, the branch is `github.ref_name`.
43+
if: ${{ needs.needs-e2e.outputs.needs-e2e == 'true' && (github.head_ref || github.ref_name) != 'master' }}
44+
needs:
45+
- needs-e2e
46+
runs-on: ubuntu-latest
47+
env:
48+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
49+
# For a `pull_request` event, the head commit hash is `github.event.pull_request.head.sha`.
50+
# For a `push` event, the head commit hash is `github.sha`.
51+
HEAD_COMMIT_HASH: ${{ github.event.pull_request.head.sha || github.sha }}
52+
steps:
53+
- name: Checkout and setup environment
54+
uses: MetaMask/action-checkout-and-setup@v1
55+
with:
56+
is-high-risk-environment: false
57+
# By default, the checkout action checks out the last merge commit for pull requests.
58+
# Source: https://docs.github.com/en/actions/writing-workflows/choosing-when-your-workflow-runs/events-that-trigger-workflows#pull_request
59+
# However, we need the head commit (the latest commit pushed to the source branch)
60+
# because in the workflow, we would like to parse the latest commit tag.
61+
# Specifying `ref` ensures that the head commit is checked out directly.
62+
ref: ${{ env.HEAD_COMMIT_HASH }}
63+
4764
- name: Get changed files with git diff
48-
if: ${{ steps.needs-e2e.outputs.NEEDS_E2E == 'true' && env.BRANCH != 'master' }}
4965
run: yarn tsx .github/scripts/git-diff-default-branch.ts
5066

5167
- name: Upload changed files artifact
@@ -55,8 +71,10 @@ jobs:
5571
path: ./changed-files/
5672

5773
run-e2e-pom-validation:
74+
if: ${{ needs.needs-e2e.outputs.needs-e2e == 'true' && (github.head_ref || github.ref_name) != 'master' }}
5875
needs:
5976
- needs-e2e
77+
- changed-files
6078
runs-on: ubuntu-latest
6179
steps:
6280
- name: Checkout and setup environment
@@ -65,8 +83,8 @@ jobs:
6583
is-high-risk-environment: false
6684

6785
- name: Download changed-files artifact
68-
continue-on-error: true
6986
uses: actions/download-artifact@v4
87+
continue-on-error: true
7088
with:
7189
name: changed-files
7290
path: ./changed-files/

.github/workflows/publish-prerelease.yml

+15-10
Original file line numberDiff line numberDiff line change
@@ -32,25 +32,30 @@ jobs:
3232
env:
3333
OWNER: ${{ github.repository_owner }}
3434
REPOSITORY: ${{ github.event.repository.name }}
35-
# For a `pull_request` event, the branch is `github.head_ref``.
36-
BRANCH: ${{ github.head_ref }}
35+
# For a `pull_request` event, the fork is `github.event.pull_request.head.repo.fork`, and the branch is `github.head_ref`.
36+
BRANCH: ${{ github.event.pull_request.head.repo.fork && format('pull/{0}', github.event.pull_request.number) || github.head_ref }}
3737
# For a `pull_request` event, the head commit hash is `github.event.pull_request.head.sha`.
3838
HEAD_COMMIT_HASH: ${{ github.event.pull_request.head.sha }}
3939
JOB_NAME: job-publish-prerelease
4040
run: |
41-
pipeline_id=$(curl --silent "https://circleci.com/api/v2/project/gh/$OWNER/$REPOSITORY/pipeline?branch=$BRANCH" | jq --arg head_commit_hash "${HEAD_COMMIT_HASH}" -r '.items | map(select(.vcs.revision == $head_commit_hash)) | first | .id')
42-
workflow_id=$(curl --silent "https://circleci.com/api/v2/pipeline/$pipeline_id/workflow" | jq -r ".items[0].id")
43-
job_details=$(curl --silent "https://circleci.com/api/v2/workflow/$workflow_id/job" | jq --arg job_name "${JOB_NAME}" -r '.items[] | select(.name == $job_name)')
41+
pipeline=$(curl --silent "https://circleci.com/api/v2/project/gh/${OWNER}/${REPOSITORY}/pipeline?branch=${BRANCH}" | jq --arg head_commit_hash "${HEAD_COMMIT_HASH}" -r '.items | map(select(.vcs.revision == $head_commit_hash)) | first')
42+
pipeline_id=$(echo "${pipeline}" | jq -r '.id')
43+
pipeline_number=$(echo "${pipeline}" | jq -r '.number')
4444
45-
build_num=$(echo "$job_details" | jq -r '.job_number')
46-
echo 'CIRCLE_BUILD_NUM='"$build_num" >> "$GITHUB_OUTPUT"
45+
workflow=$(curl --silent "https://circleci.com/api/v2/pipeline/${pipeline_id}/workflow" | jq -r '.items[0]')
46+
workflow_id=$(echo "${workflow}" | jq -r '.id')
4747
48-
job_id=$(echo "$job_details" | jq -r '.id')
49-
echo 'CIRCLE_WORKFLOW_JOB_ID='"$job_id" >> "$GITHUB_OUTPUT"
48+
job=$(curl --silent "https://circleci.com/api/v2/workflow/${workflow_id}/job" | jq --arg job_name "${JOB_NAME}" -r '.items[] | select(.name == $job_name)')
49+
job_id=$(echo "${job}" | jq -r '.id')
50+
job_number=$(echo "${job}" | jq -r '.job_number')
5051
51-
echo "Getting artifacts from pipeline '${pipeline_id}', workflow '${workflow_id}', build number '${build_num}', job id '${job_id}'"
52+
echo "CIRCLE_WORKFLOW_JOB_ID=${job_id}" >> "$GITHUB_OUTPUT"
53+
echo "CIRCLE_BUILD_NUM=${job_number}" >> "$GITHUB_OUTPUT"
54+
55+
echo "Getting artifacts from pipeline number '${pipeline_number}', workflow id '${workflow_id}', job number '${job_number}' at https://app.circleci.com/pipelines/github/${OWNER}/${REPOSITORY}/${pipeline_number}/workflows/${workflow_id}/jobs/${job_number}/artifacts"
5256
5357
- name: Publish prerelease
58+
if: ${{ env.PR_COMMENT_TOKEN && vars.AWS_CLOUDFRONT_URL }}
5459
env:
5560
PR_COMMENT_TOKEN: ${{ secrets.PR_COMMENT_TOKEN }}
5661
PR_NUMBER: ${{ github.event.pull_request.number }}

.github/workflows/run-benchmarks.yml

+1
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,7 @@ jobs:
4242
run: ${{ format(fromJson(env.COMMANDS)[matrix.testType], matrix.browser, matrix.buildType) }}
4343

4444
- name: Upload '${{ env.OUTPUT_NAME }}' to S3
45+
if: ${{ vars.AWS_REGION && vars.AWS_IAM_ROLE && vars.AWS_S3_BUCKET }}
4546
uses: metamask/github-tools/.github/actions/upload-s3@1233659b3850eb84824d7375e2e0c58eb237701d
4647
with:
4748
aws-region: ${{ vars.AWS_REGION }}

.github/workflows/run-e2e.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ on:
2121
description: The test command to run
2222
test-timeout-minutes:
2323
type: number
24-
default: 30
24+
default: 40
2525
description: The timeout in minutes for the test command
2626
matrix-index:
2727
type: number

.github/workflows/wait-for-circleci-workflow-status.yml

+17-11
Original file line numberDiff line numberDiff line change
@@ -12,26 +12,32 @@ jobs:
1212
env:
1313
OWNER: ${{ github.repository_owner }}
1414
REPOSITORY: ${{ github.event.repository.name }}
15-
# For a `pull_request` event, the branch is `github.head_ref``.
16-
# For a `push` event, the branch is `github.ref_name`.
17-
BRANCH: ${{ github.head_ref || github.ref_name }}
15+
# For a `pull_request` event, the fork is `github.event.pull_request.head.repo.fork`, and the branch is `github.head_ref`.
16+
# For a `push` event, the fork is `github.event.repository.fork`, and the branch is `github.ref_name`.
17+
BRANCH: ${{ (github.event.pull_request.head.repo.fork || github.event.repository.fork) && format('pull/{0}', github.event.pull_request.number) || (github.head_ref || github.ref_name) }}
1818
# For a `pull_request` event, the head commit hash is `github.event.pull_request.head.sha`.
1919
# For a `push` event, the head commit hash is `github.sha`.
2020
HEAD_COMMIT_HASH: ${{ github.event.pull_request.head.sha || github.sha }}
2121
run: |
22-
pipeline_id=$(curl --silent "https://circleci.com/api/v2/project/gh/$OWNER/$REPOSITORY/pipeline?branch=$BRANCH" | jq --arg head_commit_hash "${HEAD_COMMIT_HASH}" -r '.items | map(select(.vcs.revision == $head_commit_hash)) | first | .id')
23-
echo "Waiting for pipeline '${pipeline_id}', commit hash '${HEAD_COMMIT_HASH}'"
24-
workflow_status=$(curl --silent "https://circleci.com/api/v2/pipeline/$pipeline_id/workflow" | jq -r ".items[0].status")
22+
pipeline=$(curl --silent "https://circleci.com/api/v2/project/gh/${OWNER}/${REPOSITORY}/pipeline?branch=${BRANCH}" | jq --arg head_commit_hash "${HEAD_COMMIT_HASH}" -r '.items | map(select(.vcs.revision == $head_commit_hash)) | first')
23+
pipeline_id=$(echo "${pipeline}" | jq -r '.id')
24+
pipeline_number=$(echo "${pipeline}" | jq -r '.number')
2525
26-
if [ "$workflow_status" == "running" ]; then
27-
while [ "$workflow_status" == "running" ]; do
26+
workflow=$(curl --silent "https://circleci.com/api/v2/pipeline/${pipeline_id}/workflow" | jq -r '.items[0]')
27+
workflow_id=$(echo "${workflow}" | jq -r '.id')
28+
workflow_status=$(echo "${workflow}" | jq -r '.status')
29+
30+
echo "Waiting for pipeline number '${pipeline_number}', workflow id '${workflow_id}' at https://app.circleci.com/pipelines/github/${OWNER}/${REPOSITORY}/${pipeline_number}/workflows/${workflow_id}"
31+
32+
if [ "${workflow_status}" == "running" ]; then
33+
while [ "${workflow_status}" == "running" ]; do
2834
sleep 30
29-
workflow_status=$(curl --silent "https://circleci.com/api/v2/pipeline/$pipeline_id/workflow" | jq -r ".items[0].status")
35+
workflow_status=$(curl --silent "https://circleci.com/api/v2/pipeline/${pipeline_id}/workflow" | jq -r ".items[0].status")
3036
done
3137
fi
3238
3339
# The "not_run" only happens when you're developing CI workflows and testing weird cases
34-
if [ "$workflow_status" != "success" ] && [ "$workflow_status" != "not_run" ]; then
35-
echo "::error::Workflow status is '$workflow_status'. Exiting with error."
40+
if [ "${workflow_status}" != "success" ] && [ "${workflow_status}" != "not_run" ]; then
41+
echo "::error::Workflow status is '${workflow_status}'. Exiting with error."
3642
exit 1
3743
fi

0 commit comments

Comments
 (0)