From 9fdcdf49bb9bc3205b2ec7b32df19bcc490a5dcc Mon Sep 17 00:00:00 2001 From: Filipe Silva <filipematossilva@gmail.com> Date: Thu, 30 Aug 2018 17:08:47 +0100 Subject: [PATCH] ci: add back angular snapshot e2e on master --- .circleci/config.yml | 17 +++++++++++ tests/legacy-cli/e2e/setup/015-build.ts | 30 +------------------ .../e2e/setup/500-create-project.ts | 2 +- .../build/build-app-shell-with-schematic.ts | 2 +- .../e2e/tests/build/build-app-shell.ts | 2 +- .../e2e/tests/build/platform-server.ts | 2 +- .../e2e/tests/build/rebuild-replacements.ts | 2 +- .../tests/build/typescript/typescript-2_7.ts | 2 +- tests/legacy-cli/e2e/utils/project.ts | 15 ++++++---- tests/legacy-cli/e2e_runner.ts | 10 +++---- 10 files changed, 39 insertions(+), 45 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index 5ffb9a5590..fd888daecd 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -101,6 +101,17 @@ jobs: - run: npm install --global npm@6 - run: xvfb-run -a node ./tests/legacy-cli/run_e2e --glob=tests/basic/* + e2e-cli-ng-snapshots: + <<: *defaults + environment: + BASH_ENV: ~/.profile + resource_class: xlarge + parallelism: 4 + steps: + - attach_workspace: *attach_options + - run: npm install --global npm@6 + - run: xvfb-run -a node ./tests/legacy-cli/run_e2e --nb-shards=${CIRCLE_NODE_TOTAL} --shard=${CIRCLE_NODE_INDEX} --ng-snapshots + build: <<: *defaults steps: @@ -170,6 +181,12 @@ workflows: - e2e-node-8: requires: - build + - e2e-cli-ng-snapshots: + requires: + - build + filters: + branches: + only: master - snapshot_publish: requires: - test diff --git a/tests/legacy-cli/e2e/setup/015-build.ts b/tests/legacy-cli/e2e/setup/015-build.ts index 8bf77c0a2e..faf9b3f5b9 100644 --- a/tests/legacy-cli/e2e/setup/015-build.ts +++ b/tests/legacy-cli/e2e/setup/015-build.ts @@ -12,33 +12,5 @@ export default function() { return; } - return npm('run', 'build', '--', '--local') - .then(() => { - if (!argv.nightly && !argv['ng-sha']) { - return; - } - - console.log('Updating package.json from dist for nightly Angular packages...'); - const label = argv['ng-sha'] ? `#2.0.0-${argv['ng-sha']}` : ''; - - return Promise.all(Object.keys(packages).map(pkgName => { - return updateJsonFile(join(packages[pkgName].dist, 'package.json'), json => { - Object.keys(json['dependencies'] || {}) - .filter(name => name.match(/^@angular\//)) - .forEach(name => { - const pkgName = name.split(/\//)[1]; - json['dependencies'][`@angular/${pkgName}`] - = `github:angular/${pkgName}-builds${label}`; - }); - - Object.keys(json['devDependencies'] || {}) - .filter(name => name.match(/^@angular\//)) - .forEach(name => { - const pkgName = name.split(/\//)[1]; - json['devDependencies'][`@angular/${pkgName}`] - = `github:angular/${pkgName}-builds${label}`; - }); - }); - })); - }); + return npm('run', 'build', '--', '--local'); } diff --git a/tests/legacy-cli/e2e/setup/500-create-project.ts b/tests/legacy-cli/e2e/setup/500-create-project.ts index ddfadf67f9..a0a30032db 100644 --- a/tests/legacy-cli/e2e/setup/500-create-project.ts +++ b/tests/legacy-cli/e2e/setup/500-create-project.ts @@ -37,7 +37,7 @@ export default async function() { .then(() => useCIChrome('e2e')) .then(() => useCIChrome('src')) .then(() => argv['ng-version'] ? useNgVersion(argv['ng-version']) : Promise.resolve()) - .then(() => argv.nightly || argv['ng-sha'] ? useSha() : Promise.resolve()) + .then(() => argv['ng-snapshots'] || argv['ng-tag'] ? useSha() : Promise.resolve()) // npm link on Circle CI is very noisy. .then(() => silentNpm('install')) .then(() => ng('version')) diff --git a/tests/legacy-cli/e2e/tests/build/build-app-shell-with-schematic.ts b/tests/legacy-cli/e2e/tests/build/build-app-shell-with-schematic.ts index 1b291dbd27..e9d85afca7 100644 --- a/tests/legacy-cli/e2e/tests/build/build-app-shell-with-schematic.ts +++ b/tests/legacy-cli/e2e/tests/build/build-app-shell-with-schematic.ts @@ -19,7 +19,7 @@ export default function () { let platformServerVersion = readNgVersion(); - if (getGlobalVariable('argv').nightly) { + if (getGlobalVariable('argv')['ng-snapshots']) { platformServerVersion = 'github:angular/platform-server-builds'; } diff --git a/tests/legacy-cli/e2e/tests/build/build-app-shell.ts b/tests/legacy-cli/e2e/tests/build/build-app-shell.ts index bd5462ed70..b836abc35f 100644 --- a/tests/legacy-cli/e2e/tests/build/build-app-shell.ts +++ b/tests/legacy-cli/e2e/tests/build/build-app-shell.ts @@ -20,7 +20,7 @@ export default function () { let platformServerVersion = readNgVersion(); - if (getGlobalVariable('argv').nightly) { + if (getGlobalVariable('argv')['ng-snapshots']) { platformServerVersion = 'github:angular/platform-server-builds'; } diff --git a/tests/legacy-cli/e2e/tests/build/platform-server.ts b/tests/legacy-cli/e2e/tests/build/platform-server.ts index 9e5371afd8..ef40c90da6 100644 --- a/tests/legacy-cli/e2e/tests/build/platform-server.ts +++ b/tests/legacy-cli/e2e/tests/build/platform-server.ts @@ -21,7 +21,7 @@ export default function () { let platformServerVersion = readNgVersion(); - if (getGlobalVariable('argv').nightly) { + if (getGlobalVariable('argv')['ng-snapshots']) { platformServerVersion = 'github:angular/platform-server-builds'; } diff --git a/tests/legacy-cli/e2e/tests/build/rebuild-replacements.ts b/tests/legacy-cli/e2e/tests/build/rebuild-replacements.ts index f9e99cb8d2..7669da896e 100644 --- a/tests/legacy-cli/e2e/tests/build/rebuild-replacements.ts +++ b/tests/legacy-cli/e2e/tests/build/rebuild-replacements.ts @@ -19,7 +19,7 @@ export default async function() { // Should trigger a rebuild. await appendToFile('src/environments/environment.prod.ts', `console.log('PROD');`); - await waitForAnyProcessOutputToMatch(webpackGoodRegEx, 40000); + await waitForAnyProcessOutputToMatch(webpackGoodRegEx, 45000); } catch (e) { error = e; } diff --git a/tests/legacy-cli/e2e/tests/build/typescript/typescript-2_7.ts b/tests/legacy-cli/e2e/tests/build/typescript/typescript-2_7.ts index 19b7ffd056..0afd67574d 100644 --- a/tests/legacy-cli/e2e/tests/build/typescript/typescript-2_7.ts +++ b/tests/legacy-cli/e2e/tests/build/typescript/typescript-2_7.ts @@ -6,7 +6,7 @@ export default async function () { // TypeScript minor versions. return; - // Disable the strict TS version check for nightly + // Disable the strict TS version check for snapshots await updateJsonFile('src/tsconfig.app.json', configJson => { configJson.angularCompilerOptions = { ...configJson.angularCompilerOptions, diff --git a/tests/legacy-cli/e2e/utils/project.ts b/tests/legacy-cli/e2e/utils/project.ts index ee6b1bc2d7..ceaa5acc97 100644 --- a/tests/legacy-cli/e2e/utils/project.ts +++ b/tests/legacy-cli/e2e/utils/project.ts @@ -44,7 +44,7 @@ export function createProject(name: string, ...args: string[]) { .then(() => useDevKitSnapshots()) .then(() => argv['ng2'] ? useNg2() : Promise.resolve()) .then(() => argv['ng4'] ? useNg4() : Promise.resolve()) - .then(() => argv.nightly || argv['ng-sha'] ? useSha() : Promise.resolve()) + .then(() => argv['ng-snapshots'] || argv['ng-tag'] ? useSha() : Promise.resolve()) .then(() => console.log(`Project ${name} created... Installing npm.`)) .then(() => silentNpm('install')) .then(() => useCIDefaults(name)); @@ -110,10 +110,13 @@ export function useBuiltPackages() { export function useSha() { const argv = getGlobalVariable('argv'); - if (argv.nightly || argv['ng-sha']) { - const label = argv['ng-sha'] ? `#2.0.0-${argv['ng-sha']}` : ''; + if (argv['ng-snapshots'] || argv['ng-tag']) { + // We need more than the sha here, version is also needed. Examples of latest tags: + // 7.0.0-beta.4+dd2a650 + // 6.1.6+4a8d56a + const label = argv['ng-tag'] ? argv['ng-tag'] : ''; return updateJsonFile('package.json', json => { - // Install over the project with nightly builds. + // Install over the project with snapshot builds. Object.keys(json['dependencies'] || {}) .filter(name => name.match(/^@angular\//)) .forEach(name => { @@ -135,6 +138,8 @@ export function useSha() { json['devDependencies'][`@angular/${pkgName}`] = `github:angular/${pkgName}-builds${label}`; }); + + json['devDependencies']['typescript'] = '~3.0.1'; }); } else { return Promise.resolve(); @@ -143,7 +148,7 @@ export function useSha() { export function useNgVersion(version: string) { return updateJsonFile('package.json', json => { - // Install over the project with nightly builds. + // Install over the project with specific versions. Object.keys(json['dependencies'] || {}) .filter(name => name.match(/^@angular\//)) .forEach(name => { diff --git a/tests/legacy-cli/e2e_runner.ts b/tests/legacy-cli/e2e_runner.ts index 4a93a78939..7eebdf2acb 100644 --- a/tests/legacy-cli/e2e_runner.ts +++ b/tests/legacy-cli/e2e_runner.ts @@ -26,11 +26,11 @@ Error.stackTraceLimit = Infinity; * rerun tests. * --noglobal Skip linking your local @angular/cli directory. Can save a few seconds. * --nosilent Never silence ng commands. - * --ng-sha=SHA Use a specific ng-sha. Similar to nightly but point to a master SHA instead - * of using the latest. + * --ng-tag=TAG Use a specific tag for build snapshots. Similar to ng-snapshots but point to a + * tag of using the latest master. + * --ng-snapshots Install angular snapshot builds in the test project. * --glob Run tests matching this glob pattern (relative to tests/e2e/). * --ignore Ignore tests matching this glob pattern. - * --nightly Install angular nightly builds over the test project. * --reuse=/path Use a path instead of create a new project. That project should have been * created, and npm installed. Ideally you want a project created by a previous * run of e2e. @@ -46,13 +46,13 @@ const argv = minimist(process.argv.slice(2), { 'appveyor', 'debug', 'eject', - 'nightly', + 'ng-snapshots', 'noglobal', 'nosilent', 'noproject', 'verbose', ], - 'string': ['devkit', 'glob', 'ignore', 'reuse', 'ng-sha', 'tmpdir', 'ng-version'], + 'string': ['devkit', 'glob', 'ignore', 'reuse', 'ng-tag', 'tmpdir', 'ng-version'], 'number': ['nb-shards', 'shard'], });