Skip to content

Commit

Permalink
chore(actions): updating github actions workflow (#1069)
Browse files Browse the repository at this point in the history
uses prod build, gets tests working, adds E2E
  • Loading branch information
brandyscarney committed Nov 8, 2019
1 parent 8db3777 commit de150ba
Show file tree
Hide file tree
Showing 7 changed files with 127 additions and 45 deletions.
24 changes: 16 additions & 8 deletions .github/workflows/CI.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,8 @@
name: npm install, build and test
# GitHub Actions docs
# https://help.github.com/en/articles/about-github-actions
# https://help.github.com/en/articles/workflow-syntax-for-github-actions

name: Install Dependencies, Lint, Build and Test

on: [push]

Expand All @@ -16,10 +20,14 @@ jobs:
- name: Use Node.js ${{ matrix.node_version }}
uses: actions/setup-node@v1
with:
version: ${{ matrix.node_version }}

- name: npm install, build and test
run: |
npm install
npm run build --if-present
npm test
node-version: ${{ matrix.node_version }}
- name: Install Dependencies
run: npm ci
- name: Lint
run: npm run lint
- name: Build
run: npm run build -- --prod
- name: Test
run: npm test -- --configuration=ci
- name: E2E
run: npm run e2e -- --configuration=ci
19 changes: 18 additions & 1 deletion angular.json
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,13 @@
},
"src/manifest.json"
]
},
"configurations": {
"ci": {
"watch": false,
"progress": false,
"browsers": "ChromeHeadlessCI"
}
}
},
"lint": {
Expand Down Expand Up @@ -155,7 +162,17 @@
"builder": "@angular-devkit/build-angular:protractor",
"options": {
"protractorConfig": "e2e/protractor.conf.js",
"devServerTarget": "app:serve"
"devServerTarget": "app:serve",
"webdriverUpdate": false
},
"configurations": {
"production": {
"devServerTarget": "app:serve:production"
},
"ci": {
"devServerTarget": "app:serve:production",
"protractorConfig": "e2e/protractor-ci.conf.js"
}
}
},
"lint": {
Expand Down
11 changes: 11 additions & 0 deletions e2e/protractor-ci.conf.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
const config = require('./protractor.conf').config;

config.capabilities = {
browserName: 'chrome',
chromeOptions: {
args: ['--headless', '--no-sandbox', '--disable-gpu'],
binary: require('puppeteer').executablePath(),
},
};

exports.config = config;
7 changes: 5 additions & 2 deletions e2e/protractor.conf.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,10 @@ exports.config = {
'./src/**/*.e2e-spec.ts'
],
capabilities: {
'browserName': 'chrome'
'browserName': 'chrome',
chromeOptions: {
binary: require('puppeteer').executablePath(),
},
},
directConnect: true,
baseUrl: 'http://localhost:4200/',
Expand All @@ -21,7 +24,7 @@ exports.config = {
},
onPrepare() {
require('ts-node').register({
project: 'e2e/tsconfig.e2e.json'
project: require('path').join(__dirname, './tsconfig.e2e.json')
});
jasmine.getEnv().addReporter(new SpecReporter({ spec: { displayStacktrace: true } }));
}
Expand Down
95 changes: 64 additions & 31 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 5 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,10 @@
"ng": "ng",
"start": "ng serve",
"build": "ng build",
"test": "ng test --watch=false",
"lint": "ng lint"
"test": "ng test",
"lint": "ng lint",
"e2e": "ng e2e",
"postinstall": "webdriver-manager update --standalone false --gecko false"
},
"repository": {
"type": "git",
Expand Down Expand Up @@ -68,7 +70,7 @@
"karma-coverage-istanbul-reporter": "2.1.0",
"karma-jasmine": "2.0.1",
"karma-jasmine-html-reporter": "1.4.2",
"protractor": "5.4.2",
"protractor": "^5.4.2",
"puppeteer": "^1.20.0",
"ts-node": "8.4.1",
"tslint": "^5.20.0",
Expand Down
8 changes: 8 additions & 0 deletions src/karma.conf.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
// Karma configuration file, see link for more information
// https://karma-runner.github.io/1.0/config/configuration-file.html

process.env.CHROME_BIN = require('puppeteer').executablePath();

module.exports = function (config) {
config.set({
basePath: '',
Expand All @@ -26,6 +28,12 @@ module.exports = function (config) {
logLevel: config.LOG_INFO,
autoWatch: true,
browsers: ['Chrome'],
customLaunchers: {
ChromeHeadlessCI: {
base: 'ChromeHeadless',
flags: ['--no-sandbox', '--disable-gpu']
}
},
singleRun: false
});
};

0 comments on commit de150ba

Please sign in to comment.