Skip to content

Commit

Permalink
Merge branch 'develop' into 2845-permit-design-review
Browse files Browse the repository at this point in the history
  • Loading branch information
digiwand committed Aug 19, 2024
2 parents ed9b488 + e3aef95 commit e96dbfe
Show file tree
Hide file tree
Showing 662 changed files with 26,697 additions and 20,540 deletions.
132 changes: 68 additions & 64 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -163,6 +163,9 @@ workflows:
- prep-build-test-mv2:
requires:
- prep-deps
- prep-build-test-webpack:
requires:
- prep-deps
- prep-build-test-flask:
requires:
- prep-deps
Expand Down Expand Up @@ -193,6 +196,10 @@ workflows:
- test-lint-changelog:
requires:
- prep-deps
- test-e2e-chrome-webpack:
requires:
- prep-build-test-webpack
- get-changed-files-with-git-diff
- test-e2e-chrome:
requires:
- prep-build-test
Expand Down Expand Up @@ -293,6 +300,7 @@ workflows:
- test-e2e-chrome-mmi
- test-e2e-chrome-rpc-mmi
- test-e2e-chrome-vault-decryption
- test-e2e-chrome-webpack
- test-storybook
- benchmark:
requires:
Expand Down Expand Up @@ -381,8 +389,7 @@ jobs:
steps:
- run:
name: Build beta prod
command: |
.circleci/scripts/trigger-beta-build.sh
command: .circleci/scripts/trigger-beta-build.sh
- run:
name: Move beta build to 'dist-beta' to avoid conflict with production build
command: mv ./dist ./dist-beta
Expand All @@ -396,9 +403,9 @@ jobs:
- builds-beta

create_release_pull_request:
executor: node-browsers-small
executor: node-browsers-medium
steps:
- run: *shallow-git-clone
- checkout
- run: sudo corepack enable
- attach_workspace:
at: .
Expand Down Expand Up @@ -455,8 +462,7 @@ jobs:
- run: sudo corepack enable
- run:
name: Save Yarn version
command: |
yarn --version > /tmp/YARN_VERSION
command: yarn --version > /tmp/YARN_VERSION
- restore_cache:
keys:
# First try to get the specific cache for the checksum of the yarn.lock file.
Expand Down Expand Up @@ -904,6 +910,26 @@ jobs:
- dist-test-mv2
- builds-test-mv2

prep-build-test-webpack:
executor: node-linux-medium
steps:
- run: *shallow-git-clone
- attach_workspace:
at: .
- run:
name: Activate yarn
command: corepack enable
- run:
name: Build extension for testing
command: yarn build:test:webpack
- run:
name: Move test build to 'dist-test-webpack' to avoid conflict with production build
command: mv ./dist ./dist-test-webpack
- persist_to_workspace:
root: .
paths:
- dist-test-webpack

prep-build-storybook:
executor: node-linux-medium
steps:
Expand Down Expand Up @@ -1045,6 +1071,27 @@ jobs:
name: depcheck
command: yarn depcheck

test-e2e-chrome-webpack:
executor: node-browsers-medium-plus
parallelism: 20
steps:
- run: *shallow-git-clone
- run: sudo corepack enable
- attach_workspace:
at: .
- run:
name: Move test build to dist
command: mv ./dist-test-webpack ./dist
- run:
name: test:e2e:chrome:webpack
command: .circleci/scripts/test-run-e2e.sh yarn test:e2e:chrome:webpack
no_output_timeout: 5m
- store_artifacts:
path: test-artifacts
destination: test-artifacts
- store_test_results:
path: test/test-results/e2e

test-api-specs:
executor: node-browsers-medium-plus
steps:
Expand All @@ -1061,8 +1108,7 @@ jobs:
- gh/install
- run:
name: test:api-specs
command: |
timeout 20m yarn test:api-specs --retries 2
command: .circleci/scripts/test-run-e2e.sh yarn test:api-specs
no_output_timeout: 5m
- run:
name: Comment on PR
Expand Down Expand Up @@ -1093,11 +1139,7 @@ jobs:
command: mv ./builds-test ./builds
- run:
name: test:e2e:chrome
command: |
if .circleci/scripts/test-run-e2e.sh
then
timeout 20m yarn test:e2e:chrome --retries 1
fi
command: .circleci/scripts/test-run-e2e.sh yarn test:e2e:chrome
no_output_timeout: 5m
- store_artifacts:
path: test-artifacts
Expand All @@ -1121,11 +1163,7 @@ jobs:
command: mv ./builds-test ./builds
- run:
name: test:e2e:chrome:rpc
command: |
if .circleci/scripts/test-run-e2e.sh
then
timeout 20m yarn test:e2e:chrome:rpc --retries 1
fi
command: .circleci/scripts/test-run-e2e.sh yarn test:e2e:chrome:rpc
no_output_timeout: 5m
- store_artifacts:
path: test-artifacts
Expand All @@ -1149,11 +1187,7 @@ jobs:
command: mv ./builds-test ./builds
- run:
name: test:e2e:chrome:multi-provider
command: |
if .circleci/scripts/test-run-e2e.sh
then
yarn test:e2e:chrome:multi-provider --retries 1
fi
command: .circleci/scripts/test-run-e2e.sh yarn test:e2e:chrome:multi-provider
no_output_timeout: 5m
- store_artifacts:
path: test-artifacts
Expand All @@ -1176,11 +1210,7 @@ jobs:
command: mv ./builds-test-mmi ./builds
- run:
name: test:e2e:chrome:rpc
command: |
if .circleci/scripts/test-run-e2e.sh
then
timeout 20m yarn test:e2e:chrome:rpc --retries 1 --build-type=mmi
fi
command: .circleci/scripts/test-run-e2e.sh yarn test:e2e:chrome:rpc --build-type=mmi
no_output_timeout: 5m
- store_artifacts:
path: test-artifacts
Expand All @@ -1196,12 +1226,8 @@ jobs:
- attach_workspace:
at: .
- run:
name: test:e2e:chrome:vault
command: |
if .circleci/scripts/test-run-e2e.sh
then
yarn test:e2e:single test/e2e/vault-decryption-chrome.spec.js --browser chrome --retries 1
fi
name: test:e2e:single
command: .circleci/scripts/test-run-e2e.sh yarn test:e2e:single test/e2e/vault-decryption-chrome.spec.js --browser chrome
no_output_timeout: 5m
- store_artifacts:
path: test-artifacts
Expand All @@ -1225,12 +1251,7 @@ jobs:
command: mv ./builds-test-flask-mv2 ./builds
- run:
name: test:e2e:firefox:flask
command: |
export ENABLE_MV3=false
if .circleci/scripts/test-run-e2e.sh
then
timeout 20m yarn test:e2e:firefox:flask --retries 1
fi
command: ENABLE_MV3=false .circleci/scripts/test-run-e2e.sh yarn test:e2e:firefox:flask
no_output_timeout: 5m
- store_artifacts:
path: test-artifacts
Expand All @@ -1254,11 +1275,7 @@ jobs:
command: mv ./builds-test-flask ./builds
- run:
name: test:e2e:chrome:flask
command: |
if .circleci/scripts/test-run-e2e.sh
then
timeout 20m yarn test:e2e:chrome:flask --retries 1
fi
command: .circleci/scripts/test-run-e2e.sh yarn test:e2e:chrome:flask
no_output_timeout: 5m
- store_artifacts:
path: test-artifacts
Expand All @@ -1282,11 +1299,7 @@ jobs:
command: mv ./builds-test-mmi ./builds
- run:
name: test:e2e:chrome:mmi
command: |
if .circleci/scripts/test-run-e2e.sh
then
timeout 20m yarn test:e2e:chrome:mmi --retries 1 --build-type=mmi
fi
command: .circleci/scripts/test-run-e2e.sh yarn test:e2e:chrome:mmi --build-type=mmi
no_output_timeout: 5m
- store_artifacts:
path: test-artifacts
Expand All @@ -1308,8 +1321,7 @@ jobs:
command: mv ./dist-test-mmi-playwright ./dist
- run:
name: Install chromium
command: |
yarn playwright install chromium
command: yarn playwright install chromium
- run:
name: test:e2e:chrome:mmi
command: |
Expand Down Expand Up @@ -1346,8 +1358,7 @@ jobs:
at: .
- run:
name: Install chromium
command: |
yarn playwright install chromium
command: yarn playwright install chromium
- run:
name: test:e2e:chrome:swap
command: |
Expand Down Expand Up @@ -1383,12 +1394,7 @@ jobs:
command: mv ./builds-test-mv2 ./builds
- run:
name: test:e2e:firefox
command: |
export ENABLE_MV3=false
if .circleci/scripts/test-run-e2e.sh
then
timeout 20m yarn test:e2e:firefox --retries 1
fi
command: ENABLE_MV3=false .circleci/scripts/test-run-e2e.sh yarn test:e2e:firefox
no_output_timeout: 5m
- store_artifacts:
path: test-artifacts
Expand Down Expand Up @@ -1566,8 +1572,7 @@ jobs:
command: yarn sentry:publish --build-type mmi
- run:
name: Create GitHub release
command: |
.circleci/scripts/release-create-gh-release.sh
command: .circleci/scripts/release-create-gh-release.sh

job-publish-storybook:
executor: node-browsers-small
Expand Down Expand Up @@ -1623,8 +1628,7 @@ jobs:
at: .
- run:
name: Validate source maps
command: |
.circleci/scripts/validate-source-maps-beta.sh
command: .circleci/scripts/validate-source-maps-beta.sh

validate-source-maps-mmi:
executor: node-browsers-small
Expand Down
2 changes: 1 addition & 1 deletion .circleci/scripts/release-create-gh-release.sh
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ then
install_github_cli

printf '%s\n' 'Creating GitHub Release'
release_body="$(awk -v version="${tag##v}" -f .circleci/scripts/show-changelog.awk CHANGELOG.md)"
release_body="$(awk -v version="[${tag##v}]" -f .circleci/scripts/show-changelog.awk CHANGELOG.md)"
hub release create \
--attach builds/metamask-chrome-*.zip \
--attach builds-mv2/metamask-firefox-*.zip \
Expand Down
12 changes: 12 additions & 0 deletions .circleci/scripts/test-run-e2e.sh
Original file line number Diff line number Diff line change
Expand Up @@ -11,4 +11,16 @@ then
exit 1
fi

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

# Error code 124 means the command timed out
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'
rm -rf test/test-results/e2e
exit 124
fi

exit 0
17 changes: 17 additions & 0 deletions .depcheckrc.yml
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,23 @@ ignores:
- 'resolve-url-loader'
# jest environments
- 'jest-environment-jsdom'
# webpack
- '@pmmmwh/react-refresh-webpack-plugin' # dev tool
- 'webpack-dev-server' # dev tool
- 'html-bundler-webpack-plugin' # build tool
- 'postcss-loader' # build tool
- '@swc/helpers' # build tool
- browserslist # build tool
- 'buffer' # polyfill
- 'crypto-browserify' # polyfill
- 'process' # polyfill
- 'stream-http' # polyfill
- 'rimraf' # misc: install helper
- 'json-schema-to-ts' # misc: typescript helper
- 'https-browserify' # polyfill
- 'path-browserify' # polyfill
- 'nyc' # coverage
- 'core-js-pure' # polyfills
# babel
- '@babel/plugin-transform-logical-assignment-operators'
# trezor
Expand Down
5 changes: 2 additions & 3 deletions .devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@
],
"settings": {
"editor.formatOnSave": true,
"git.autofetch": true,
"git.ignoreRebaseWarning": true,
"git.rebaseWhenSync": true,
"gitlens.showWelcomeOnInstall": false
Expand Down Expand Up @@ -48,13 +47,13 @@
}
},

"postAttachCommand": "/usr/local/share/desktop-init.sh && git pull --rebase; yarn download-builds",
"postAttachCommand": "/usr/local/share/desktop-init.sh && git pull; yarn download-builds",

// This is a working Infura key, but it's on the Free Plan and has very limited requests per second
// If you want to use your own INFURA_PROJECT_ID, follow the instructions in README.md
"postCreateCommand": "if [ -z \"$INFURA_PROJECT_ID\" ]; then echo 'INFURA_PROJECT_ID=3d110a0fce9e49b08d2ee584e19a05ba' > .metamaskrc; fi",

"runArgs": ["--shm-size=1g"],

"updateContentCommand": "sudo .devcontainer/install.sh && yarn --immutable && yarn tsx .devcontainer/setup-browsers.ts && echo 'export DISPLAY=:1' >> ~/.bashrc"
"updateContentCommand": "sudo .devcontainer/install.sh && corepack enable && COREPACK_ENABLE_DOWNLOAD_PROMPT=0 yarn --immutable && yarn tsx .devcontainer/setup-browsers.ts && echo 'export DISPLAY=:1' >> ~/.bashrc"
}
6 changes: 5 additions & 1 deletion .devcontainer/download-builds.ts
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,11 @@ async function getBuilds(branch: string, jobNames: string[]) {

const artifacts = await response.json();

if (!artifacts || artifacts.length === 0) {
if (
!artifacts ||
artifacts.length === 0 ||
artifacts.message === 'Not Found'
) {
return [];
}

Expand Down
Loading

0 comments on commit e96dbfe

Please sign in to comment.