Skip to content

Commit 126b4ec

Browse files
authored
Switch to GitHub Actions (#47)
* remove travis * add codecov partial line coverage * switch coverage to c8 * add GitHub Actions * update badge * import TextDecoder from util * lint
1 parent 38639ec commit 126b4ec

File tree

8 files changed

+91
-20
lines changed

8 files changed

+91
-20
lines changed

.codecov.yml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
coverage:
2+
round: up
3+
precision: 2
4+
parsers:
5+
javascript:
6+
enable_partials: yes

.github/workflows/ci.yml

Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
name: CI
2+
3+
on:
4+
push:
5+
branches: [master]
6+
pull_request:
7+
paths:
8+
- "**.js"
9+
- "package.json"
10+
- ".github/workflows/ci.yml"
11+
12+
jobs:
13+
test:
14+
strategy:
15+
matrix:
16+
os: [ubuntu-latest, windows-latest, macOS-latest]
17+
node: ["14", "12", engines]
18+
exclude:
19+
# On Windows, run tests with only the LTS environments.
20+
- os: windows-latest
21+
node: engines
22+
- os: windows-latest
23+
node: "14"
24+
# On macOS, run tests with only the LTS environments.
25+
- os: macOS-latest
26+
node: engines
27+
- os: macOS-latest
28+
node: "14"
29+
30+
runs-on: ${{ matrix.os }}
31+
steps:
32+
- uses: actions/checkout@v2
33+
34+
- name: Get Node.JS version from package.json
35+
if: matrix.node == 'engines'
36+
id: get-version
37+
run: echo ::set-output name=node::$(npx --q minimum-node-version)
38+
39+
- uses: actions/setup-node@v2-beta
40+
if: matrix.node != 'engines'
41+
with:
42+
node-version: ${{ matrix.node }}
43+
44+
- uses: actions/setup-node@v2-beta
45+
if: matrix.node == 'engines'
46+
with:
47+
node-version: ${{steps.get-version.outputs.node}}
48+
49+
- run: npm install
50+
51+
- run: npm run report -- --colors
52+
53+
- name: Upload coverage to Codecov
54+
uses: codecov/codecov-action@v1
55+
with:
56+
file: ./coverage/coverage-final.json

.github/workflows/lint.yml

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
name: CI
2+
3+
on:
4+
pull_request:
5+
paths:
6+
- "**.js"
7+
- "**eslint**"
8+
- "package.json"
9+
- ".github/workflows/lint.yml"
10+
jobs:
11+
lint:
12+
runs-on: ubuntu-latest
13+
steps:
14+
- uses: actions/checkout@v2
15+
- name: Use Node.js
16+
uses: actions/setup-node@v2-beta
17+
with:
18+
node-version: 14
19+
- run: npm install
20+
- run: npm run lint

.npmrc

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1,2 @@
1-
package-lock=false
1+
package-lock=false
2+
save-exact=false

.travis.yml

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

README.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
# fetch-blob
22

33
[![npm version][npm-image]][npm-url]
4-
[![build status][travis-image]][travis-url]
4+
[![build status][ci-image]][ci-url]
55
[![coverage status][codecov-image]][codecov-url]
66
[![install size][install-size-image]][install-size-url]
77

@@ -31,8 +31,8 @@ See the [MDN documentation](https://developer.mozilla.org/en-US/docs/Web/API/Blo
3131

3232
[npm-image]: https://flat.badgen.net/npm/v/fetch-blob
3333
[npm-url]: https://www.npmjs.com/package/fetch-blob
34-
[travis-image]: https://flat.badgen.net/travis/node-fetch/fetch-blob
35-
[travis-url]: https://travis-ci.org/node-fetch/fetch-blob
34+
[ci-image]: https://github.com/node-fetch/fetch-blob/workflows/CI/badge.svg
35+
[ci-url]: https://github.com/node-fetch/fetch-blob/actions
3636
[codecov-image]: https://flat.badgen.net/codecov/c/github/node-fetch/fetch-blob/master
3737
[codecov-url]: https://codecov.io/gh/node-fetch/fetch-blob
3838
[install-size-image]: https://flat.badgen.net/packagephobia/install/fetch-blob

package.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,8 @@
1010
"scripts": {
1111
"lint": "xo",
1212
"test": "xo && ava",
13-
"report": "nyc ava",
14-
"coverage": "nyc --reporter json --reporter text ava && codecov -f coverage/coverage-final.json",
13+
"report": "c8 --reporter json --reporter text ava",
14+
"coverage": "c8 --reporter json --reporter text ava && codecov -f coverage/coverage-final.json",
1515
"prepublishOnly": "tsc --declaration --emitDeclarationOnly --allowJs index.js"
1616
},
1717
"repository": "https://github.com/node-fetch/fetch-blob.git",
@@ -30,10 +30,10 @@
3030
"homepage": "https://github.com/node-fetch/fetch-blob#readme",
3131
"devDependencies": {
3232
"ava": "^3.8.2",
33+
"c8": "^7.2.0",
3334
"codecov": "^3.7.0",
3435
"get-stream": "^5.1.0",
3536
"node-fetch": "^2.6.0",
36-
"nyc": "^15.1.0",
3737
"typescript": "^3.9.5",
3838
"xo": "^0.32.0"
3939
},

test.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ const test = require('ava');
22
const Blob = require('.');
33
const getStream = require('get-stream');
44
const {Response} = require('node-fetch');
5+
const {TextDecoder} = require('util');
56

67
test('new Blob()', t => {
78
const blob = new Blob(); // eslint-disable-line no-unused-vars

0 commit comments

Comments
 (0)