refactor(docs-infra): decouple deploying from other operations in `deploy-to-firebase.js` (#39853)
Previously, the `deploy()` function in `deploy-to-firebase.js` would also perform other operations (beyond deploying), such as building the app, checking the generated payload size, testing the PWA score of the deployed app. This commit decouples these operations, so that deploying can be performed independently. NOTE: In a subsequent commit, this will be leveraged fix an issue with `rc.angular.io` redirects in the presence of a ServiceWorker by deploying the same artifacts to multiple Firebase projects/sites. See #39760 for more details. PR Close #39853
This commit is contained in:
parent
c923aaf64b
commit
6e6eee6d5b
|
@ -35,6 +35,8 @@ if (require.main === module) {
|
||||||
`Build/deploy mode : ${deploymentInfo.deployEnv}\n` +
|
`Build/deploy mode : ${deploymentInfo.deployEnv}\n` +
|
||||||
`Firebase project : ${deploymentInfo.projectId}\n` +
|
`Firebase project : ${deploymentInfo.projectId}\n` +
|
||||||
`Firebase site : ${deploymentInfo.siteId}\n` +
|
`Firebase site : ${deploymentInfo.siteId}\n` +
|
||||||
|
`Pre-deploy actions : ${serializeActions(deploymentInfo.preDeployActions)}\n` +
|
||||||
|
`Post-deploy actions : ${serializeActions(deploymentInfo.postDeployActions)}\n` +
|
||||||
`Deployment URLs : ${deploymentInfo.deployedUrl}\n` +
|
`Deployment URLs : ${deploymentInfo.deployedUrl}\n` +
|
||||||
` https://${deploymentInfo.siteId}.web.app/`);
|
` https://${deploymentInfo.siteId}.web.app/`);
|
||||||
|
|
||||||
|
@ -45,6 +47,22 @@ if (require.main === module) {
|
||||||
}
|
}
|
||||||
|
|
||||||
// Helpers
|
// Helpers
|
||||||
|
function build({deployedUrl, deployEnv}) {
|
||||||
|
console.log('\n\n\n==== Build the AIO app. ====\n');
|
||||||
|
yarn(`build --configuration=${deployEnv} --progress=false`);
|
||||||
|
|
||||||
|
console.log('\n\n\n==== Add any mode-specific files into the AIO distribution. ====\n');
|
||||||
|
cp('-rf', `src/extra-files/${deployEnv}/.`, 'dist/');
|
||||||
|
|
||||||
|
console.log('\n\n\n==== Update opensearch descriptor for AIO with `deployedUrl`. ====\n');
|
||||||
|
yarn(`set-opensearch-url ${deployedUrl.replace(/[^/]$/, '$&/')}`); // The URL must end with `/`.
|
||||||
|
}
|
||||||
|
|
||||||
|
function checkPayloadSize() {
|
||||||
|
console.log('\n\n\n==== Check payload size and upload the numbers to Firebase DB. ====\n');
|
||||||
|
yarn('payload-size');
|
||||||
|
}
|
||||||
|
|
||||||
function computeDeploymentInfo(
|
function computeDeploymentInfo(
|
||||||
{currentBranch, currentCommit, isPullRequest, repoName, repoOwner, stableBranch}) {
|
{currentBranch, currentCommit, isPullRequest, repoName, repoOwner, stableBranch}) {
|
||||||
// Do not deploy if we are running in a fork.
|
// Do not deploy if we are running in a fork.
|
||||||
|
@ -72,24 +90,32 @@ function computeDeploymentInfo(
|
||||||
projectId: 'angular-io',
|
projectId: 'angular-io',
|
||||||
siteId: 'next-angular-io-site',
|
siteId: 'next-angular-io-site',
|
||||||
deployedUrl: 'https://next.angular.io/',
|
deployedUrl: 'https://next.angular.io/',
|
||||||
|
preDeployActions: [build, checkPayloadSize],
|
||||||
|
postDeployActions: [testPwaScore],
|
||||||
},
|
},
|
||||||
rc: {
|
rc: {
|
||||||
deployEnv: 'rc',
|
deployEnv: 'rc',
|
||||||
projectId: 'angular-io',
|
projectId: 'angular-io',
|
||||||
siteId: 'rc-angular-io-site',
|
siteId: 'rc-angular-io-site',
|
||||||
deployedUrl: 'https://rc.angular.io/',
|
deployedUrl: 'https://rc.angular.io/',
|
||||||
|
preDeployActions: [build, checkPayloadSize],
|
||||||
|
postDeployActions: [testPwaScore],
|
||||||
},
|
},
|
||||||
stable: {
|
stable: {
|
||||||
deployEnv: 'stable',
|
deployEnv: 'stable',
|
||||||
projectId: 'angular-io',
|
projectId: 'angular-io',
|
||||||
siteId: `v${currentBranchMajorVersion}-angular-io-site`,
|
siteId: `v${currentBranchMajorVersion}-angular-io-site`,
|
||||||
deployedUrl: 'https://angular.io/',
|
deployedUrl: 'https://angular.io/',
|
||||||
|
preDeployActions: [build, checkPayloadSize],
|
||||||
|
postDeployActions: [testPwaScore],
|
||||||
},
|
},
|
||||||
archive: {
|
archive: {
|
||||||
deployEnv: 'archive',
|
deployEnv: 'archive',
|
||||||
projectId: 'angular-io',
|
projectId: 'angular-io',
|
||||||
siteId: `v${currentBranchMajorVersion}-angular-io-site`,
|
siteId: `v${currentBranchMajorVersion}-angular-io-site`,
|
||||||
deployedUrl: `https://v${currentBranchMajorVersion}.angular.io/`,
|
deployedUrl: `https://v${currentBranchMajorVersion}.angular.io/`,
|
||||||
|
preDeployActions: [build, checkPayloadSize],
|
||||||
|
postDeployActions: [testPwaScore],
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -160,21 +186,20 @@ function computeMajorVersion(branchName) {
|
||||||
return +branchName.split('.', 1)[0];
|
return +branchName.split('.', 1)[0];
|
||||||
}
|
}
|
||||||
|
|
||||||
function deploy(
|
function deploy(data) {
|
||||||
{currentCommit, deployedUrl, deployEnv, firebaseToken, minPwaScore, projectId, siteId}) {
|
const {
|
||||||
|
currentCommit,
|
||||||
|
firebaseToken,
|
||||||
|
postDeployActions,
|
||||||
|
preDeployActions,
|
||||||
|
projectId,
|
||||||
|
siteId,
|
||||||
|
} = data;
|
||||||
|
|
||||||
cd(`${__dirname}/..`);
|
cd(`${__dirname}/..`);
|
||||||
|
|
||||||
console.log('\n\n\n==== Build the AIO app. ====\n');
|
console.log('\n\n\n==== Run pre-deploy actions. ====\n');
|
||||||
yarn(`build --configuration=${deployEnv} --progress=false`);
|
preDeployActions.forEach(fn => fn(data));
|
||||||
|
|
||||||
console.log('\n\n\n==== Add any mode-specific files into the AIO distribution. ====\n');
|
|
||||||
cp('-rf', `src/extra-files/${deployEnv}/.`, 'dist/');
|
|
||||||
|
|
||||||
console.log('\n\n\n==== Update opensearch descriptor for AIO with `deployedUrl`. ====\n');
|
|
||||||
yarn(`set-opensearch-url ${deployedUrl.replace(/[^/]$/, '$&/')}`); // The URL must end with `/`.
|
|
||||||
|
|
||||||
console.log('\n\n\n==== Check payload size and upload the numbers to Firebase DB. ====\n');
|
|
||||||
yarn('payload-size');
|
|
||||||
|
|
||||||
console.log('\n\n\n==== Deploy AIO to Firebase hosting. ====\n');
|
console.log('\n\n\n==== Deploy AIO to Firebase hosting. ====\n');
|
||||||
yarn(`firebase use "${projectId}" --token "${firebaseToken}"`);
|
yarn(`firebase use "${projectId}" --token "${firebaseToken}"`);
|
||||||
|
@ -183,8 +208,8 @@ function deploy(
|
||||||
`firebase deploy --only hosting:aio --message "Commit: ${currentCommit}" --non-interactive ` +
|
`firebase deploy --only hosting:aio --message "Commit: ${currentCommit}" --non-interactive ` +
|
||||||
`--token "${firebaseToken}"`);
|
`--token "${firebaseToken}"`);
|
||||||
|
|
||||||
console.log('\n\n\n==== Run PWA-score tests. ====\n');
|
console.log('\n\n\n==== Run post-deploy actions. ====\n');
|
||||||
yarn(`test-pwa-score "${deployedUrl}" "${minPwaScore}"`);
|
postDeployActions.forEach(fn => fn(data));
|
||||||
}
|
}
|
||||||
|
|
||||||
function getRemoteRefs(refOrPattern, remote = NG_REMOTE_URL) {
|
function getRemoteRefs(refOrPattern, remote = NG_REMOTE_URL) {
|
||||||
|
@ -195,10 +220,19 @@ function getLatestCommit(branchName, remote = undefined) {
|
||||||
return getRemoteRefs(branchName, remote)[0].slice(0, 40);
|
return getRemoteRefs(branchName, remote)[0].slice(0, 40);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function serializeActions(actions) {
|
||||||
|
return actions.map(fn => fn.name).join(', ');
|
||||||
|
}
|
||||||
|
|
||||||
function skipDeployment(reason) {
|
function skipDeployment(reason) {
|
||||||
return {reason, skipped: true};
|
return {reason, skipped: true};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function testPwaScore({deployedUrl, minPwaScore}) {
|
||||||
|
console.log('\n\n\n==== Run PWA-score tests. ====\n');
|
||||||
|
yarn(`test-pwa-score "${deployedUrl}" "${minPwaScore}"`);
|
||||||
|
}
|
||||||
|
|
||||||
function yarn(cmd) {
|
function yarn(cmd) {
|
||||||
// Using `--silent` to ensure no secret env variables are printed.
|
// Using `--silent` to ensure no secret env variables are printed.
|
||||||
//
|
//
|
||||||
|
|
|
@ -6,60 +6,70 @@ const {computeDeploymentInfo, computeInputVars, getLatestCommit} = require('./de
|
||||||
|
|
||||||
|
|
||||||
describe('deploy-to-firebase:', () => {
|
describe('deploy-to-firebase:', () => {
|
||||||
|
// Helpers
|
||||||
|
const jsonFunctionReplacer = (_key, val) =>
|
||||||
|
(typeof val === 'function') ? `function:${val.name}` : val;
|
||||||
|
const getDeploymentInfoFor = env => {
|
||||||
|
const deploymentInfo = computeDeploymentInfo(computeInputVars(env));
|
||||||
|
return JSON.parse(JSON.stringify(deploymentInfo, jsonFunctionReplacer));
|
||||||
|
};
|
||||||
|
|
||||||
it('master - skip deploy - not angular', () => {
|
it('master - skip deploy - not angular', () => {
|
||||||
expect(computeDeploymentInfo(computeInputVars({
|
expect(getDeploymentInfoFor({
|
||||||
CI_REPO_OWNER: 'angular',
|
CI_REPO_OWNER: 'angular',
|
||||||
CI_REPO_NAME: 'notangular',
|
CI_REPO_NAME: 'notangular',
|
||||||
}))).toEqual({
|
})).toEqual({
|
||||||
skipped: true,
|
skipped: true,
|
||||||
reason: 'Skipping deploy because this is not angular/angular.',
|
reason: 'Skipping deploy because this is not angular/angular.',
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
it('master - skip deploy - angular fork', () => {
|
it('master - skip deploy - angular fork', () => {
|
||||||
expect(computeDeploymentInfo(computeInputVars({
|
expect(getDeploymentInfoFor({
|
||||||
CI_REPO_OWNER: 'notangular',
|
CI_REPO_OWNER: 'notangular',
|
||||||
CI_REPO_NAME: 'angular',
|
CI_REPO_NAME: 'angular',
|
||||||
}))).toEqual({
|
})).toEqual({
|
||||||
skipped: true,
|
skipped: true,
|
||||||
reason: 'Skipping deploy because this is not angular/angular.',
|
reason: 'Skipping deploy because this is not angular/angular.',
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
it('master - skip deploy - pull request', () => {
|
it('master - skip deploy - pull request', () => {
|
||||||
expect(computeDeploymentInfo(computeInputVars({
|
expect(getDeploymentInfoFor({
|
||||||
CI_REPO_OWNER: 'angular',
|
CI_REPO_OWNER: 'angular',
|
||||||
CI_REPO_NAME: 'angular',
|
CI_REPO_NAME: 'angular',
|
||||||
CI_PULL_REQUEST: 'true',
|
CI_PULL_REQUEST: 'true',
|
||||||
}))).toEqual({
|
})).toEqual({
|
||||||
skipped: true,
|
skipped: true,
|
||||||
reason: 'Skipping deploy because this is a PR build.',
|
reason: 'Skipping deploy because this is a PR build.',
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
it('master - deploy success', () => {
|
it('master - deploy success', () => {
|
||||||
expect(computeDeploymentInfo(computeInputVars({
|
expect(getDeploymentInfoFor({
|
||||||
CI_REPO_OWNER: 'angular',
|
CI_REPO_OWNER: 'angular',
|
||||||
CI_REPO_NAME: 'angular',
|
CI_REPO_NAME: 'angular',
|
||||||
CI_PULL_REQUEST: 'false',
|
CI_PULL_REQUEST: 'false',
|
||||||
CI_BRANCH: 'master',
|
CI_BRANCH: 'master',
|
||||||
CI_COMMIT: getLatestCommit('master'),
|
CI_COMMIT: getLatestCommit('master'),
|
||||||
}))).toEqual({
|
})).toEqual({
|
||||||
deployEnv: 'next',
|
deployEnv: 'next',
|
||||||
projectId: 'angular-io',
|
projectId: 'angular-io',
|
||||||
siteId: 'next-angular-io-site',
|
siteId: 'next-angular-io-site',
|
||||||
deployedUrl: 'https://next.angular.io/',
|
deployedUrl: 'https://next.angular.io/',
|
||||||
|
preDeployActions: ['function:build', 'function:checkPayloadSize'],
|
||||||
|
postDeployActions: ['function:testPwaScore'],
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
it('master - skip deploy - commit not HEAD', () => {
|
it('master - skip deploy - commit not HEAD', () => {
|
||||||
expect(computeDeploymentInfo(computeInputVars({
|
expect(getDeploymentInfoFor({
|
||||||
CI_REPO_OWNER: 'angular',
|
CI_REPO_OWNER: 'angular',
|
||||||
CI_REPO_NAME: 'angular',
|
CI_REPO_NAME: 'angular',
|
||||||
CI_PULL_REQUEST: 'false',
|
CI_PULL_REQUEST: 'false',
|
||||||
CI_BRANCH: 'master',
|
CI_BRANCH: 'master',
|
||||||
CI_COMMIT: 'DUMMY_TEST_COMMIT',
|
CI_COMMIT: 'DUMMY_TEST_COMMIT',
|
||||||
}))).toEqual({
|
})).toEqual({
|
||||||
skipped: true,
|
skipped: true,
|
||||||
reason:
|
reason:
|
||||||
'Skipping deploy because DUMMY_TEST_COMMIT is not the latest commit ' +
|
'Skipping deploy because DUMMY_TEST_COMMIT is not the latest commit ' +
|
||||||
|
@ -68,30 +78,32 @@ describe('deploy-to-firebase:', () => {
|
||||||
});
|
});
|
||||||
|
|
||||||
it('stable - deploy success', () => {
|
it('stable - deploy success', () => {
|
||||||
expect(computeDeploymentInfo(computeInputVars({
|
expect(getDeploymentInfoFor({
|
||||||
CI_REPO_OWNER: 'angular',
|
CI_REPO_OWNER: 'angular',
|
||||||
CI_REPO_NAME: 'angular',
|
CI_REPO_NAME: 'angular',
|
||||||
CI_PULL_REQUEST: 'false',
|
CI_PULL_REQUEST: 'false',
|
||||||
CI_BRANCH: '4.3.x',
|
CI_BRANCH: '4.3.x',
|
||||||
CI_STABLE_BRANCH: '4.3.x',
|
CI_STABLE_BRANCH: '4.3.x',
|
||||||
CI_COMMIT: getLatestCommit('4.3.x'),
|
CI_COMMIT: getLatestCommit('4.3.x'),
|
||||||
}))).toEqual({
|
})).toEqual({
|
||||||
deployEnv: 'stable',
|
deployEnv: 'stable',
|
||||||
projectId: 'angular-io',
|
projectId: 'angular-io',
|
||||||
siteId: 'v4-angular-io-site',
|
siteId: 'v4-angular-io-site',
|
||||||
deployedUrl: 'https://angular.io/',
|
deployedUrl: 'https://angular.io/',
|
||||||
|
preDeployActions: ['function:build', 'function:checkPayloadSize'],
|
||||||
|
postDeployActions: ['function:testPwaScore'],
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
it('stable - skip deploy - commit not HEAD', () => {
|
it('stable - skip deploy - commit not HEAD', () => {
|
||||||
expect(computeDeploymentInfo(computeInputVars({
|
expect(getDeploymentInfoFor({
|
||||||
CI_REPO_OWNER: 'angular',
|
CI_REPO_OWNER: 'angular',
|
||||||
CI_REPO_NAME: 'angular',
|
CI_REPO_NAME: 'angular',
|
||||||
CI_PULL_REQUEST: 'false',
|
CI_PULL_REQUEST: 'false',
|
||||||
CI_BRANCH: '4.3.x',
|
CI_BRANCH: '4.3.x',
|
||||||
CI_STABLE_BRANCH: '4.3.x',
|
CI_STABLE_BRANCH: '4.3.x',
|
||||||
CI_COMMIT: 'DUMMY_TEST_COMMIT',
|
CI_COMMIT: 'DUMMY_TEST_COMMIT',
|
||||||
}))).toEqual({
|
})).toEqual({
|
||||||
skipped: true,
|
skipped: true,
|
||||||
reason:
|
reason:
|
||||||
'Skipping deploy because DUMMY_TEST_COMMIT is not the latest commit ' +
|
'Skipping deploy because DUMMY_TEST_COMMIT is not the latest commit ' +
|
||||||
|
@ -100,48 +112,52 @@ describe('deploy-to-firebase:', () => {
|
||||||
});
|
});
|
||||||
|
|
||||||
it('archive - deploy success', () => {
|
it('archive - deploy success', () => {
|
||||||
expect(computeDeploymentInfo(computeInputVars({
|
expect(getDeploymentInfoFor({
|
||||||
CI_REPO_OWNER: 'angular',
|
CI_REPO_OWNER: 'angular',
|
||||||
CI_REPO_NAME: 'angular',
|
CI_REPO_NAME: 'angular',
|
||||||
CI_PULL_REQUEST: 'false',
|
CI_PULL_REQUEST: 'false',
|
||||||
CI_BRANCH: '2.4.x',
|
CI_BRANCH: '2.4.x',
|
||||||
CI_STABLE_BRANCH: '4.3.x',
|
CI_STABLE_BRANCH: '4.3.x',
|
||||||
CI_COMMIT: getLatestCommit('2.4.x'),
|
CI_COMMIT: getLatestCommit('2.4.x'),
|
||||||
}))).toEqual({
|
})).toEqual({
|
||||||
deployEnv: 'archive',
|
deployEnv: 'archive',
|
||||||
projectId: 'angular-io',
|
projectId: 'angular-io',
|
||||||
siteId: 'v2-angular-io-site',
|
siteId: 'v2-angular-io-site',
|
||||||
deployedUrl: 'https://v2.angular.io/',
|
deployedUrl: 'https://v2.angular.io/',
|
||||||
|
preDeployActions: ['function:build', 'function:checkPayloadSize'],
|
||||||
|
postDeployActions: ['function:testPwaScore'],
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
// v9 used to be special-cased, because it was piloting the Firebase hosting "multisites" setup.
|
// v9 used to be special-cased, because it was piloting the Firebase hosting "multisites" setup.
|
||||||
// See https://angular-team.atlassian.net/browse/DEV-125 for more info.
|
// See https://angular-team.atlassian.net/browse/DEV-125 for more info.
|
||||||
it('archive - deploy success (no special case for v9)', () => {
|
it('archive - deploy success (no special case for v9)', () => {
|
||||||
expect(computeDeploymentInfo(computeInputVars({
|
expect(getDeploymentInfoFor({
|
||||||
CI_REPO_OWNER: 'angular',
|
CI_REPO_OWNER: 'angular',
|
||||||
CI_REPO_NAME: 'angular',
|
CI_REPO_NAME: 'angular',
|
||||||
CI_PULL_REQUEST: 'false',
|
CI_PULL_REQUEST: 'false',
|
||||||
CI_BRANCH: '9.1.x',
|
CI_BRANCH: '9.1.x',
|
||||||
CI_STABLE_BRANCH: '10.0.x',
|
CI_STABLE_BRANCH: '10.0.x',
|
||||||
CI_COMMIT: getLatestCommit('9.1.x'),
|
CI_COMMIT: getLatestCommit('9.1.x'),
|
||||||
}))).toEqual({
|
})).toEqual({
|
||||||
deployEnv: 'archive',
|
deployEnv: 'archive',
|
||||||
projectId: 'angular-io',
|
projectId: 'angular-io',
|
||||||
siteId: 'v9-angular-io-site',
|
siteId: 'v9-angular-io-site',
|
||||||
deployedUrl: 'https://v9.angular.io/',
|
deployedUrl: 'https://v9.angular.io/',
|
||||||
|
preDeployActions: ['function:build', 'function:checkPayloadSize'],
|
||||||
|
postDeployActions: ['function:testPwaScore'],
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
it('archive - skip deploy - commit not HEAD', () => {
|
it('archive - skip deploy - commit not HEAD', () => {
|
||||||
expect(computeDeploymentInfo(computeInputVars({
|
expect(getDeploymentInfoFor({
|
||||||
CI_REPO_OWNER: 'angular',
|
CI_REPO_OWNER: 'angular',
|
||||||
CI_REPO_NAME: 'angular',
|
CI_REPO_NAME: 'angular',
|
||||||
CI_PULL_REQUEST: 'false',
|
CI_PULL_REQUEST: 'false',
|
||||||
CI_BRANCH: '2.4.x',
|
CI_BRANCH: '2.4.x',
|
||||||
CI_STABLE_BRANCH: '4.3.x',
|
CI_STABLE_BRANCH: '4.3.x',
|
||||||
CI_COMMIT: 'DUMMY_TEST_COMMIT',
|
CI_COMMIT: 'DUMMY_TEST_COMMIT',
|
||||||
}))).toEqual({
|
})).toEqual({
|
||||||
skipped: true,
|
skipped: true,
|
||||||
reason:
|
reason:
|
||||||
'Skipping deploy because DUMMY_TEST_COMMIT is not the latest commit ' +
|
'Skipping deploy because DUMMY_TEST_COMMIT is not the latest commit ' +
|
||||||
|
@ -150,14 +166,14 @@ describe('deploy-to-firebase:', () => {
|
||||||
});
|
});
|
||||||
|
|
||||||
it('archive - skip deploy - major same as stable, minor less than stable', () => {
|
it('archive - skip deploy - major same as stable, minor less than stable', () => {
|
||||||
expect(computeDeploymentInfo(computeInputVars({
|
expect(getDeploymentInfoFor({
|
||||||
CI_REPO_OWNER: 'angular',
|
CI_REPO_OWNER: 'angular',
|
||||||
CI_REPO_NAME: 'angular',
|
CI_REPO_NAME: 'angular',
|
||||||
CI_PULL_REQUEST: 'false',
|
CI_PULL_REQUEST: 'false',
|
||||||
CI_BRANCH: '2.1.x',
|
CI_BRANCH: '2.1.x',
|
||||||
CI_STABLE_BRANCH: '2.2.x',
|
CI_STABLE_BRANCH: '2.2.x',
|
||||||
CI_COMMIT: getLatestCommit('2.1.x'),
|
CI_COMMIT: getLatestCommit('2.1.x'),
|
||||||
}))).toEqual({
|
})).toEqual({
|
||||||
skipped: true,
|
skipped: true,
|
||||||
reason:
|
reason:
|
||||||
'Skipping deploy of branch "2.1.x" to Firebase.\n' +
|
'Skipping deploy of branch "2.1.x" to Firebase.\n' +
|
||||||
|
@ -166,14 +182,14 @@ describe('deploy-to-firebase:', () => {
|
||||||
});
|
});
|
||||||
|
|
||||||
it('archive - skip deploy - major lower than stable, minor not latest', () => {
|
it('archive - skip deploy - major lower than stable, minor not latest', () => {
|
||||||
expect(computeDeploymentInfo(computeInputVars({
|
expect(getDeploymentInfoFor({
|
||||||
CI_REPO_OWNER: 'angular',
|
CI_REPO_OWNER: 'angular',
|
||||||
CI_REPO_NAME: 'angular',
|
CI_REPO_NAME: 'angular',
|
||||||
CI_PULL_REQUEST: 'false',
|
CI_PULL_REQUEST: 'false',
|
||||||
CI_BRANCH: '2.1.x',
|
CI_BRANCH: '2.1.x',
|
||||||
CI_STABLE_BRANCH: '4.3.x',
|
CI_STABLE_BRANCH: '4.3.x',
|
||||||
CI_COMMIT: getLatestCommit('2.1.x'),
|
CI_COMMIT: getLatestCommit('2.1.x'),
|
||||||
}))).toEqual({
|
})).toEqual({
|
||||||
skipped: true,
|
skipped: true,
|
||||||
reason:
|
reason:
|
||||||
'Skipping deploy of branch "2.1.x" to Firebase.\n' +
|
'Skipping deploy of branch "2.1.x" to Firebase.\n' +
|
||||||
|
@ -182,46 +198,50 @@ describe('deploy-to-firebase:', () => {
|
||||||
});
|
});
|
||||||
|
|
||||||
it('rc - deploy success - major higher than stable', () => {
|
it('rc - deploy success - major higher than stable', () => {
|
||||||
expect(computeDeploymentInfo(computeInputVars({
|
expect(getDeploymentInfoFor({
|
||||||
CI_REPO_OWNER: 'angular',
|
CI_REPO_OWNER: 'angular',
|
||||||
CI_REPO_NAME: 'angular',
|
CI_REPO_NAME: 'angular',
|
||||||
CI_PULL_REQUEST: 'false',
|
CI_PULL_REQUEST: 'false',
|
||||||
CI_BRANCH: '4.4.x',
|
CI_BRANCH: '4.4.x',
|
||||||
CI_STABLE_BRANCH: '2.2.x',
|
CI_STABLE_BRANCH: '2.2.x',
|
||||||
CI_COMMIT: getLatestCommit('4.4.x'),
|
CI_COMMIT: getLatestCommit('4.4.x'),
|
||||||
}))).toEqual({
|
})).toEqual({
|
||||||
deployEnv: 'rc',
|
deployEnv: 'rc',
|
||||||
projectId: 'angular-io',
|
projectId: 'angular-io',
|
||||||
siteId: 'rc-angular-io-site',
|
siteId: 'rc-angular-io-site',
|
||||||
deployedUrl: 'https://rc.angular.io/',
|
deployedUrl: 'https://rc.angular.io/',
|
||||||
|
preDeployActions: ['function:build', 'function:checkPayloadSize'],
|
||||||
|
postDeployActions: ['function:testPwaScore'],
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
it('rc - deploy success - major same as stable, minor higher', () => {
|
it('rc - deploy success - major same as stable, minor higher', () => {
|
||||||
expect(computeDeploymentInfo(computeInputVars({
|
expect(getDeploymentInfoFor({
|
||||||
CI_REPO_OWNER: 'angular',
|
CI_REPO_OWNER: 'angular',
|
||||||
CI_REPO_NAME: 'angular',
|
CI_REPO_NAME: 'angular',
|
||||||
CI_PULL_REQUEST: 'false',
|
CI_PULL_REQUEST: 'false',
|
||||||
CI_BRANCH: '2.4.x',
|
CI_BRANCH: '2.4.x',
|
||||||
CI_STABLE_BRANCH: '2.2.x',
|
CI_STABLE_BRANCH: '2.2.x',
|
||||||
CI_COMMIT: getLatestCommit('2.4.x'),
|
CI_COMMIT: getLatestCommit('2.4.x'),
|
||||||
}))).toEqual({
|
})).toEqual({
|
||||||
deployEnv: 'rc',
|
deployEnv: 'rc',
|
||||||
projectId: 'angular-io',
|
projectId: 'angular-io',
|
||||||
siteId: 'rc-angular-io-site',
|
siteId: 'rc-angular-io-site',
|
||||||
deployedUrl: 'https://rc.angular.io/',
|
deployedUrl: 'https://rc.angular.io/',
|
||||||
|
preDeployActions: ['function:build', 'function:checkPayloadSize'],
|
||||||
|
postDeployActions: ['function:testPwaScore'],
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
it('rc - skip deploy - commit not HEAD', () => {
|
it('rc - skip deploy - commit not HEAD', () => {
|
||||||
expect(computeDeploymentInfo(computeInputVars({
|
expect(getDeploymentInfoFor({
|
||||||
CI_REPO_OWNER: 'angular',
|
CI_REPO_OWNER: 'angular',
|
||||||
CI_REPO_NAME: 'angular',
|
CI_REPO_NAME: 'angular',
|
||||||
CI_PULL_REQUEST: 'false',
|
CI_PULL_REQUEST: 'false',
|
||||||
CI_BRANCH: '2.4.x',
|
CI_BRANCH: '2.4.x',
|
||||||
CI_STABLE_BRANCH: '2.2.x',
|
CI_STABLE_BRANCH: '2.2.x',
|
||||||
CI_COMMIT: 'DUMMY_TEST_COMMIT',
|
CI_COMMIT: 'DUMMY_TEST_COMMIT',
|
||||||
}))).toEqual({
|
})).toEqual({
|
||||||
skipped: true,
|
skipped: true,
|
||||||
reason:
|
reason:
|
||||||
'Skipping deploy because DUMMY_TEST_COMMIT is not the latest commit ' +
|
'Skipping deploy because DUMMY_TEST_COMMIT is not the latest commit ' +
|
||||||
|
@ -230,14 +250,14 @@ describe('deploy-to-firebase:', () => {
|
||||||
});
|
});
|
||||||
|
|
||||||
it('rc - skip deploy - major same as stable, minor not latest', () => {
|
it('rc - skip deploy - major same as stable, minor not latest', () => {
|
||||||
expect(computeDeploymentInfo(computeInputVars({
|
expect(getDeploymentInfoFor({
|
||||||
CI_REPO_OWNER: 'angular',
|
CI_REPO_OWNER: 'angular',
|
||||||
CI_REPO_NAME: 'angular',
|
CI_REPO_NAME: 'angular',
|
||||||
CI_PULL_REQUEST: 'false',
|
CI_PULL_REQUEST: 'false',
|
||||||
CI_BRANCH: '2.1.x',
|
CI_BRANCH: '2.1.x',
|
||||||
CI_STABLE_BRANCH: '2.0.x',
|
CI_STABLE_BRANCH: '2.0.x',
|
||||||
CI_COMMIT: getLatestCommit('2.1.x'),
|
CI_COMMIT: getLatestCommit('2.1.x'),
|
||||||
}))).toEqual({
|
})).toEqual({
|
||||||
skipped: true,
|
skipped: true,
|
||||||
reason:
|
reason:
|
||||||
'Skipping deploy of branch "2.1.x" to Firebase.\n' +
|
'Skipping deploy of branch "2.1.x" to Firebase.\n' +
|
||||||
|
@ -246,14 +266,14 @@ describe('deploy-to-firebase:', () => {
|
||||||
});
|
});
|
||||||
|
|
||||||
it('rc - skip deploy - major higher than stable, minor not latest', () => {
|
it('rc - skip deploy - major higher than stable, minor not latest', () => {
|
||||||
expect(computeDeploymentInfo(computeInputVars({
|
expect(getDeploymentInfoFor({
|
||||||
CI_REPO_OWNER: 'angular',
|
CI_REPO_OWNER: 'angular',
|
||||||
CI_REPO_NAME: 'angular',
|
CI_REPO_NAME: 'angular',
|
||||||
CI_PULL_REQUEST: 'false',
|
CI_PULL_REQUEST: 'false',
|
||||||
CI_BRANCH: '4.3.x',
|
CI_BRANCH: '4.3.x',
|
||||||
CI_STABLE_BRANCH: '2.4.x',
|
CI_STABLE_BRANCH: '2.4.x',
|
||||||
CI_COMMIT: getLatestCommit('4.3.x'),
|
CI_COMMIT: getLatestCommit('4.3.x'),
|
||||||
}))).toEqual({
|
})).toEqual({
|
||||||
skipped: true,
|
skipped: true,
|
||||||
reason:
|
reason:
|
||||||
'Skipping deploy of branch "4.3.x" to Firebase.\n' +
|
'Skipping deploy of branch "4.3.x" to Firebase.\n' +
|
||||||
|
@ -278,6 +298,8 @@ describe('deploy-to-firebase:', () => {
|
||||||
'Build/deploy mode : next\n' +
|
'Build/deploy mode : next\n' +
|
||||||
'Firebase project : angular-io\n' +
|
'Firebase project : angular-io\n' +
|
||||||
'Firebase site : next-angular-io-site\n' +
|
'Firebase site : next-angular-io-site\n' +
|
||||||
|
'Pre-deploy actions : build, checkPayloadSize\n' +
|
||||||
|
'Post-deploy actions : testPwaScore\n' +
|
||||||
'Deployment URLs : https://next.angular.io/\n' +
|
'Deployment URLs : https://next.angular.io/\n' +
|
||||||
' https://next-angular-io-site.web.app/');
|
' https://next-angular-io-site.web.app/');
|
||||||
});
|
});
|
||||||
|
|
Loading…
Reference in New Issue