Add cross-platform CI (#6670)

* Linux and Windows CI with GitHub Actions
* Add karma-edge-launcher
* Add edge configuration to karma.conf.js
* Support --browsers on the command line for karma tests
* Add macOS CI builds
* Add karma-safari-private-launcher
* Document browser specification for tests
This commit is contained in:
Edward Thomson
2019-11-06 07:14:09 -05:00
committed by Evert Timberg
parent b90552b9ca
commit aff7d41140
6 changed files with 90 additions and 1 deletions

49
.github/workflows/ci.yml vendored Normal file
View File

@@ -0,0 +1,49 @@
name: CI
on: [push]
jobs:
build:
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-latest, windows-latest, macos-latest]
fail-fast: false
steps:
- uses: actions/checkout@v1
- name: Use Node.js
uses: actions/setup-node@v1
- name: Setup xvfb
run: |
Xvfb :99 -screen 0 1024x768x24 &
echo "::set-env name=DISPLAY:::99.0"
if: runner.os == 'Linux'
- name: Install gulp
run: npm install --global gulp
if: runner.os == 'macOS'
- name: Install chrome
run: |
brew update
brew cask install google-chrome
if: runner.os == 'macOS'
- name: Select browsers
run: |
if [ "${{ runner.os }}" == "macOS" ]; then
echo "::set-env name=BROWSERS::--browsers chrome"
fi
shell: bash
- name: Build and Test
run: |
npm install
gulp build
gulp test --coverage ${BROWSERS}
- name: Package
run: |
gulp docs
gulp package
gulp bower
- name: Publish Test Results
run: cat ./coverage/lcov.info | ./node_modules/.bin/coveralls
continue-on-error: true

View File

@@ -36,6 +36,7 @@ The following commands are now available from the repository root:
> gulp unittest --coverage // run tests and generate coverage reports in ./coverage
> gulp lint // perform code linting (ESLint)
> gulp test // perform code linting and run unit tests
> gulp test --browsers ... // test with specified browsers (comma-separated)
> gulp docs // build the documentation in ./dist/docs
> gulp docs --watch // starts the gitbook live reloaded server
```

View File

@@ -145,6 +145,7 @@ function unittestTask(done) {
args: {
coverage: !!argv.coverage,
inputs: (argv.inputs || 'test/specs/**/*.js').split(';'),
browsers: (argv.browsers || 'chrome,firefox').split(','),
watch: argv.watch
}
},

View File

@@ -22,7 +22,7 @@ module.exports = function(karma) {
karma.set({
frameworks: ['jasmine'],
reporters: ['progress', 'kjhtml'],
browsers: ['chrome', 'firefox'],
browsers: args.browsers,
logLevel: karma.LOG_WARN,
// Explicitly disable hardware acceleration to make image
@@ -40,6 +40,12 @@ module.exports = function(karma) {
prefs: {
'layers.acceleration.disabled': true
}
},
safari: {
base: 'SafariPrivate'
},
edge: {
base: 'Edge'
}
},

30
package-lock.json generated
View File

@@ -938,6 +938,12 @@
"buffer-equal": "^1.0.0"
}
},
"applescript": {
"version": "1.0.0",
"resolved": "https://registry.npmjs.org/applescript/-/applescript-1.0.0.tgz",
"integrity": "sha1-u4evVoytA0pOSMS9r2Bno6JwExc=",
"dev": true
},
"archy": {
"version": "1.0.0",
"resolved": "https://registry.npmjs.org/archy/-/archy-1.0.0.tgz",
@@ -2969,6 +2975,12 @@
"safer-buffer": "^2.1.0"
}
},
"edge-launcher": {
"version": "1.2.2",
"resolved": "https://registry.npmjs.org/edge-launcher/-/edge-launcher-1.2.2.tgz",
"integrity": "sha1-60Cq+9Bnpup27/+rBke81VCbN7I=",
"dev": true
},
"editions": {
"version": "1.3.4",
"resolved": "https://registry.npmjs.org/editions/-/editions-1.3.4.tgz",
@@ -6057,6 +6069,15 @@
"source-map": "^0.5.1"
}
},
"karma-edge-launcher": {
"version": "0.4.2",
"resolved": "https://registry.npmjs.org/karma-edge-launcher/-/karma-edge-launcher-0.4.2.tgz",
"integrity": "sha512-YAJZb1fmRcxNhMIWYsjLuxwODBjh2cSHgTW/jkVmdpGguJjLbs9ZgIK/tEJsMQcBLUkO+yO4LBbqYxqgGW2HIw==",
"dev": true,
"requires": {
"edge-launcher": "1.2.2"
}
},
"karma-firefox-launcher": {
"version": "1.2.0",
"resolved": "https://registry.npmjs.org/karma-firefox-launcher/-/karma-firefox-launcher-1.2.0.tgz",
@@ -6189,6 +6210,15 @@
}
}
},
"karma-safari-private-launcher": {
"version": "1.0.0",
"resolved": "https://registry.npmjs.org/karma-safari-private-launcher/-/karma-safari-private-launcher-1.0.0.tgz",
"integrity": "sha1-d/zpBIgrNBvRNBWv01KcuSJkC0M=",
"dev": true,
"requires": {
"applescript": "^1.0.0"
}
},
"kind-of": {
"version": "6.0.2",
"resolved": "https://registry.npmjs.org/kind-of/-/kind-of-6.0.2.tgz",

View File

@@ -53,10 +53,12 @@
"karma": "^4.0.0",
"karma-chrome-launcher": "^3.0.0",
"karma-coverage": "^2.0.0",
"karma-edge-launcher": "^0.4.2",
"karma-firefox-launcher": "^1.0.1",
"karma-jasmine": "^2.0.1",
"karma-jasmine-html-reporter": "^1.4.0",
"karma-rollup-preprocessor": "^7.0.0",
"karma-safari-private-launcher": "^1.0.0",
"merge-stream": "^1.0.1",
"pixelmatch": "^5.0.0",
"rollup": "^1.0.0",