Skip to content

Commit

Permalink
ci: add Circle CI
Browse files Browse the repository at this point in the history
  • Loading branch information
filipesilva authored and hansl committed Jul 12, 2017
1 parent 634a041 commit ea592a1
Show file tree
Hide file tree
Showing 4 changed files with 41 additions and 2 deletions.
16 changes: 16 additions & 0 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
version: 2
jobs:
build:
working_directory: ~/angular-cli
docker:
- image: angular/ngcontainer
steps:
- checkout
- restore_cache:
key: angular-cli-{{ .Branch }}-{{ checksum "yarn.lock" }}
- run: yarn --frozen-lockfile
- save_cache:
key: angular-cli-{{ .Branch }}-{{ checksum "yarn.lock" }}
paths:
- "node_modules"
- run: xvfb-run -a node tests/run_e2e.js --glob=tests/build/**
5 changes: 3 additions & 2 deletions tests/e2e/setup/100-npm-link.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import {join} from 'path';
import {npm, exec} from '../utils/process';
import {silentNpm, exec} from '../utils/process';
import {updateJsonFile} from '../utils/project';
import {getGlobalVariable} from '../utils/env';

Expand Down Expand Up @@ -33,7 +33,8 @@ export default function () {
}
});
}))
.then(() => npm('link'))
// npm link is very noisy on the older version used in Circle CI.
.then(() => silentNpm('link'))
.then(() => process.chdir(oldCwd));
})
.then(() => exec(process.platform.startsWith('win') ? 'where' : 'which', 'ng'));
Expand Down
12 changes: 12 additions & 0 deletions tests/e2e/setup/500-create-project.ts
Original file line number Diff line number Diff line change
Expand Up @@ -38,14 +38,25 @@ export default function() {
}))
// There's a race condition happening in Chrome. Enabling logging in chrome used by
// protractor actually fixes it. Logging is piped to a file so it doesn't affect our setup.
// --no-sandbox is needed for Circle CI.
.then(() => replaceInFile('protractor.conf.js', `'browserName': 'chrome'`,
`'browserName': 'chrome',
chromeOptions: {
args: [
"--enable-logging",
"--no-sandbox",
]
}
`))
.then(() => replaceInFile('karma.conf.js', `browsers: ['Chrome'],`,
`browsers: ['ChromeNoSandbox'],
customLaunchers: {
ChromeNoSandbox: {
base: 'Chrome',
flags: ['--no-sandbox']
}
},
`))
.then(() => argv['ng2'] ? useNg2() : Promise.resolve())
.then(() => {
if (argv['nightly'] || argv['ng-sha']) {
Expand Down Expand Up @@ -88,6 +99,7 @@ export default function() {
progress: false
};
}))
// npm link on Circle CI is very noisy.
.then(() => silentNpm('install'))
// Force sourcemaps to be from the root of the filesystem.
.then(() => updateTsConfig(json => {
Expand Down
10 changes: 10 additions & 0 deletions tests/e2e/tests/build/poll.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,16 @@ import {expectToFail, wait} from '../../utils/utils';
const webpackGoodRegEx = /webpack: Compiled successfully./;

export default function() {

// @filipesilva: This test doesn't work correctly on CircleCI while being ran by the test script.
// Polling time seems to be ignored and several builds are fired per second.
// Debugging showed that webpack things the `src/` directory changed on each rebuild.
// Disabling for now.
if (process.env['CIRCLECI']) {
return;
}


return silentExecAndWaitForOutputToMatch('ng', ['serve', '--poll=10000'], webpackGoodRegEx)
// Wait before editing a file.
// Editing too soon seems to trigger a rebuild and throw polling out of whack.
Expand Down

0 comments on commit ea592a1

Please sign in to comment.