Skip to content

Commit

Permalink
Merge branch 'main' into chore/ramp-upgrade-sdk-1.28.8
Browse files Browse the repository at this point in the history
  • Loading branch information
georgeweiler authored Dec 13, 2024
2 parents b5d3817 + 30e8f6d commit 51626b7
Show file tree
Hide file tree
Showing 75 changed files with 3,703 additions and 1,547 deletions.
238 changes: 114 additions & 124 deletions .github/scripts/bitrise/run-bitrise-e2e-check.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,107 @@ import {
} from '../scripts.types';
import axios from 'axios';

let octokitInstance: InstanceType<typeof GitHub> | null = null;
let owner: string;
let repo: string;

main().catch((error: Error): void => {
console.error(error);
process.exit(1);
});



function getOctokitInstance(): InstanceType<typeof GitHub> {
if (!octokitInstance) {
const githubToken = process.env.GITHUB_TOKEN;
if (!githubToken) {
throw new Error("GitHub token is not set in the environment variables");
}
octokitInstance = getOctokit(githubToken);
}
return octokitInstance;
}

async function upsertStatusCheck(
statusCheckName: string,
commitHash: string,
status: StatusCheckStatusType,
conclusion: CompletedConclusionType | undefined,
summary: string
): Promise<void> {
const octokit = getOctokitInstance();

// List existing checks
const listResponse = await octokit.rest.checks.listForRef({
owner,
repo,
ref: commitHash,
});

if (listResponse.status !== 200) {
core.setFailed(
`Failed to list checks for commit ${commitHash}, received status code ${listResponse.status}`,
);
process.exit(1);
}

const existingCheck = listResponse.data.check_runs.find(check => check.name === statusCheckName);

if (existingCheck) {
console.log(`Check already exists: ${existingCheck.name}, updating...`);
// Update the existing check
const updateCheckResponse = await octokit.rest.checks.update({
owner,
repo,
check_run_id: existingCheck.id,
name: statusCheckName,
status: status,
conclusion: conclusion,
output: {
title: `${statusCheckName} Status Check`,
summary: summary,
},
});

if (updateCheckResponse.status !== 200) {
core.setFailed(
`Failed to update '${statusCheckName}' check with status ${status} for commit ${commitHash}, got status code ${updateCheckResponse.status}`,
);
process.exit(1);
}

console.log(`Updated existing check: ${statusCheckName} with id ${existingCheck.id} & status ${status} for commit ${commitHash}`);



} else {
console.log(`Check does not exist: ${statusCheckName}, creating...`);
// Create a new status check
const createCheckResponse = await octokit.rest.checks.create({
owner,
repo,
name: statusCheckName,
head_sha: commitHash,
status: status,
conclusion: conclusion,
started_at: new Date().toISOString(),
output: {
title: `${statusCheckName} Status Check`,
summary: summary,
},
});

if (createCheckResponse.status !== 201) {
core.setFailed(
`Failed to create '${statusCheckName}' check with status ${status} for commit ${commitHash}, got status code ${createCheckResponse.status}`,
);
process.exit(1);
}

console.log(`Created check: ${statusCheckName} with id ${createCheckResponse.data.id} & status ${status} for commit ${commitHash}`);
}
}
// Determine whether E2E should run and provide the associated reason
function shouldRunBitriseE2E(antiLabel: boolean, hasSmokeTestLabel: boolean, isDocs: boolean, isFork: boolean, isMergeQueue: boolean): [boolean, string] {

Expand Down Expand Up @@ -43,7 +139,11 @@ async function main(): Promise<void> {
const e2ePipeline = process.env.E2E_PIPELINE;
const workflowName = process.env.WORKFLOW_NAME;
const triggerAction = context.payload.action as PullRequestTriggerType;
const { owner, repo, number: pullRequestNumber } = context.issue;
// Assuming context.issue comes populated with owner and repo, as typical with GitHub Actions
const { owner: contextOwner, repo: contextRepo, number: pullRequestNumber } = context.issue;
owner = contextOwner;
repo = contextRepo;

const removeAndApplyInstructions = `Remove and re-apply the "${e2eLabel}" label to trigger a E2E smoke test on Bitrise.`;
const mergeFromMainCommitMessagePrefix = `Merge branch 'main' into`;
const pullRequestLink = `https://github.com/MetaMask/metamask-mobile/pull/${pullRequestNumber}`;
Expand Down Expand Up @@ -80,7 +180,7 @@ async function main(): Promise<void> {
const mqCommitHash = context.payload?.merge_group?.head_sha;


const octokit: InstanceType<typeof GitHub> = getOctokit(githubToken);
const octokit = getOctokitInstance();

const { data: prData } = await octokit.rest.pulls.get({
owner,
Expand Down Expand Up @@ -114,67 +214,18 @@ async function main(): Promise<void> {
if (!mergeQueue && !hasSmokeTestLabel && !hasAntiLabel) {

// Fail Status due to missing labels
const createStatusCheckResponse = await octokit.rest.checks.create({
owner,
repo,
name: statusCheckName,
head_sha: latestCommitHash,
status: StatusCheckStatusType.Completed,
conclusion: CompletedConclusionType.Failure,
started_at: new Date().toISOString(),
output: {
title: statusCheckTitle,
summary: `Failed due to missing labels. Please apply either ${e2eLabel} or ${antiLabel}.`,
},
});

if (createStatusCheckResponse.status === 201) {
console.log(
`Created '${statusCheckName}' check with failed status for commit ${latestCommitHash}`,
);
} else {
core.setFailed(
`Failed to create '${statusCheckName}' check with failed status for commit ${latestCommitHash} with status code ${createStatusCheckResponse.status}`,
);
process.exit(1);
}
core.setFailed(
`At least 1 E2E Label must be Applied either ${e2eLabel} or ${antiLabel}`,
);
process.exit(1);
await upsertStatusCheck(statusCheckName, latestCommitHash, StatusCheckStatusType.Completed,
CompletedConclusionType.Failure, `Failed due to missing labels. Please apply either ${e2eLabel} or ${antiLabel}.`);
return
}

if (!shouldRun) {
console.log(
`Skipping Bitrise status check. due to the following reason: ${reason}`,
);


// Post success status (skipped)
const createStatusCheckResponse = await octokit.rest.checks.create({
owner,
repo,
name: statusCheckName,
head_sha: latestCommitHash,
status: StatusCheckStatusType.Completed,
conclusion: CompletedConclusionType.Success,
started_at: new Date().toISOString(),
output: {
title: statusCheckTitle,
summary: `Skip run since ${reason}`,
},
});

if (createStatusCheckResponse.status === 201) {
console.log(
`Created '${statusCheckName}' check with skipped status for commit ${latestCommitHash}`,
);
} else {
core.setFailed(
`Failed to create '${statusCheckName}' check with skipped status for commit ${latestCommitHash} with status code ${createStatusCheckResponse.status}`,
);
process.exit(1);
}
await upsertStatusCheck(statusCheckName, latestCommitHash, StatusCheckStatusType.Completed, CompletedConclusionType.Success,
`Skip run since ${reason}`);
return;
}

Expand Down Expand Up @@ -314,29 +365,9 @@ async function main(): Promise<void> {
// Post pending status
console.log(`Posting pending status for commit ${latestCommitHash}`);

const createStatusCheckResponse = await octokit.rest.checks.create({
owner,
repo,
name: statusCheckName,
head_sha: latestCommitHash,
status: StatusCheckStatusType.InProgress,
started_at: new Date().toISOString(),
output: {
title: statusCheckTitle,
summary: `Test runs in progress... You can view them at ${buildLink}`,
},
});
await upsertStatusCheck( statusCheckName, latestCommitHash, StatusCheckStatusType.InProgress, undefined, `Test runs in progress... You can view them at ${buildLink}`);


if (createStatusCheckResponse.status === 201) {
console.log(
`Created '${statusCheckName}' check for commit ${latestCommitHash}`,
);
} else {
core.setFailed(
`Failed to create '${statusCheckName}' check for commit ${latestCommitHash} with status code ${createStatusCheckResponse.status}`,
);
process.exit(1);
}
return;
}

Expand Down Expand Up @@ -383,31 +414,11 @@ async function main(): Promise<void> {
if (!bitriseComment) {

console.log(`Bitrise comment not detected for commit ${latestCommitHash}`);
// Post fail status
const createStatusCheckResponse = await octokit.rest.checks.create({
owner,
repo,
name: statusCheckName,
head_sha: latestCommitHash,
status: StatusCheckStatusType.Completed,
conclusion: CompletedConclusionType.Failure,
started_at: new Date().toISOString(),
output: {
title: statusCheckTitle,
summary: `No Bitrise comment found for commit ${latestCommitHash}. Try re-applying the '${e2eLabel}' label.`,
},
});

if (createStatusCheckResponse.status === 201) {
console.log(
`Created '${statusCheckName}' check for commit ${latestCommitHash}`,
);
} else {
core.setFailed(
`Failed to create '${statusCheckName}' check for commit ${latestCommitHash} with status code ${createStatusCheckResponse.status}`,
);
process.exit(1);
}
await upsertStatusCheck(statusCheckName, latestCommitHash, StatusCheckStatusType.Completed,
CompletedConclusionType.Failure,
`No Bitrise comment found for commit ${latestCommitHash}. Try re-applying the '${e2eLabel}' label.`);

return;
}

Expand Down Expand Up @@ -498,27 +509,6 @@ async function main(): Promise<void> {
}

// Post status check
const createStatusCheckResponse = await octokit.rest.checks.create({
owner,
repo,
name: statusCheckName,
head_sha: latestCommitHash,
started_at: new Date().toISOString(),
output: {
title: statusCheckTitle,
summary: statusMessage,
},
...checkStatus,
});
await upsertStatusCheck(statusCheckName, latestCommitHash, checkStatus.status, checkStatus.conclusion, statusMessage);

if (createStatusCheckResponse.status === 201) {
console.log(
`Created '${statusCheckName}' check for commit ${latestCommitHash}`,
);
} else {
core.setFailed(
`Failed to create '${statusCheckName}' check for commit ${latestCommitHash} with status code ${createStatusCheckResponse.status}`,
);
process.exit(1);
}
}
62 changes: 62 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,68 @@

## Current Main Branch

## 7.37.0 - Nov 28, 2024
### Added
- [#12091](https://github.com/MetaMask/metamask-mobile/pull/12091): feat: 2020 Add a performance test for iOS in Bitrise (#12091)
- [#12148](https://github.com/MetaMask/metamask-mobile/pull/12148): feat: Enable smart transactions for new users (#12148)
- [#12442](https://github.com/MetaMask/metamask-mobile/pull/12442): test: add a new unit test to cover for multichain feature flags ON (#12442)
- [#12420](https://github.com/MetaMask/metamask-mobile/pull/12420): feat(3598): non permitted chain flow small improvements (#12420)
- [#12198](https://github.com/MetaMask/metamask-mobile/pull/12198): feat: custom names for snap accounts (Flask only) (#12198)
- [#12396](https://github.com/MetaMask/metamask-mobile/pull/12396): feat(ramp): enable buy button in asset overview (#12396)
- [#11613](https://github.com/MetaMask/metamask-mobile/pull/11613): feat(ramp): improve amount editing formatting (#11613)
- [#12393](https://github.com/MetaMask/metamask-mobile/pull/12393): feat: Creating data tree for signed type V1 signatures (#12393)
- [#12160](https://github.com/MetaMask/metamask-mobile/pull/12160): feat: Integrate NFT api to display image & names in simulations includes `erc721`s (#12160)
- [#12324](https://github.com/MetaMask/metamask-mobile/pull/12324): feat: confirmation re-designs add basic page for types sign V1 signature request (#12324)
- [#11424](https://github.com/MetaMask/metamask-mobile/pull/11424): feat: add workflow for updating automated test results in TestRail (#11424)
- [#12337](https://github.com/MetaMask/metamask-mobile/pull/12337): feat: updated staking events to use withMetaMetrics helper (#12337)
- [#12363](https://github.com/MetaMask/metamask-mobile/pull/12363): feat: add PooledStaking slice for managing staking state (#12363)
- [#12398](https://github.com/MetaMask/metamask-mobile/pull/12398): feat: limit input digits to 12 in useInputHandler (#12398)
- [#12344](https://github.com/MetaMask/metamask-mobile/pull/12344): feat: upgrade assets controllers to v44 (#12344)
- [#12340](https://github.com/MetaMask/metamask-mobile/pull/12340): feat: upgrade assets controllers to version 43 (#12340)
- [#12270](https://github.com/MetaMask/metamask-mobile/pull/12270): feat: upgrade assets controllers to 42 with multichain token rates (#12270)
- [#12452](https://github.com/MetaMask/metamask-mobile/pull/12452): feat: updated staking events to use withMetaMetrics helper (#12337) (#12452)

### Changed
- [#12356](https://github.com/MetaMask/metamask-mobile/pull/12356): chore: Remove unnecessary event prop (#12356)
- [#12425](https://github.com/MetaMask/metamask-mobile/pull/12425): ci: create ci workflow for multichain flow (#12425)
- [#12350](https://github.com/MetaMask/metamask-mobile/pull/12350): chore: Bump Snaps packages (#12350)
- [#11409](https://github.com/MetaMask/metamask-mobile/pull/11409): refactor: use `withKeyring` to batch account restore operation (#11409)
- [#12339](https://github.com/MetaMask/metamask-mobile/pull/12339): chore: Update accounts-controller @v19.0.0 and keyring-controller @v18.0.0 (#12339)
- [#12440](https://github.com/MetaMask/metamask-mobile/pull/12440): chore(ramp): upgrade sdk to 1.28.7 (#12440)
- [#12351](https://github.com/MetaMask/metamask-mobile/pull/12351): refactor(ramp): remove anonymous events (#12351)
- [#12355](https://github.com/MetaMask/metamask-mobile/pull/12355): chore: Add missing confirmation unit tests (#12355)
- [#12369](https://github.com/MetaMask/metamask-mobile/pull/12369): chore: upgrade transaction controller to increase polling rate (#12369)
- [#12202](https://github.com/MetaMask/metamask-mobile/pull/12202): refactor: update swaps quote poll count (#12202)
- [#10743](https://github.com/MetaMask/metamask-mobile/pull/10743): chore: @metamask/swaps-controller v9 -> v10 (#10743)
- [#12415](https://github.com/MetaMask/metamask-mobile/pull/12415): chore: Cherry pick 2506358 (merge in trackEvent work) (#12415)
- [#12238](https://github.com/MetaMask/metamask-mobile/pull/12238): chore: update codeowners (#12238)
- [#12416](https://github.com/MetaMask/metamask-mobile/pull/12416): chore: Chore/update accounts controller messenger code owner (#12416)
- [#12366](https://github.com/MetaMask/metamask-mobile/pull/12366): chore: #12184 MVP split engine file (#12366)
- [#12362](https://github.com/MetaMask/metamask-mobile/pull/12362): chore: Unit tests for tags approval controller undefined (#12362)
- [#12343](https://github.com/MetaMask/metamask-mobile/pull/12343): chore: Cherry pick f35d583 (#12343)
- [#12332](https://github.com/MetaMask/metamask-mobile/pull/12332): chore: do not show staked eth balance when balance is zero on homepage or asset detail (#12332)
- [#12413](https://github.com/MetaMask/metamask-mobile/pull/12413): chore: simplify cicd rls script (#12413)
- [#12334](https://github.com/MetaMask/metamask-mobile/pull/12334): chore: updating filter icon (#12334)

### Fixed
- [#12313](https://github.com/MetaMask/metamask-mobile/pull/12313): fix: Remove run all tests section (#12313)
- [#12489](https://github.com/MetaMask/metamask-mobile/pull/12489): fix: replace end of navigation init and UIStartup span (#12489)
- [#12331](https://github.com/MetaMask/metamask-mobile/pull/12331): fix: tags pending approvals receiving undefined (#12331)
- [#10486](https://github.com/MetaMask/metamask-mobile/pull/10486): fix: limit ReactNativeWebview message size (#10486)
- [#12478](https://github.com/MetaMask/metamask-mobile/pull/12478): fix: incorrect event source in analytics and connection (#12478)
- [#10786](https://github.com/MetaMask/metamask-mobile/pull/10786): fix: added icon to walletconnect metadata (#10786)
- [#12455](https://github.com/MetaMask/metamask-mobile/pull/12455): fix: gas fee edit from swaps (#12455)
- [#12370](https://github.com/MetaMask/metamask-mobile/pull/12370): fix: Fix copy of ""Network fee"" on approval (#12370)
- [#12273](https://github.com/MetaMask/metamask-mobile/pull/12273): fix: Disable confirm button if `transactionMeta` is undefined (#12273)
- [#12367](https://github.com/MetaMask/metamask-mobile/pull/12367): fix: app crashing after send or swap (#12367)
- [#12446](https://github.com/MetaMask/metamask-mobile/pull/12446): fix: update wallet_addEthereumChain.js with correct MetricsEventBuilder (#12446)
- [#12180](https://github.com/MetaMask/metamask-mobile/pull/12180): fix: trackevent enabled is undefined (#12180)
- [#12315](https://github.com/MetaMask/metamask-mobile/pull/12315): fix: e2e: ensure Decrypt button is displayed (#12315)
- [#12402](https://github.com/MetaMask/metamask-mobile/pull/12402): fix: fix missing variable patch (#12402)
- [#12319](https://github.com/MetaMask/metamask-mobile/pull/12319): fix: hide rpc url selector for networks with one rpc (#12319)
- [#12371](https://github.com/MetaMask/metamask-mobile/pull/12371): fix: fix patch missing variable sentry error (#12371)
- [#12375](https://github.com/MetaMask/metamask-mobile/pull/12375): fix: breaking selector due to missing controller state (#12375)

## 7.36.0 - Nov 15, 2024
### Added
- [#12015](https://github.com/MetaMask/metamask-mobile/pull/12015): feat: 1957 crash screen redesign (#12015)
Expand Down
4 changes: 2 additions & 2 deletions android/app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -178,8 +178,8 @@ android {
applicationId "io.metamask"
minSdkVersion rootProject.ext.minSdkVersion
targetSdkVersion rootProject.ext.targetSdkVersion
versionCode 1505
versionName "7.36.0"
versionName "7.37.0"
versionCode 1512
testBuildType System.getProperty('testBuildType', 'debug')
missingDimensionStrategy 'react-native-camera', 'general'
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
Expand Down
Loading

0 comments on commit 51626b7

Please sign in to comment.