Skip to content

Commit

Permalink
Merge branch 'develop' into fix/linea-token-detection
Browse files Browse the repository at this point in the history
  • Loading branch information
gauthierpetetin authored Oct 12, 2023
2 parents 571f6f9 + 7ba9654 commit b9d9477
Show file tree
Hide file tree
Showing 787 changed files with 39,170 additions and 21,141 deletions.
142 changes: 132 additions & 10 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -125,6 +125,9 @@ workflows:
- prep-build-test-flask:
requires:
- prep-deps
- prep-build-test-mmi:
requires:
- prep-deps
- prep-build-storybook:
requires:
- prep-deps
Expand Down Expand Up @@ -162,6 +165,12 @@ workflows:
- test-e2e-firefox-snaps-flask:
requires:
- prep-build-test-flask
- test-e2e-chrome-mmi:
requires:
- prep-build-test-mmi
- test-e2e-chrome-rpc-mmi:
requires:
- prep-build-test-mmi
- test-e2e-chrome-mv3:
requires:
- prep-build-test-mv3
Expand Down Expand Up @@ -246,6 +255,10 @@ workflows:
- test-e2e-firefox
- test-e2e-chrome-snaps
- test-e2e-firefox-snaps
- test-e2e-chrome-snaps-flask
- test-e2e-firefox-snaps-flask
- test-e2e-chrome-mmi
- test-e2e-chrome-rpc-mmi
- test-storybook
- benchmark:
requires:
Expand Down Expand Up @@ -348,23 +361,28 @@ jobs:
executor: node-browsers
steps:
- run: *shallow-git-clone
- run:
name: Save 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.
# This cache key lookup will fail if the lock file is modified and a cache
# has not yet been persisted for the new checksum.
- dependency-cache-v1-{{ checksum "yarn.lock" }}
- dependency-cache-{{ checksum "/tmp/YARN_VERSION" }}-{{ checksum "yarn.lock" }}
# To prevent having to do a full install of every node_module when
# dependencies change, restore from the last known cache of any
# branch/checksum, the install step will remove cached items that are no longer
# required and add the new dependencies, and the cache will be persisted.
- dependency-cache-v1-
# branch/checksum with the same Yarn version, the install step will remove
# cached items that are no longer required and add the new dependencies, and
# the cache will be persisted.
- dependency-cache-{{ checksum "/tmp/YARN_VERSION" }}-
- gh/install
- run:
name: Install dependencies
command: .circleci/scripts/install-dependencies.sh
- save_cache:
key: dependency-cache-v1-{{ checksum "yarn.lock" }}
key: dependency-cache-{{ checksum "/tmp/YARN_VERSION" }}-{{ checksum "yarn.lock" }}
paths:
- .yarn/cache
- persist_to_workspace:
Expand Down Expand Up @@ -566,17 +584,38 @@ jobs:
name: Build extension for testing
command: yarn build:test:flask
- run:
name: Move test build to 'dist-test' to avoid conflict with production build
name: Move test build to 'dist-test-flask' to avoid conflict with production build
command: mv ./dist ./dist-test-flask
- run:
name: Move test zips to 'builds-test' to avoid conflict with production build
name: Move test zips to 'builds-test-flask' to avoid conflict with production build
command: mv ./builds ./builds-test-flask
- persist_to_workspace:
root: .
paths:
- dist-test-flask
- builds-test-flask

prep-build-test-mmi:
executor: node-browsers-medium-plus
steps:
- run: *shallow-git-clone
- attach_workspace:
at: .
- run:
name: Build extension for testing
command: yarn build:test:mmi
- run:
name: Move test build to 'dist-test' to avoid conflict with production build
command: mv ./dist ./dist-test-mmi
- run:
name: Move test zips to 'builds-test' to avoid conflict with production build
command: mv ./builds ./builds-test-mmi
- persist_to_workspace:
root: .
paths:
- dist-test-mmi
- builds-test-mmi

prep-build-test-mv3:
executor: node-browsers-medium-plus
steps:
Expand All @@ -590,7 +629,7 @@ jobs:
name: Move test build to 'dist-test' to avoid conflict with production build
command: mv ./dist ./dist-test-mv3
- run:
name: Move test zips to 'builds-test' to avoid conflict with production build
name: Move test zips to 'builds-test-mv3' to avoid conflict with production build
command: mv ./builds ./builds-test-mv3
- persist_to_workspace:
root: .
Expand Down Expand Up @@ -853,6 +892,42 @@ jobs:
- store_test_results:
path: test/test-results/e2e.xml

test-e2e-chrome-rpc-mmi:
executor: node-browsers
steps:
- checkout
- run:
name: Re-Install Chrome
command: ./.circleci/scripts/chrome-install.sh
- attach_workspace:
at: .
- run:
name: Move test build to dist
command: mv ./dist-test-mmi ./dist
- run:
name: Move test zips to builds
command: mv ./builds-test-mmi ./builds
- run:
name: test:e2e:chrome:rpc
command: |
if .circleci/scripts/test-run-e2e.sh
then
yarn test:e2e:chrome:rpc --retries 2 --debug --build-type=mmi
fi
no_output_timeout: 20m
- run:
name: Merge JUnit report
command: |
if [ "$(ls -A test/test-results/e2e)" ]; then
yarn test:e2e:report
fi
when: always
- store_artifacts:
path: test-artifacts
destination: test-artifacts
- store_test_results:
path: test/test-results/e2e.xml

test-e2e-firefox-snaps:
executor: node-browsers
parallelism: 4
Expand Down Expand Up @@ -948,7 +1023,7 @@ jobs:
command: |
if .circleci/scripts/test-run-e2e.sh
then
yarn test:e2e:firefox:snaps --retries 2 --debug
yarn test:e2e:firefox:snaps --retries 2 --debug --build-type=flask
fi
no_output_timeout: 20m
- run:
Expand Down Expand Up @@ -985,7 +1060,44 @@ jobs:
command: |
if .circleci/scripts/test-run-e2e.sh
then
yarn test:e2e:chrome:snaps --retries 2 --debug
yarn test:e2e:chrome:snaps --retries 2 --debug --build-type=flask
fi
no_output_timeout: 20m
- run:
name: Merge JUnit report
command: |
if [ "$(ls -A test/test-results/e2e)" ]; then
yarn test:e2e:report
fi
when: always
- store_artifacts:
path: test-artifacts
destination: test-artifacts
- store_test_results:
path: test/test-results/e2e.xml

test-e2e-chrome-mmi:
executor: node-browsers
parallelism: 4
steps:
- run: *shallow-git-clone
- run:
name: Re-Install Chrome
command: ./.circleci/scripts/chrome-install.sh
- attach_workspace:
at: .
- run:
name: Move test build to dist
command: mv ./dist-test-mmi ./dist
- run:
name: Move test zips to builds
command: mv ./builds-test-mmi ./builds
- run:
name: test:e2e:chrome:mmi
command: |
if .circleci/scripts/test-run-e2e.sh
then
yarn test:e2e:chrome:mmi --retries 2 --debug --build-type=mmi
fi
no_output_timeout: 20m
- run:
Expand Down Expand Up @@ -1157,6 +1269,13 @@ jobs:
- store_artifacts:
path: builds-flask
destination: builds-flask
- store_artifacts:
path: builds-mmi
destination: builds-mmi
- store_artifacts:
path: builds-test
- store_artifacts:
path: builds-test-flask
- store_artifacts:
path: coverage
destination: coverage
Expand Down Expand Up @@ -1199,6 +1318,9 @@ jobs:
- run:
name: Publish Flask release to Sentry
command: yarn sentry:publish --build-type flask
- run:
name: Publish MMI release to Sentry
command: yarn sentry:publish --build-type mmi
- run:
name: Create GitHub release
command: |
Expand Down
4 changes: 2 additions & 2 deletions .circleci/scripts/chrome-install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,12 @@ set -o pipefail
sudo apt-get update

# To get the latest version, see <https://www.ubuntuupdates.org/ppa/google_chrome?dist=stable>
CHROME_VERSION='114.0.5735.133-1'
CHROME_VERSION='116.0.5845.179-1'
CHROME_BINARY="google-chrome-stable_${CHROME_VERSION}_amd64.deb"
CHROME_BINARY_URL="https://dl.google.com/linux/chrome/deb/pool/main/g/google-chrome-stable/${CHROME_BINARY}"

# To retrieve this checksum, run the `wget` and `shasum` commands below
CHROME_BINARY_SHA512SUM='0b1a18c44efb72ed3e69a5f78419ff5fa973df42b18a8becfcc3d4f6825957c637e9396d07756f910f2d9c7c85a3e2b64cc30cca18182ae8811feadd609f159d'
CHROME_BINARY_SHA512SUM='cbdad3f5c928ef79a46a3619054b3c4a73a99f942f9bf4ea75d37d6434912da5c01f6ee30718a58e869ff6b57b10bb7fea1cf91885a25aac290a50a2ee3c03c4'

wget -O "${CHROME_BINARY}" -t 5 "${CHROME_BINARY_URL}"

Expand Down
36 changes: 22 additions & 14 deletions .circleci/scripts/release-create-gh-release.sh
Original file line number Diff line number Diff line change
Expand Up @@ -26,37 +26,42 @@ function install_github_cli ()
popd
}

function print_flask_version ()
function print_build_version ()
{
local flask_filename
flask_filename="$(find ./builds-flask -type f -name 'metamask-flask-chrome-*.zip' -exec basename {} .zip \;)"
local build_type="${1}"; shift

local flask_build_filename_prefix
flask_build_filename_prefix='metamask-flask-chrome-'
local flask_build_filename_prefix_size
flask_build_filename_prefix_size="${#flask_build_filename_prefix}"
local filename
filename="$(find "./builds-${build_type}" -type f -name "metamask-${build_type}-chrome-*.zip" -exec basename {} .zip \;)"

local build_filename_prefix
build_filename_prefix="metamask-${build_type}-chrome-"
local build_filename_prefix_size
build_filename_prefix_size="${#build_filename_prefix}"

# Use substring parameter expansion to remove the filename prefix, leaving just the version
echo "${flask_filename:$flask_build_filename_prefix_size}"
echo "${filename:$build_filename_prefix_size}"
}

function publish_flask_tag ()

function publish_tag ()
{
local flask_version="${1}"; shift
local build_name="${1}"; shift
local build_version="${1}"; shift

git config user.email "[email protected]"
git config user.name "MetaMask Bot"
git tag -a "v${flask_version}" -m "Flask version ${flask_version}"
git tag -a "v${build_version}" -m "${build_name} version ${build_version}"
repo_slug="$CIRCLE_PROJECT_USERNAME/$CIRCLE_PROJECT_REPONAME"
git push "https://$GITHUB_TOKEN@github.com/$repo_slug" "v${flask_version}"
git push "https://$GITHUB_TOKEN@github.com/$repo_slug" "v${build_version}"
}

current_commit_msg=$(git show -s --format='%s' HEAD)

if [[ $current_commit_msg =~ Version[-[:space:]](v[[:digit:]]+.[[:digit:]]+.[[:digit:]]+) ]]
then
tag="${BASH_REMATCH[1]}"
flask_version="$(print_flask_version)"
flask_version="$(print_build_version 'flask')"
mmi_version="$(print_build_version 'mmi')"

install_github_cli

Expand All @@ -67,12 +72,15 @@ then
--attach builds/metamask-firefox-*.zip \
--attach builds-flask/metamask-flask-chrome-*.zip \
--attach builds-flask/metamask-flask-firefox-*.zip \
--attach builds-mmi/metamask-mmi-chrome-*.zip \
--attach builds-mmi/metamask-mmi-firefox-*.zip \
--message "Version ${tag##v}" \
--message "$release_body" \
--commitish "$CIRCLE_SHA1" \
"$tag"

publish_flask_tag "${flask_version}"
publish_tag 'Flask' "${flask_version}"
publish_tag 'MMI' "${mmi_version}"
else
printf '%s\n' 'Version not found in commit message; skipping GitHub Release'
exit 0
Expand Down
8 changes: 0 additions & 8 deletions .depcheckrc.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,14 +10,6 @@ ignores:
- '@fortawesome/fontawesome-free'
- 'punycode'

#
# snaps flask deps
#
- '@metamask/rpc-methods-flask'
- '@metamask/snaps-controllers-flask'
- '@metamask/snaps-ui-flask'
- '@metamask/snaps-utils-flask'

#
# dev deps
#
Expand Down
2 changes: 2 additions & 0 deletions .eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -241,6 +241,7 @@ module.exports = {
'app/scripts/controllers/permissions/**/*.test.js',
'app/scripts/controllers/preferences.test.js',
'app/scripts/lib/**/*.test.js',
'app/scripts/metamask-controller.test.js',
'app/scripts/migrations/*.test.js',
'app/scripts/platforms/*.test.js',
'development/**/*.test.js',
Expand Down Expand Up @@ -271,6 +272,7 @@ module.exports = {
'app/scripts/controllers/permissions/**/*.test.js',
'app/scripts/controllers/preferences.test.js',
'app/scripts/lib/**/*.test.js',
'app/scripts/metamask-controller.test.js',
'app/scripts/migrations/*.test.js',
'app/scripts/platforms/*.test.js',
'development/**/*.test.js',
Expand Down
13 changes: 12 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
**/snaps/** @MetaMask/snaps-devs
**/flask/** @MetaMask/snaps-devs
**/flask/** @MetaMask/extension-devs @MetaMask/snaps-devs
development/ @MetaMask/extension-devs @kumavis
lavamoat/ @MetaMask/extension-devs @MetaMask/supply-chain @MetaMask/snaps-devs

Expand All @@ -24,6 +24,17 @@ lavamoat/ @MetaMask/extension-devs @MetaMask/supply-c
# should be brought to the attention of engineering leadership for
# discussion
.circleci/ @MetaMask/library-admins @kumavis @brad-decker

# 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
# complete list of all hosts that the extension communicates with until the E2E
# test suite has full coverage. Anytime the privacy-snapshot file changes,
# extra scrutiny should be applied to the pull request to confirm that it does
# not broaden the number of hosts the extension communicates with without also
# providing a path for users to avoid that communication. MetaMask strives to
# make all such communication opt IN versus opt OUT.
privacy-snapshot.json @MetaMask/extension-privacy-reviewers

# The CODEOWNERS file constitutes an agreement amongst organization
# admins and maintainers to restrict approval capabilities to a subset
# of contributors. Modifications to this file result in a modification of
Expand Down
Loading

0 comments on commit b9d9477

Please sign in to comment.