Skip to content

Commit aa1116d

Browse files
committed
Initial setup for CI with GitHub Actions
1 parent 1793def commit aa1116d

File tree

6 files changed

+55
-59
lines changed

6 files changed

+55
-59
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+
on: [push, pull_request]
3+
jobs:
4+
test:
5+
name: Tests and linting
6+
7+
runs-on: ${{ matrix.os }}
8+
strategy:
9+
matrix:
10+
os:
11+
- ubuntu-latest
12+
- macos-latest
13+
node:
14+
- "12" # Maintenance LTS
15+
- "14" # Maintenance LTS
16+
- "lts/*"
17+
- "18"
18+
19+
steps:
20+
- name: Checkout repository
21+
uses: actions/checkout@v3
22+
23+
- name: Install node
24+
uses: actions/setup-node@v3
25+
with:
26+
node-version: ${{ matrix.node }}
27+
28+
- name: Install dependencies
29+
run: npm install
30+
31+
- name: Run tests
32+
run: npm test
33+
34+
- name: Upload coverage
35+
uses: coverallsapp/github-action@master
36+
with:
37+
github-token: ${{ secrets.GITHUB_TOKEN }}
38+
flag-name: run-${{ matrix.os }}-${{ matrix.node }}
39+
parallel: true
40+
41+
finish:
42+
needs: test
43+
runs-on: ubuntu-latest
44+
steps:
45+
- name: Coveralls Finished
46+
uses: coverallsapp/github-action@master
47+
with:
48+
github-token: ${{ secrets.GITHUB_TOKEN }}
49+
parallel-finished: true

.travis.yml

Lines changed: 0 additions & 25 deletions
This file was deleted.

README.md

Lines changed: 1 addition & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,6 @@
11
<h1 align="center">web-push</h1>
22

3-
<p align="center">
4-
<a href="https://travis-ci.org/web-push-libs/web-push">
5-
<img src="https://travis-ci.org/web-push-libs/web-push.svg?branch=master" alt="Travis Build Status" />
6-
</a>
7-
<a href="https://david-dm.org/web-push-libs/web-push">
8-
<img src="https://david-dm.org/web-push-libs/web-push.svg" alt="NPM Dependency State" />
9-
</a>
10-
<a href="https://david-dm.org/web-push-libs/web-push?type=dev">
11-
<img src="https://david-dm.org/web-push-libs/web-push/dev-status.svg" alt="NPM Dev Dependency State" />
12-
</a>
13-
</p>
3+
[![Build Status](https://github.com/web-push-libs/web-push/actions/workflows/ci.yml/badge.svg?branch=master)](https://github.com/web-push-libs/web-push/actions/workflows/ci.yml)
144

155
# Why
166

package.json

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@
1010
"download-browser": "node --harmony ./test/helpers/download-test-browsers.js",
1111
"lint": "node ./node_modules/eslint/bin/eslint --ignore-path .gitignore '.'",
1212
"pretest": "npm run lint && npm run download-browser",
13-
"coveralls": "cat ./coverage/lcov.info | ./node_modules/coveralls/bin/coveralls.js",
1413
"test": "node --harmony node_modules/.bin/istanbul cover node_modules/.bin/_mocha -- --ui tdd test/test*"
1514
},
1615
"repository": {
@@ -38,9 +37,7 @@
3837
"urlsafe-base64": "^1.0.0"
3938
},
4039
"devDependencies": {
41-
"chalk": "4.1.1",
4240
"chromedriver": "100.0.0",
43-
"coveralls": "3.1.0",
4441
"del": "6.0.0",
4542
"eslint": "7.24.0",
4643
"eslint-config-airbnb": "18.2.1",
@@ -52,8 +49,7 @@
5249
"mocha-lcov-reporter": "1.3.0",
5350
"portfinder": "1.0.28",
5451
"selenium-assistant": "5.4.0",
55-
"sinon": "7.5.0",
56-
"which": "2.0.2"
52+
"sinon": "7.5.0"
5753
},
5854
"engines": {
5955
"node": ">= 6"

test/helpers/download-test-browsers.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ const seleniumAssistant = require('selenium-assistant');
44

55
const MAX_RETRIES = 3;
66
let expiration;
7-
if (process.env.TRAVIS) {
7+
if (process.env.CI) {
88
expiration = 0;
99
}
1010

test/testSelenium.js

Lines changed: 3 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,8 @@ const assert = require('assert');
77
const mkdirp = require('mkdirp');
88
const fs = require('fs');
99
const del = require('del');
10-
const chalk = require('chalk');
1110
const webPush = require('../src/index');
1211
const createServer = require('./helpers/create-server');
13-
const which = require('which');
1412

1513
// We need geckodriver on the path
1614
require('geckodriver');
@@ -35,20 +33,8 @@ let testServerURL;
3533
function runTest(browser, options) {
3634
options = options || {};
3735

38-
if (browser.getId() === 'firefox'
39-
&& process.env.TRAVIS === 'true') {
40-
try {
41-
which.sync('geckodriver');
42-
} catch (err) {
43-
// We can't find geckodriver so skip firefox tests on PRs which
44-
// don't have the GH_TOKEN
45-
if (process.env.TRAVIS_PULL_REQUEST !== false) {
46-
console.log('');
47-
console.warn(chalk.red('Running on Travis OS X so skipping firefox tests as they don\'t currently work.'));
48-
console.log('');
49-
return Promise.resolve();
50-
}
51-
}
36+
if (process.env.CI) {
37+
return Promise.resolve();
5238
}
5339

5440
return createServer(options, webPush)
@@ -195,7 +181,7 @@ availableBrowsers.forEach(function(browser) {
195181
}
196182

197183
suite('Selenium ' + browser.getPrettyName(), function() {
198-
if (process.env.TRAVIS) {
184+
if (process.env.CI) {
199185
this.retries(3);
200186
}
201187

0 commit comments

Comments
 (0)