Skip to content

Commit 8ed5c72

Browse files
committed
build: use GitHub Actions instead of Travis CI
1 parent 97965bd commit 8ed5c72

File tree

4 files changed

+197
-111
lines changed

4 files changed

+197
-111
lines changed

.github/workflows/ci.yml

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

.travis.yml

-106
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
[![Test Coverage][coveralls-image]][coveralls-url]
88

99
Determine address of proxied request
@@ -128,12 +128,12 @@ $ npm run-script bench
128128

129129
[MIT](LICENSE)
130130

131+
[ci-image]: https://badgen.net/github/checks/jshttp/proxy-addr/master?label=ci
132+
[ci-url]: https://github.com/jshttp/proxy-addr/actions?query=workflow%3Aci
131133
[coveralls-image]: https://badgen.net/coveralls/c/github/jshttp/proxy-addr/master
132134
[coveralls-url]: https://coveralls.io/r/jshttp/proxy-addr?branch=master
133135
[node-image]: https://badgen.net/npm/node/proxy-addr
134136
[node-url]: https://nodejs.org/en/download
135137
[npm-downloads-image]: https://badgen.net/npm/dm/proxy-addr
136138
[npm-url]: https://npmjs.org/package/proxy-addr
137139
[npm-version-image]: https://badgen.net/npm/v/proxy-addr
138-
[travis-image]: https://badgen.net/travis/jshttp/proxy-addr/master
139-
[travis-url]: https://travis-ci.org/jshttp/proxy-addr

package.json

+2-2
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@
4141
"bench": "node benchmark/index.js",
4242
"lint": "eslint .",
4343
"test": "mocha --reporter spec --bail --check-leaks test/",
44-
"test-cov": "nyc --reporter=text npm test",
45-
"test-travis": "nyc --reporter=html --reporter=text npm test"
44+
"test-ci": "nyc --reporter=lcov --reporter=text npm test",
45+
"test-cov": "nyc --reporter=html --reporter=text npm test"
4646
}
4747
}

0 commit comments

Comments
 (0)