Skip to content

Commit 133693c

Browse files
filipesilvaBrocco
authored andcommitted
ci: use circleci workspaces
1 parent 67ca0fa commit 133693c

File tree

5 files changed

+136
-21
lines changed

5 files changed

+136
-21
lines changed

.circleci/config.yml

Lines changed: 128 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,137 @@
11
version: 2
2+
3+
# Settings common to each job.
4+
anchor_1: &defaults
5+
working_directory: ~/angular-cli
6+
docker:
7+
- image: angular/ngcontainer
8+
9+
# Restore cache based on package-lock.json checksum for branch.
10+
anchor_2: &restore_cache_defaults
11+
key: angular-cli-{{ checksum "package-lock.json" }}
12+
13+
# Attach workspace that contains:
14+
# - dist/ : built cli
15+
# - angular-cli-e2e-default/ : initialized e2e test project
16+
anchor_3: &attach_workspace_defaults
17+
at: /workspace
18+
219
jobs:
320
build:
4-
working_directory: ~/angular-cli
5-
docker:
6-
- image: angular/ngcontainer
7-
- image: node:8.4
21+
<<: *defaults
822
steps:
923
- checkout
1024
- restore_cache:
11-
key: angular-cli-{{ .Branch }}-{{ checksum "package-lock.json" }}
12-
- run: |
13-
node --version
14-
npm --version
15-
npm install --quiet
25+
<<: *restore_cache_defaults
26+
- run: node --version
27+
- run: npm --version
28+
- run: npm install --quiet
29+
- run: npm run build
1630
- save_cache:
17-
key: angular-cli-{{ .Branch }}-{{ checksum "package-lock.json" }}
31+
key: angular-cli-{{ checksum "package-lock.json" }}
1832
paths:
1933
- "node_modules"
20-
- run: xvfb-run -a node tests/run_e2e.js --glob=tests/build/**
34+
35+
lint:
36+
<<: *defaults
37+
steps:
38+
- checkout
39+
- restore_cache:
40+
<<: *restore_cache_defaults
41+
- run: npm run lint
42+
43+
test:
44+
<<: *defaults
45+
steps:
46+
- checkout
47+
- restore_cache:
48+
<<: *restore_cache_defaults
49+
- run: npm run test
50+
51+
e2e-setup:
52+
<<: *defaults
53+
steps:
54+
- checkout
55+
- restore_cache:
56+
<<: *restore_cache_defaults
57+
- run: mkdir /workspace
58+
- run: mkdir /workspace/angular-cli-e2e-default
59+
# Ignore all tests, we just want the setup step to persist it to the workspace.
60+
- run: node tests/run_e2e.js --tmpdir=/workspace/angular-cli-e2e-default --ignore=**/*
61+
- run: mv dist /workspace/
62+
- persist_to_workspace:
63+
root: /workspace
64+
paths:
65+
- dist/
66+
- angular-cli-e2e-default/
67+
68+
e2e-0:
69+
<<: *defaults
70+
steps:
71+
- checkout
72+
- restore_cache:
73+
<<: *restore_cache_defaults
74+
- attach_workspace:
75+
<<: *attach_workspace_defaults
76+
- run: cp -r /workspace/dist/ ./
77+
- run: xvfb-run -a node tests/run_e2e.js --nobuild --reuse=/workspace/angular-cli-e2e-default/test-project --nb-shards=4 --shard=0 --nosilent
78+
79+
e2e-1:
80+
<<: *defaults
81+
steps:
82+
- checkout
83+
- restore_cache:
84+
<<: *restore_cache_defaults
85+
- attach_workspace:
86+
<<: *attach_workspace_defaults
87+
- run: cp -r /workspace/dist/ ./
88+
- run: xvfb-run -a node tests/run_e2e.js --nobuild --reuse=/workspace/angular-cli-e2e-default/test-project --nb-shards=4 --shard=1 --nosilent
89+
90+
e2e-2:
91+
<<: *defaults
92+
steps:
93+
- checkout
94+
- restore_cache:
95+
<<: *restore_cache_defaults
96+
- attach_workspace:
97+
<<: *attach_workspace_defaults
98+
- run: cp -r /workspace/dist/ ./
99+
- run: xvfb-run -a node tests/run_e2e.js --nobuild --reuse=/workspace/angular-cli-e2e-default/test-project --nb-shards=4 --shard=2 --nosilent
100+
101+
e2e-3:
102+
<<: *defaults
103+
steps:
104+
- checkout
105+
- restore_cache:
106+
<<: *restore_cache_defaults
107+
- attach_workspace:
108+
<<: *attach_workspace_defaults
109+
- run: cp -r /workspace/dist/ ./
110+
- run: xvfb-run -a node tests/run_e2e.js --nobuild --reuse=/workspace/angular-cli-e2e-default/test-project --nb-shards=4 --shard=3 --nosilent
111+
112+
workflows:
113+
version: 2
114+
build_and_test:
115+
jobs:
116+
- build
117+
- lint:
118+
requires:
119+
- build
120+
- test:
121+
requires:
122+
- build
123+
- e2e-setup:
124+
requires:
125+
- build
126+
- e2e-0:
127+
requires:
128+
- e2e-setup
129+
- e2e-1:
130+
requires:
131+
- e2e-setup
132+
- e2e-2:
133+
requires:
134+
- e2e-setup
135+
- e2e-3:
136+
requires:
137+
- e2e-setup

scripts/test-commit-messages.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ logger
3434
// Note: This is based on the gulp task found in the angular/angular repository
3535
execSync('git fetch origin');
3636
// Travis doesn't have master when running jobs on other branches (minor/patch/etc).
37-
execSync('git fetch origin master:master');
37+
execSync('git fetch origin master:master --force');
3838

3939
// Get PR target branch, default to master for running locally.
4040
const currentBranch = process.env.TRAVIS_BRANCH

tests/e2e/setup/200-create-tmp-dir.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
import {dirname} from 'path';
12
import {setGlobalVariable, getGlobalVariable} from '../utils/env';
23

34

@@ -7,7 +8,10 @@ export default function() {
78
const argv = getGlobalVariable('argv');
89

910
// Get to a temporary directory.
10-
let tempRoot = argv.reuse || temp.mkdirSync('angular-cli-e2e-');
11+
let tempRoot = argv.tmpdir || temp.mkdirSync('angular-cli-e2e-');;
12+
if (argv.reuse) {
13+
tempRoot = dirname(argv.reuse);
14+
}
1115
console.log(` Using "${tempRoot}" as temporary directory for a new project.`);
1216
setGlobalVariable('tmp-root', tempRoot);
1317
process.chdir(tempRoot);

tests/e2e/tests/misc/typescript-warning.ts

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -15,13 +15,6 @@ export default function () {
1515
}
1616

1717
return Promise.resolve()
18-
.then(() => silentNpm('uninstall', 'typescript', '--no-save'))
19-
.then(() => ng('build'))
20-
.catch((err) => {
21-
if (!err.message.match('Versions of @angular/compiler-cli and typescript could not')) {
22-
throw new Error('Expected to have missing dependency error in output.');
23-
}
24-
})
2518
// Warning should show.
2619
.then(() => silentNpm('install', `typescript@${unsupportedTsVersion}`, '--no-save'))
2720
.then(() => ng('build'))

tests/e2e_runner.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,7 @@ Error.stackTraceLimit = Infinity;
4141
* passed in.
4242
* --shard Index of this processes' shard.
4343
* --devkit=path Path to the devkit to use. The devkit will be built prior to running.
44+
* --tmpdir=path Override temporary directory to use for new projects.
4445
* If unnamed flags are passed in, the list of tests will be filtered to include only those passed.
4546
*/
4647
const argv = minimist(process.argv.slice(2), {
@@ -54,7 +55,7 @@ const argv = minimist(process.argv.slice(2), {
5455
'noproject',
5556
'verbose',
5657
],
57-
'string': ['devkit', 'glob', 'ignore', 'reuse', 'ng-sha', ],
58+
'string': ['devkit', 'glob', 'ignore', 'reuse', 'ng-sha', 'tmpdir'],
5859
'number': ['nb-shards', 'shard']
5960
});
6061

0 commit comments

Comments
 (0)