Skip to content

Commit 671c853

Browse files
committed
build: use GitHub Actions instead of Travis CI
1 parent 0f144b3 commit 671c853

File tree

4 files changed

+198
-116
lines changed

4 files changed

+198
-116
lines changed

.github/workflows/ci.yml

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

.travis.yml

-112
This file was deleted.

README.md

+3-3
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-
[![Build Status][travis-image]][travis-url]
6+
[![Build Status][ci-image]][ci-url]
77
[![Coverage Status][coveralls-image]][coveralls-url]
88

99
This is a database of all mime types.
@@ -91,12 +91,12 @@ definitively lists the media type. If an extension is going to be listed as
9191
associateed with this media type, the source must definitively link the
9292
media type and extension as well.
9393

94+
[ci-image]: https://badgen.net/github/checks/jshttp/mime-db?label=ci
95+
[ci-url]: https://github.com/jshttp/mime-db/actions?query=workflow%3Aci
9496
[coveralls-image]: https://badgen.net/coveralls/c/github/jshttp/mime-db/master
9597
[coveralls-url]: https://coveralls.io/r/jshttp/mime-db?branch=master
9698
[node-image]: https://badgen.net/npm/node/mime-db
9799
[node-url]: https://nodejs.org/en/download
98100
[npm-downloads-image]: https://badgen.net/npm/dm/mime-db
99101
[npm-url]: https://npmjs.org/package/mime-db
100102
[npm-version-image]: https://badgen.net/npm/v/mime-db
101-
[travis-image]: https://badgen.net/travis/jshttp/mime-db/master
102-
[travis-url]: https://travis-ci.org/jshttp/mime-db

package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -51,8 +51,8 @@
5151
"fetch": "node scripts/fetch-apache && gnode scripts/fetch-iana && node scripts/fetch-nginx",
5252
"lint": "eslint --plugin markdown --ext js,md .",
5353
"test": "mocha --reporter spec --bail --check-leaks test/",
54+
"test-ci": "nyc --reporter=lcov --reporter=text npm test",
5455
"test-cov": "nyc --reporter=html --reporter=text npm test",
55-
"test-travis": "nyc --reporter=text npm test",
5656
"update": "npm run fetch && npm run build",
5757
"version": "node scripts/version-history.js && git add HISTORY.md"
5858
}

0 commit comments

Comments
 (0)