Skip to content

Commit aff7d41

Browse files
Edward Thomsonetimberg
authored andcommitted
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
1 parent b90552b commit aff7d41

File tree

6 files changed

+90
-1
lines changed

6 files changed

+90
-1
lines changed

.github/workflows/ci.yml

Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
name: CI
2+
3+
on: [push]
4+
5+
jobs:
6+
build:
7+
runs-on: ${{ matrix.os }}
8+
9+
strategy:
10+
matrix:
11+
os: [ubuntu-latest, windows-latest, macos-latest]
12+
fail-fast: false
13+
14+
steps:
15+
- uses: actions/checkout@v1
16+
- name: Use Node.js
17+
uses: actions/setup-node@v1
18+
- name: Setup xvfb
19+
run: |
20+
Xvfb :99 -screen 0 1024x768x24 &
21+
echo "::set-env name=DISPLAY:::99.0"
22+
if: runner.os == 'Linux'
23+
- name: Install gulp
24+
run: npm install --global gulp
25+
if: runner.os == 'macOS'
26+
- name: Install chrome
27+
run: |
28+
brew update
29+
brew cask install google-chrome
30+
if: runner.os == 'macOS'
31+
- name: Select browsers
32+
run: |
33+
if [ "${{ runner.os }}" == "macOS" ]; then
34+
echo "::set-env name=BROWSERS::--browsers chrome"
35+
fi
36+
shell: bash
37+
- name: Build and Test
38+
run: |
39+
npm install
40+
gulp build
41+
gulp test --coverage ${BROWSERS}
42+
- name: Package
43+
run: |
44+
gulp docs
45+
gulp package
46+
gulp bower
47+
- name: Publish Test Results
48+
run: cat ./coverage/lcov.info | ./node_modules/.bin/coveralls
49+
continue-on-error: true

docs/developers/contributing.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@ The following commands are now available from the repository root:
3636
> gulp unittest --coverage // run tests and generate coverage reports in ./coverage
3737
> gulp lint // perform code linting (ESLint)
3838
> gulp test // perform code linting and run unit tests
39+
> gulp test --browsers ... // test with specified browsers (comma-separated)
3940
> gulp docs // build the documentation in ./dist/docs
4041
> gulp docs --watch // starts the gitbook live reloaded server
4142
```

gulpfile.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -145,6 +145,7 @@ function unittestTask(done) {
145145
args: {
146146
coverage: !!argv.coverage,
147147
inputs: (argv.inputs || 'test/specs/**/*.js').split(';'),
148+
browsers: (argv.browsers || 'chrome,firefox').split(','),
148149
watch: argv.watch
149150
}
150151
},

karma.conf.js

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ module.exports = function(karma) {
2222
karma.set({
2323
frameworks: ['jasmine'],
2424
reporters: ['progress', 'kjhtml'],
25-
browsers: ['chrome', 'firefox'],
25+
browsers: args.browsers,
2626
logLevel: karma.LOG_WARN,
2727

2828
// Explicitly disable hardware acceleration to make image
@@ -40,6 +40,12 @@ module.exports = function(karma) {
4040
prefs: {
4141
'layers.acceleration.disabled': true
4242
}
43+
},
44+
safari: {
45+
base: 'SafariPrivate'
46+
},
47+
edge: {
48+
base: 'Edge'
4349
}
4450
},
4551

package-lock.json

Lines changed: 30 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,10 +53,12 @@
5353
"karma": "^4.0.0",
5454
"karma-chrome-launcher": "^3.0.0",
5555
"karma-coverage": "^2.0.0",
56+
"karma-edge-launcher": "^0.4.2",
5657
"karma-firefox-launcher": "^1.0.1",
5758
"karma-jasmine": "^2.0.1",
5859
"karma-jasmine-html-reporter": "^1.4.0",
5960
"karma-rollup-preprocessor": "^7.0.0",
61+
"karma-safari-private-launcher": "^1.0.0",
6062
"merge-stream": "^1.0.1",
6163
"pixelmatch": "^5.0.0",
6264
"rollup": "^1.0.0",

0 commit comments

Comments
 (0)