1
0
mirror of https://github.com/angular/angular-cli.git synced 2025-05-16 10:33:43 +08:00

ci: add back angular snapshot e2e on master

This commit is contained in:
Filipe Silva 2018-08-30 17:08:47 +01:00 committed by Keen Yee Liau
parent b403aa69c1
commit 9fdcdf49bb
10 changed files with 39 additions and 45 deletions

@ -101,6 +101,17 @@ jobs:
- run: npm install --global npm@6 - run: npm install --global npm@6
- run: xvfb-run -a node ./tests/legacy-cli/run_e2e --glob=tests/basic/* - 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: build:
<<: *defaults <<: *defaults
steps: steps:
@ -170,6 +181,12 @@ workflows:
- e2e-node-8: - e2e-node-8:
requires: requires:
- build - build
- e2e-cli-ng-snapshots:
requires:
- build
filters:
branches:
only: master
- snapshot_publish: - snapshot_publish:
requires: requires:
- test - test

@ -12,33 +12,5 @@ export default function() {
return; return;
} }
return npm('run', 'build', '--', '--local') 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}`;
});
});
}));
});
} }

@ -37,7 +37,7 @@ export default async function() {
.then(() => useCIChrome('e2e')) .then(() => useCIChrome('e2e'))
.then(() => useCIChrome('src')) .then(() => useCIChrome('src'))
.then(() => argv['ng-version'] ? useNgVersion(argv['ng-version']) : Promise.resolve()) .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. // npm link on Circle CI is very noisy.
.then(() => silentNpm('install')) .then(() => silentNpm('install'))
.then(() => ng('version')) .then(() => ng('version'))

@ -19,7 +19,7 @@ export default function () {
let platformServerVersion = readNgVersion(); let platformServerVersion = readNgVersion();
if (getGlobalVariable('argv').nightly) { if (getGlobalVariable('argv')['ng-snapshots']) {
platformServerVersion = 'github:angular/platform-server-builds'; platformServerVersion = 'github:angular/platform-server-builds';
} }

@ -20,7 +20,7 @@ export default function () {
let platformServerVersion = readNgVersion(); let platformServerVersion = readNgVersion();
if (getGlobalVariable('argv').nightly) { if (getGlobalVariable('argv')['ng-snapshots']) {
platformServerVersion = 'github:angular/platform-server-builds'; platformServerVersion = 'github:angular/platform-server-builds';
} }

@ -21,7 +21,7 @@ export default function () {
let platformServerVersion = readNgVersion(); let platformServerVersion = readNgVersion();
if (getGlobalVariable('argv').nightly) { if (getGlobalVariable('argv')['ng-snapshots']) {
platformServerVersion = 'github:angular/platform-server-builds'; platformServerVersion = 'github:angular/platform-server-builds';
} }

@ -19,7 +19,7 @@ export default async function() {
// Should trigger a rebuild. // Should trigger a rebuild.
await appendToFile('src/environments/environment.prod.ts', `console.log('PROD');`); await appendToFile('src/environments/environment.prod.ts', `console.log('PROD');`);
await waitForAnyProcessOutputToMatch(webpackGoodRegEx, 40000); await waitForAnyProcessOutputToMatch(webpackGoodRegEx, 45000);
} catch (e) { } catch (e) {
error = e; error = e;
} }

@ -6,7 +6,7 @@ export default async function () {
// TypeScript minor versions. // TypeScript minor versions.
return; return;
// Disable the strict TS version check for nightly // Disable the strict TS version check for snapshots
await updateJsonFile('src/tsconfig.app.json', configJson => { await updateJsonFile('src/tsconfig.app.json', configJson => {
configJson.angularCompilerOptions = { configJson.angularCompilerOptions = {
...configJson.angularCompilerOptions, ...configJson.angularCompilerOptions,

@ -44,7 +44,7 @@ export function createProject(name: string, ...args: string[]) {
.then(() => useDevKitSnapshots()) .then(() => useDevKitSnapshots())
.then(() => argv['ng2'] ? useNg2() : Promise.resolve()) .then(() => argv['ng2'] ? useNg2() : Promise.resolve())
.then(() => argv['ng4'] ? useNg4() : 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(() => console.log(`Project ${name} created... Installing npm.`))
.then(() => silentNpm('install')) .then(() => silentNpm('install'))
.then(() => useCIDefaults(name)); .then(() => useCIDefaults(name));
@ -110,10 +110,13 @@ export function useBuiltPackages() {
export function useSha() { export function useSha() {
const argv = getGlobalVariable('argv'); const argv = getGlobalVariable('argv');
if (argv.nightly || argv['ng-sha']) { if (argv['ng-snapshots'] || argv['ng-tag']) {
const label = argv['ng-sha'] ? `#2.0.0-${argv['ng-sha']}` : ''; // 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 => { return updateJsonFile('package.json', json => {
// Install over the project with nightly builds. // Install over the project with snapshot builds.
Object.keys(json['dependencies'] || {}) Object.keys(json['dependencies'] || {})
.filter(name => name.match(/^@angular\//)) .filter(name => name.match(/^@angular\//))
.forEach(name => { .forEach(name => {
@ -135,6 +138,8 @@ export function useSha() {
json['devDependencies'][`@angular/${pkgName}`] json['devDependencies'][`@angular/${pkgName}`]
= `github:angular/${pkgName}-builds${label}`; = `github:angular/${pkgName}-builds${label}`;
}); });
json['devDependencies']['typescript'] = '~3.0.1';
}); });
} else { } else {
return Promise.resolve(); return Promise.resolve();
@ -143,7 +148,7 @@ export function useSha() {
export function useNgVersion(version: string) { export function useNgVersion(version: string) {
return updateJsonFile('package.json', json => { return updateJsonFile('package.json', json => {
// Install over the project with nightly builds. // Install over the project with specific versions.
Object.keys(json['dependencies'] || {}) Object.keys(json['dependencies'] || {})
.filter(name => name.match(/^@angular\//)) .filter(name => name.match(/^@angular\//))
.forEach(name => { .forEach(name => {

@ -26,11 +26,11 @@ Error.stackTraceLimit = Infinity;
* rerun tests. * rerun tests.
* --noglobal Skip linking your local @angular/cli directory. Can save a few seconds. * --noglobal Skip linking your local @angular/cli directory. Can save a few seconds.
* --nosilent Never silence ng commands. * --nosilent Never silence ng commands.
* --ng-sha=SHA Use a specific ng-sha. Similar to nightly but point to a master SHA instead * --ng-tag=TAG Use a specific tag for build snapshots. Similar to ng-snapshots but point to a
* of using the latest. * 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/). * --glob Run tests matching this glob pattern (relative to tests/e2e/).
* --ignore Ignore tests matching this glob pattern. * --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 * --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 * created, and npm installed. Ideally you want a project created by a previous
* run of e2e. * run of e2e.
@ -46,13 +46,13 @@ const argv = minimist(process.argv.slice(2), {
'appveyor', 'appveyor',
'debug', 'debug',
'eject', 'eject',
'nightly', 'ng-snapshots',
'noglobal', 'noglobal',
'nosilent', 'nosilent',
'noproject', 'noproject',
'verbose', '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'], 'number': ['nb-shards', 'shard'],
}); });