Skip to content

Commit efd6bff

Browse files
ci: migra to GitHub actions (#290)
- PR-URL: #290 - This commit drops support for Travis
1 parent 3b89789 commit efd6bff

File tree

4 files changed

+228
-114
lines changed

4 files changed

+228
-114
lines changed

.github/workflows/ci.yml

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

.travis.yml

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

README.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@
22

33
[![NPM Version][npm-version-image]][npm-url]
44
[![NPM Downloads][npm-downloads-image]][npm-url]
5-
[![Build Status][travis-image]][travis-url]
6-
[![Test Coverage][coveralls-image]][coveralls-url]
5+
[![Build Status][ci-image]][ci-url]
6+
[![Coverage Status][coveralls-image]][coveralls-url]
77

88
HTTP request logger middleware for node.js
99

@@ -418,10 +418,10 @@ function assignId (req, res, next) {
418418

419419
[MIT](LICENSE)
420420

421+
[ci-image]: https://badgen.net/github/checks/expressjs/morgan/master?label=ci
422+
[ci-url]: https://github.com/expressjs/morgan/actions/workflows/ci.yml
421423
[coveralls-image]: https://badgen.net/coveralls/c/github/expressjs/morgan/master
422424
[coveralls-url]: https://coveralls.io/r/expressjs/morgan?branch=master
423425
[npm-downloads-image]: https://badgen.net/npm/dm/morgan
424426
[npm-url]: https://npmjs.org/package/morgan
425427
[npm-version-image]: https://badgen.net/npm/v/morgan
426-
[travis-image]: https://badgen.net/travis/expressjs/morgan/master
427-
[travis-url]: https://travis-ci.org/expressjs/morgan

package.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -29,8 +29,8 @@
2929
"eslint-plugin-node": "11.1.0",
3030
"eslint-plugin-promise": "4.2.1",
3131
"eslint-plugin-standard": "4.0.1",
32-
"mocha": "7.1.1",
33-
"nyc": "15.0.1",
32+
"mocha": "10.4.0",
33+
"nyc": "15.1.0",
3434
"split": "1.0.1",
3535
"supertest": "4.0.2"
3636
},
@@ -46,7 +46,7 @@
4646
"scripts": {
4747
"lint": "eslint --plugin markdown --ext js,md .",
4848
"test": "mocha --check-leaks --reporter spec --bail",
49-
"test-ci": "nyc --reporter=text npm test",
49+
"test-ci": "nyc --reporter=lcov --reporter=text npm test",
5050
"test-cov": "nyc --reporter=html --reporter=text npm test"
5151
}
5252
}

0 commit comments

Comments
 (0)