1
0
mirror of https://github.com/kremalicious/metamask-extension.git synced 2024-11-21 17:37:01 +01:00

feat(17494): beta build trigger in release branch and cleanup (#17749)

* feat(17494): test separate commit triggered build

* feat(17493): keep consistent commit message

* feat(17493): use trim to get rid of white space in branch name

* feat(17493): bring back some pipelines

* Version v10.25.0-beta.0

* ERC1155 Import & Dapp interaction E2E tests (#17885)

* feat(17494): test separate commit triggered build

* feat(17493): remove testing beta commit in package.json

---------

Co-authored-by: Thomas Huang <tmashuang@users.noreply.github.com>
This commit is contained in:
Danica Shen 2023-03-04 12:51:04 +00:00 committed by GitHub
parent 47d9964a89
commit f5e2183a7f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
8 changed files with 127 additions and 63 deletions

View File

@ -18,16 +18,22 @@ orbs:
gh: circleci/github-cli@2.0
codecov: codecov/codecov@3.2.2
rc_branch_only: &rc_branch_only
filters:
branches:
only:
- /^Version-v(\d+)[.](\d+)[.](\d+)/
workflows:
test_and_release:
jobs:
- create_release_pull_request:
<<: *rc_branch_only
requires:
- prep-deps
- trigger-beta-build:
requires:
- prep-deps
filters:
branches:
only:
- /^Version-v(\d+)[.](\d+)[.](\d+)/
- prep-deps
- test-deps-audit:
requires:
@ -48,9 +54,6 @@ workflows:
- prep-build:
requires:
- prep-deps
- prep-build-beta:
requires:
- prep-deps
- prep-build-desktop:
requires:
- prep-deps
@ -132,7 +135,7 @@ workflows:
- prep-build
- validate-source-maps-beta:
requires:
- prep-build-beta
- trigger-beta-build
- validate-source-maps-desktop:
requires:
- prep-build-desktop
@ -144,9 +147,10 @@ workflows:
- prep-deps
- prep-build
- test-mozilla-lint-beta:
<<: *rc_branch_only
requires:
- prep-deps
- prep-build-beta
- trigger-beta-build
- test-mozilla-lint-desktop:
requires:
- prep-deps
@ -195,7 +199,7 @@ workflows:
requires:
- prep-deps
- prep-build
- prep-build-beta
- trigger-beta-build
- prep-build-desktop
- prep-build-flask
- prep-build-storybook
@ -230,6 +234,35 @@ workflows:
- prep-build-ts-migration-dashboard
jobs:
trigger-beta-build:
executor: node-browsers-medium-plus
steps:
- checkout
- attach_workspace:
at: .
- when:
condition:
not:
matches:
pattern: /^master$/
value: << pipeline.git.branch >>
steps:
- run:
name: Build beta prod
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
- run:
name: Move beta zips to 'builds-beta' to avoid conflict with production build
command: mv ./builds ./builds-beta
- persist_to_workspace:
root: .
paths:
- dist-beta
- builds-beta
create_release_pull_request:
executor: node-browsers
steps:
@ -348,46 +381,6 @@ jobs:
- dist
- builds
prep-build-beta:
executor: node-browsers-medium-plus
steps:
- checkout
- attach_workspace:
at: .
- when:
condition:
not:
matches:
pattern: /^master$/
value: << pipeline.git.branch >>
steps:
- run:
name: build:dist
command: yarn build --build-type beta dist
- when:
condition:
matches:
pattern: /^master$/
value: << pipeline.git.branch >>
steps:
- run:
name: build:prod
command: yarn build --build-type beta prod
- run:
name: build:debug
command: find dist/ -type f -exec md5sum {} \; | sort -k 2
- run:
name: Move beta build to 'dist-beta' to avoid conflict with production build
command: mv ./dist ./dist-beta
- run:
name: Move beta zips to 'builds-beta' to avoid conflict with production build
command: mv ./builds ./builds-beta
- persist_to_workspace:
root: .
paths:
- dist-beta
- builds-beta
prep-build-desktop:
executor: node-browsers-medium-plus
steps:
@ -659,7 +652,7 @@ jobs:
steps:
- run:
name: Validate release candidate changelog
command: yarn lint:changelog:rc
command: .circleci/scripts/validate-changelog-in-rc.sh
test-deps-audit:
executor: node-browsers
@ -1226,7 +1219,8 @@ jobs:
command: mv ./builds-beta ./builds
- run:
name: Validate source maps
command: yarn validate-source-maps
command: |
.circleci/scripts/validate-source-maps-beta.sh
validate-source-maps-desktop:
executor: node-browsers

View File

@ -18,8 +18,15 @@ fi
printf '%s\n' 'Updating the manifest version if needed'
version="${CIRCLE_BRANCH/Version-v/}"
yarn version "${version}"
current_commit_msg=$(git show -s --format='%s' HEAD)
if [[ $current_commit_msg =~ Version[[:space:]](v[[:digit:]]+.[[:digit:]]+.[[:digit:]]+[-]beta.[[:digit:]]) ]]
then
printf '%s\n' 'manifest version will not be updated for beta commit'
# escape version update everytime a new change pushed to release branch
else
version="${CIRCLE_BRANCH/Version-v/}"
yarn version "${version}"
fi
if [[ -z $(git status --porcelain) ]]
then

View File

@ -0,0 +1,24 @@
#!/usr/bin/env bash
set -e
set -u
set -o pipefail
# => Version-v10.24.1
version="${CIRCLE_BRANCH/Version-v/}"
current_commit_msg=$(git show -s --format='%s' HEAD)
if [[ $current_commit_msg =~ Version[[:space:]](v[[:digit:]]+.[[:digit:]]+.[[:digit:]]+[-]beta.[[:digit:]]) ]]
then
# filter the commit message like Version v10.24.1-beta.1
printf '%s\n' "Create a build for $version with beta version $current_commit_msg"
yarn build --build-type beta dist
yarn build --build-type beta prod
else
printf '%s\n' 'Commit message does not match commit message for beta pattern; skipping beta automation build'
mkdir dist
mkdir builds
exit 0
fi
exit 0

View File

@ -0,0 +1,17 @@
#!/usr/bin/env bash
set -e
set -u
set -o pipefail
current_commit_msg=$(git show -s --format='%s' HEAD)
if [[ $current_commit_msg =~ Version[[:space:]](v[[:digit:]]+.[[:digit:]]+.[[:digit:]]+[-]beta.[[:digit:]]) ]]
then
printf '%s\n' 'Skip changelog validation for beta commit'
else
printf '%s\n' 'Validate changelog for release candidate'
yarn lint:changelog:rc
fi
exit 0

View File

@ -0,0 +1,20 @@
#!/usr/bin/env bash
set -e
set -u
set -o pipefail
# => Version-v10.24.1
current_commit_msg=$(git show -s --format='%s' HEAD)
if [[ $current_commit_msg =~ Version[[:space:]](v[[:digit:]]+.[[:digit:]]+.[[:digit:]]+[-]beta.[[:digit:]]) ]]
then
# filter the commit message like Version v10.24.1-beta.1
printf '%s\n' "Validate source maps with beta version $current_commit_msg"
yarn validate-source-maps
else
printf '%s\n' 'Commit message does not match commit message for beta pattern; skipping validation of beta source maps'
exit 0
fi
exit 0

View File

@ -45,14 +45,16 @@ function getBrowserVersionMap(platforms, version) {
const minor = semver.minor(version);
const patch = semver.patch(version);
const prerelease = semver.prerelease(version);
let buildType;
let buildVersion;
let buildType, buildVersionSummary, buildVersion;
if (prerelease) {
if (prerelease.length !== 2) {
throw new Error(`Invalid prerelease version: '${prerelease.join('.')}'`);
}
[buildType, buildVersion] = prerelease;
[buildType, buildVersionSummary] = prerelease;
// The version could be version: '10.25.0-beta.1-flask.0',
// That results in buildVersionSummary becomes 1-flask
// And we only want 1 from this string
buildVersion =
typeof buildVersionSummary === 'string'
? Number(buildVersionSummary.match(/\d+(?:\.\d+)?/u)[0])
: buildVersionSummary;
if (!String(buildVersion).match(/^\d+$/u)) {
throw new Error(`Invalid prerelease build version: '${buildVersion}'`);
} else if (

View File

@ -13,7 +13,7 @@ const { BuildType } = require('./build-type');
* @returns {string} The MetaMask extension version.
*/
function getVersion(buildType, buildVersion) {
return buildType === BuildType.main
return buildType === BuildType.main || buildType === BuildType.beta
? manifestVersion
: `${manifestVersion}-${buildType}.${buildVersion}`;
}

View File

@ -1,4 +1,5 @@
#!/usr/bin/env node
const { promises: fs } = require('fs');
const path = require('path');
// Fetch is part of node js in future versions, thus triggering no-shadow
@ -34,7 +35,6 @@ async function start() {
const CIRCLE_PR_NUMBER = CIRCLE_PULL_REQUEST.split('/').pop();
const SHORT_SHA1 = CIRCLE_SHA1.slice(0, 7);
const BUILD_LINK_BASE = `https://output.circle-artifacts.com/output/job/${CIRCLE_WORKFLOW_JOB_ID}/artifacts/0`;
// build the github comment content
// links to extension builds