Skip to content

Commit 85c4989

Browse files
authored
Merge pull request #796 from Stuk/ghci
Add Github Actions PR workflow and test with Playwright
2 parents 3f2f0da + 40cc7f4 commit 85c4989

File tree

6 files changed

+1163
-1741
lines changed

6 files changed

+1163
-1741
lines changed

.github/workflows/pr.yaml

+42
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
name: pull-request
2+
3+
on:
4+
pull_request:
5+
branches: [ master ]
6+
7+
jobs:
8+
test:
9+
runs-on: ubuntu-latest
10+
steps:
11+
- uses: actions/checkout@v2
12+
13+
- uses: actions/setup-node@v2
14+
with:
15+
node-version: 'lts/*'
16+
cache: 'npm'
17+
18+
- name: Cache Node modules
19+
uses: actions/cache@v2
20+
env:
21+
cache-name: cache-node-modules
22+
with:
23+
# npm cache files are stored in `~/.npm` on Linux/macOS
24+
path: ~/.npm
25+
key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('**/package-lock.json') }}
26+
restore-keys: |
27+
${{ runner.os }}-build-${{ env.cache-name }}-
28+
${{ runner.os }}-build-
29+
${{ runner.os }}-
30+
31+
- name: "Install dependencies"
32+
run: |
33+
npm install
34+
sudo npx playwright install-deps
35+
36+
- name: Lint
37+
run: npm run lint
38+
- name: Test Node
39+
run: npm run test-node
40+
- name: Test browsers
41+
run: |
42+
npm run test-browser

Gruntfile.js

-59
Original file line numberDiff line numberDiff line change
@@ -2,53 +2,9 @@
22
"use strict";
33

44
module.exports = function(grunt) {
5-
// https://wiki.saucelabs.com/display/DOCS/Platform+Configurator
6-
// A lot of the browsers seem to time out with Saucelab's unit testing
7-
// framework. Here are the browsers that work and get enough coverage for our
8-
// needs.
9-
var browsers = [
10-
{browserName: "chrome"},
11-
{browserName: "firefox", platform: "Linux"},
12-
{browserName: "internet explorer"}
13-
];
14-
15-
var tags = [];
16-
if (process.env.TRAVIS_PULL_REQUEST && process.env.TRAVIS_PULL_REQUEST != "false") {
17-
tags.push("pr" + process.env.TRAVIS_PULL_REQUEST);
18-
} else if (process.env.TRAVIS_BRANCH) {
19-
tags.push(process.env.TRAVIS_BRANCH);
20-
}
21-
225
var version = require("./package.json").version;
236

247
grunt.initConfig({
25-
connect: {
26-
server: {
27-
options: {
28-
base: "",
29-
port: 8080
30-
}
31-
}
32-
},
33-
'saucelabs-qunit': {
34-
all: {
35-
options: {
36-
urls: ["http://127.0.0.1:8080/test/index.html?hidepassed"],
37-
build: process.env.TRAVIS_JOB_ID,
38-
throttled: 4,
39-
"max-duration": 1200, // seconds, IE6 is slow
40-
browsers: browsers,
41-
testname: "qunit tests",
42-
tags: tags,
43-
// Tests have statusCheckAttempts * pollInterval seconds to complete
44-
pollInterval: 2000,
45-
statusCheckAttempts: 240,
46-
"max-duration": 1200,
47-
browsers: browsers,
48-
maxRetries: 2
49-
}
50-
}
51-
},
528
jshint: {
539
// see https://github.com/gruntjs/grunt-contrib-jshint/issues/198
5410
// we can't override the options using the jshintrc path
@@ -102,25 +58,10 @@ module.exports = function(grunt) {
10258
}
10359
});
10460

105-
grunt.loadNpmTasks("grunt-contrib-connect");
106-
grunt.loadNpmTasks("grunt-saucelabs");
10761
grunt.loadNpmTasks('grunt-browserify');
10862
grunt.loadNpmTasks('grunt-contrib-jshint');
10963
grunt.loadNpmTasks('grunt-contrib-uglify');
11064

111-
// A task to cause Grunt to sit and wait, keeping the test server running
112-
grunt.registerTask("wait", function() {
113-
this.async();
114-
});
115-
116-
grunt.registerTask("test-local", ["build", "connect", "wait"]);
117-
grunt.registerTask("test-remote", ["build", "connect", "saucelabs-qunit"]);
118-
119-
if (process.env.SAUCE_USERNAME && process.env.SAUCE_ACCESS_KEY) {
120-
grunt.registerTask("test", ["jshint", "test-remote"]);
121-
} else {
122-
grunt.registerTask("test", ["jshint", "test-local"]);
123-
}
12465
grunt.registerTask("build", ["browserify", "uglify"]);
12566
grunt.registerTask("default", ["jshint", "build"]);
12667
};

0 commit comments

Comments
 (0)