-
Notifications
You must be signed in to change notification settings - Fork 4.9k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'develop' into reapply-withkeyring-refactor
- Loading branch information
Showing
302 changed files
with
9,868 additions
and
6,129 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,142 @@ | ||
name: Run tests | ||
|
||
on: | ||
push: | ||
branches: | ||
- develop | ||
- master | ||
pull_request: | ||
types: | ||
- opened | ||
- reopened | ||
- synchronize | ||
|
||
jobs: | ||
test-unit: | ||
name: Unit tests | ||
runs-on: ubuntu-latest | ||
strategy: | ||
matrix: | ||
shard: [1, 2, 3, 4, 5, 6] | ||
steps: | ||
- name: Checkout repository | ||
uses: actions/checkout@v4 | ||
|
||
- name: Setup environment | ||
uses: metamask/github-tools/.github/actions/setup-environment@main | ||
|
||
- name: test:unit:coverage | ||
run: yarn test:unit:coverage --shard=${{ matrix.shard }}/${{ strategy.job-total }} | ||
|
||
- name: Rename coverage | ||
run: mv coverage/unit/coverage-final.json coverage/unit/coverage-unit-${{matrix.shard}}.json | ||
|
||
- uses: actions/upload-artifact@v4 | ||
with: | ||
name: coverage-unit-${{matrix.shard}} | ||
path: coverage/unit/coverage-unit-${{matrix.shard}}.json | ||
|
||
test-webpack: | ||
name: Webpack tests | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout repository | ||
uses: actions/checkout@v4 | ||
|
||
- name: Setup environment | ||
uses: metamask/github-tools/.github/actions/setup-environment@main | ||
|
||
- name: test:unit:webpack:coverage | ||
run: yarn test:unit:webpack:coverage | ||
|
||
- name: Rename coverage | ||
run: mv coverage/webpack/coverage-final.json coverage/webpack/coverage-webpack.json | ||
|
||
- uses: actions/upload-artifact@v4 | ||
with: | ||
name: coverage-webpack | ||
path: coverage/webpack/coverage-webpack.json | ||
|
||
test-integration: | ||
name: Integration tests | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout repository | ||
uses: actions/checkout@v4 | ||
|
||
- name: Setup environment | ||
uses: metamask/github-tools/.github/actions/setup-environment@main | ||
|
||
- name: test:integration:coverage | ||
run: yarn test:integration:coverage | ||
|
||
- name: Rename coverage | ||
run: mv coverage/integration/coverage-final.json coverage/integration/coverage-integration.json | ||
|
||
- uses: actions/upload-artifact@v4 | ||
with: | ||
name: coverage-integration | ||
path: coverage/integration/coverage-integration.json | ||
|
||
sonarcloud: | ||
name: SonarCloud | ||
runs-on: ubuntu-latest | ||
needs: | ||
- test-unit | ||
- test-webpack | ||
- test-integration | ||
steps: | ||
- name: Checkout repository | ||
uses: actions/checkout@v4 | ||
with: | ||
fetch-depth: 0 # Shallow clones should be disabled for better relevancy of analysis | ||
|
||
- name: Setup environment | ||
uses: metamask/github-tools/.github/actions/setup-environment@main | ||
|
||
- name: Download artifacts | ||
uses: actions/download-artifact@v4 | ||
with: | ||
path: coverage | ||
merge-multiple: true | ||
|
||
- name: Merge coverage reports | ||
run: yarn nyc merge coverage .nyc_output/coverage-final.json && yarn nyc report --reporter lcov | ||
|
||
- uses: actions/upload-artifact@v4 | ||
with: | ||
name: lcov.info | ||
path: coverage/lcov.info | ||
|
||
- name: Get Sonar coverage | ||
id: get-sonar-coverage | ||
env: | ||
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} | ||
run: | | ||
projectKey=$(grep 'sonar.projectKey=' sonar-project.properties | cut -d'=' -f2) | ||
sonar_coverage=$(curl --silent --header "Authorization: Bearer $SONAR_TOKEN" "https://sonarcloud.io/api/measures/component?component=$projectKey&metricKeys=coverage" | jq -r '.component.measures[0].value // 0') | ||
echo "The Sonar coverage of $projectKey is $sonar_coverage%." | ||
echo 'SONAR_COVERAGE='"$sonar_coverage" >> "$GITHUB_OUTPUT" | ||
- name: Validate test coverage | ||
env: | ||
SONAR_COVERAGE: ${{ steps.get-sonar-coverage.outputs.SONAR_COVERAGE }} | ||
run: | | ||
coverage=$(yarn nyc report --reporter=text-summary | grep 'Lines' | awk '{gsub(/%/, ""); print $3}') | ||
if [ -z "$coverage" ]; then | ||
echo "::error::Could not retrieve test coverage." | ||
exit 1 | ||
fi | ||
if (( $(echo "$coverage < $SONAR_COVERAGE" | bc -l) )); then | ||
echo "::error::Quality gate failed for test coverage. Current test coverage is $coverage%, please increase coverage to at least $SONAR_COVERAGE%." | ||
exit 1 | ||
else | ||
echo "Test coverage is $coverage%. Quality gate passed." | ||
fi | ||
- name: SonarCloud Scan | ||
# This is SonarSource/sonarcloud-github-action@v2.0.0 | ||
uses: SonarSource/sonarcloud-github-action@4b4d7634dab97dcee0b75763a54a6dc92a9e6bc1 | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} |
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -79,4 +79,4 @@ licenseInfos.json | |
html-report/ | ||
|
||
/app/images/branding | ||
|
||
/changed-files |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
13 changes: 0 additions & 13 deletions
13
.yarn/patches/@metamask-snaps-controllers-npm-9.5.0-8b21e3c072.patch
This file was deleted.
Oops, something went wrong.
16 changes: 16 additions & 0 deletions
16
.yarn/patches/jest-environment-jsdom-npm-29.7.0-0b72dd0e0b.patch
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
diff --git a/build/index.js b/build/index.js | ||
index 2e6c16c33c2f588cf8d6a5717ac776bb8908bd0d..5534a739c6bc7cda9e0f8439656a6215dfacc26a 100644 | ||
--- a/build/index.js | ||
+++ b/build/index.js | ||
@@ -95,6 +95,11 @@ class JSDOMEnvironment { | ||
|
||
// TODO: remove this ASAP, but it currently causes tests to run really slow | ||
global.Buffer = Buffer; | ||
+ // Needed to support toChecksumAddress from the ethereumjs-util@7.1.5. | ||
+ // It converts a hex string to a buffer and then expects it to be an instanceof Uint8Array. | ||
+ // And although on Node env that buffer is an instance of Uint8Array, on JSDOM it is not. | ||
+ // So we need to override the jsdom Uint8Array with Node Uint8Array. | ||
+ global.Uint8Array = Uint8Array; | ||
|
||
// Report uncaught errors. | ||
this.errorEventListener = event => { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.