Skip to content

Commit 50fa9ba

Browse files
committed
build: use GitHub Actions instead of Travis CI
1 parent d0d7251 commit 50fa9ba

File tree

4 files changed

+184
-111
lines changed

4 files changed

+184
-111
lines changed

.github/workflows/ci.yml

Lines changed: 180 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,180 @@
1+
name: ci
2+
3+
on:
4+
- pull_request
5+
- push
6+
7+
jobs:
8+
test:
9+
runs-on: ubuntu-latest
10+
strategy:
11+
matrix:
12+
name:
13+
- Node.js 0.8
14+
- Node.js 0.10
15+
- Node.js 0.12
16+
- io.js 1.x
17+
- io.js 2.x
18+
- io.js 3.x
19+
- Node.js 4.x
20+
- Node.js 5.x
21+
- Node.js 6.x
22+
- Node.js 7.x
23+
- Node.js 8.x
24+
- Node.js 9.x
25+
- Node.js 10.x
26+
- Node.js 11.x
27+
- Node.js 12.x
28+
- Node.js 13.x
29+
- Node.js 14.x
30+
31+
include:
32+
- name: Node.js 0.8
33+
node-version: "0.8"
34+
35+
npm-rm: nyc
36+
37+
- name: Node.js 0.10
38+
node-version: "0.10"
39+
40+
41+
- name: Node.js 0.12
42+
node-version: "0.12"
43+
44+
45+
- name: io.js 1.x
46+
node-version: "1.8"
47+
48+
49+
- name: io.js 2.x
50+
node-version: "2.5"
51+
52+
53+
- name: io.js 3.x
54+
node-version: "3.3"
55+
56+
57+
- name: Node.js 4.x
58+
node-version: "4.9"
59+
60+
61+
- name: Node.js 5.x
62+
node-version: "5.12"
63+
64+
65+
- name: Node.js 6.x
66+
node-version: "6.17"
67+
68+
69+
- name: Node.js 7.x
70+
node-version: "7.10"
71+
72+
73+
- name: Node.js 8.x
74+
node-version: "8.17"
75+
npm-i: browserify@15 [email protected]
76+
77+
- name: Node.js 9.x
78+
node-version: "9.11"
79+
npm-i: browserify@15 [email protected]
80+
81+
- name: Node.js 10.x
82+
node-version: "10.21"
83+
npm-i: browserify@15
84+
85+
- name: Node.js 11.x
86+
node-version: "11.15"
87+
npm-i: browserify@15
88+
89+
- name: Node.js 12.x
90+
node-version: "12.18"
91+
npm-i: browserify@15
92+
93+
- name: Node.js 13.x
94+
node-version: "13.14"
95+
npm-i: browserify@15
96+
97+
- name: Node.js 14.x
98+
node-version: "14.7"
99+
npm-i: browserify@15
100+
101+
steps:
102+
- uses: actions/checkout@v2
103+
104+
- name: Install Node.js ${{ matrix.node-version }}
105+
shell: bash -eo pipefail -l {0}
106+
run: |
107+
nvm install --default ${{ matrix.node-version }}
108+
if [[ "${{ matrix.node-version }}" == 0.* ]]; then
109+
npm config set strict-ssl false
110+
fi
111+
dirname "$(nvm which ${{ matrix.node-version }})" >> "$GITHUB_PATH"
112+
113+
- name: Configure npm
114+
run: npm config set shrinkwrap false
115+
116+
- name: Remove non-test npm modules
117+
run: npm rm --silent --save-dev benchmark beautify-benchmark
118+
119+
- name: Remove npm module(s) ${{ matrix.npm-rm }}
120+
run: npm rm --silent --save-dev ${{ matrix.npm-rm }}
121+
if: matrix.npm-rm != ''
122+
123+
- name: Install npm module(s) ${{ matrix.npm-i }}
124+
run: npm install --save-dev ${{ matrix.npm-i }}
125+
if: matrix.npm-i != ''
126+
127+
- name: Setup Node.js version-specific dependencies
128+
shell: bash
129+
run: |
130+
# eslint for linting
131+
# - remove on Node.js < 8
132+
if [[ "$(cut -d. -f1 <<< "${{ matrix.node-version }}")" -lt 8 ]]; then
133+
node -pe 'Object.keys(require("./package").devDependencies).join("\n")' | \
134+
grep -E '^eslint(-|$)' | \
135+
sort -r | \
136+
xargs -n1 npm rm --silent --save-dev
137+
fi
138+
139+
- name: Install Node.js dependencies
140+
run: npm install
141+
142+
- name: List environment
143+
id: list_env
144+
shell: bash
145+
run: |
146+
echo "node@$(node -v)"
147+
echo "npm@$(npm -v)"
148+
npm -s ls ||:
149+
(npm -s ls --depth=0 ||:) | awk -F'[ @]' 'NR>1 && $2 { print "::set-output name=" $2 "::" $3 }'
150+
151+
- name: Run tests
152+
shell: bash
153+
run: |
154+
if npm -ps ls nyc | grep -q nyc; then
155+
npm run test-ci
156+
else
157+
npm test
158+
fi
159+
160+
- name: Lint code
161+
if: steps.list_env.outputs.eslint != ''
162+
run: npm run lint
163+
164+
- name: Collect code coverage
165+
uses: coverallsapp/github-action@master
166+
if: steps.list_env.outputs.nyc != ''
167+
with:
168+
github-token: ${{ secrets.GITHUB_TOKEN }}
169+
flag-name: run-${{ matrix.test_number }}
170+
parallel: true
171+
172+
coverage:
173+
needs: test
174+
runs-on: ubuntu-latest
175+
steps:
176+
- name: Uploade code coverage
177+
uses: coverallsapp/github-action@master
178+
with:
179+
github-token: ${{ secrets.github_token }}
180+
parallel-finished: true

.travis.yml

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

Readme.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
[![NPM Version][npm-version-image]][npm-url]
44
[![NPM Downloads][npm-downloads-image]][npm-url]
55
[![Node.js Version][node-image]][node-url]
6-
[![Linux Build][travis-image]][travis-url]
6+
[![Linux Build][github-actions-ci-image]][github-actions-ci-url]
77
[![Windows Build][appveyor-image]][appveyor-url]
88
[![Coverage Status][coveralls-image]][coveralls-url]
99

@@ -271,10 +271,10 @@ deprecate.property(exports, 'oldprop', 'oldprop >= 0.10')
271271
[appveyor-url]: https://ci.appveyor.com/project/dougwilson/nodejs-depd
272272
[coveralls-image]: https://badgen.net/coveralls/c/github/dougwilson/nodejs-depd/master
273273
[coveralls-url]: https://coveralls.io/r/dougwilson/nodejs-depd?branch=master
274+
[github-actions-ci-image]: https://badgen.net/github/checks/dougwilson/nodejs-depd/master?label=linux
275+
[github-actions-ci-url]: https://github.com/jshttp/dougwilson/nodejs-depd?query=workflow%3Aci
274276
[node-image]: https://badgen.net/npm/node/depd
275277
[node-url]: https://nodejs.org/en/download/
276278
[npm-downloads-image]: https://badgen.net/npm/dm/depd
277279
[npm-url]: https://npmjs.org/package/depd
278280
[npm-version-image]: https://badgen.net/npm/v/depd
279-
[travis-image]: https://badgen.net/travis/dougwilson/nodejs-depd/master?label=linux
280-
[travis-url]: https://travis-ci.org/dougwilson/nodejs-depd

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@
3838
"bench": "node benchmark/index.js",
3939
"lint": "eslint --plugin markdown --ext js,md .",
4040
"test": "mocha --reporter spec --bail test/",
41-
"test-ci": "nyc --reporter=text npm test",
41+
"test-ci": "nyc --reporter=lcov --reporter=text npm test",
4242
"test-cov": "nyc --reporter=html --reporter=text npm test"
4343
}
4444
}

0 commit comments

Comments
 (0)