Skip to content

Commit 7ff50af

Browse files
committed
build: use GitHub Actions instead of Travis CI
1 parent b23ec4f commit 7ff50af

4 files changed

Lines changed: 184 additions & 116 deletions

File tree

.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+
- Node.js 15.x
31+
- Node.js 16.x
32+
33+
include:
34+
- name: Node.js 0.8
35+
node-version: "0.8"
36+
npm-i: mocha@2.5.3 supertest@1.1.0
37+
npm-rm: nyc
38+
39+
- name: Node.js 0.10
40+
node-version: "0.10"
41+
npm-i: mocha@3.5.3 nyc@10.3.2 supertest@2.0.0
42+
43+
- name: Node.js 0.12
44+
node-version: "0.12"
45+
npm-i: mocha@3.5.3 nyc@10.3.2 supertest@2.0.0
46+
47+
- name: io.js 1.x
48+
node-version: "1.8"
49+
npm-i: mocha@3.5.3 nyc@10.3.2 supertest@2.0.0
50+
51+
- name: io.js 2.x
52+
node-version: "2.5"
53+
npm-i: mocha@3.5.3 nyc@10.3.2 supertest@2.0.0
54+
55+
- name: io.js 3.x
56+
node-version: "3.3"
57+
npm-i: mocha@3.5.3 nyc@10.3.2 supertest@2.0.0
58+
59+
- name: Node.js 4.x
60+
node-version: "4.9"
61+
npm-i: mocha@5.2.0 nyc@11.9.0 supertest@3.4.2
62+
63+
- name: Node.js 5.x
64+
node-version: "5.12"
65+
npm-i: mocha@5.2.0 nyc@11.9.0 supertest@3.4.2
66+
67+
- name: Node.js 6.x
68+
node-version: "6.17"
69+
npm-i: mocha@6.2.2 nyc@14.1.1
70+
71+
- name: Node.js 7.x
72+
node-version: "7.10"
73+
npm-i: mocha@6.2.2 nyc@14.1.1
74+
75+
- name: Node.js 8.x
76+
node-version: "8.17"
77+
npm-i: mocha@7.2.0
78+
79+
- name: Node.js 9.x
80+
node-version: "9.11"
81+
npm-i: mocha@7.2.0
82+
83+
- name: Node.js 10.x
84+
node-version: "10.24"
85+
86+
- name: Node.js 11.x
87+
node-version: "11.15"
88+
89+
- name: Node.js 12.x
90+
node-version: "12.22"
91+
92+
- name: Node.js 13.x
93+
node-version: "13.14"
94+
95+
- name: Node.js 14.x
96+
node-version: "14.17"
97+
98+
- name: Node.js 15.x
99+
node-version: "15.14"
100+
101+
- name: Node.js 16.x
102+
node-version: "16.1"
103+
104+
steps:
105+
- uses: actions/checkout@v2
106+
107+
- name: Install Node.js ${{ matrix.node-version }}
108+
shell: bash -eo pipefail -l {0}
109+
run: |
110+
nvm install --default ${{ matrix.node-version }}
111+
if [[ "${{ matrix.node-version }}" == 0.* ]]; then
112+
npm config set strict-ssl false
113+
fi
114+
dirname "$(nvm which ${{ matrix.node-version }})" >> "$GITHUB_PATH"
115+
116+
- name: Configure npm
117+
run: npm config set shrinkwrap false
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 < 6
132+
if [[ "$(cut -d. -f1 <<< "${{ matrix.node-version }}")" -lt 6 ]]; 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: Upload 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 & 112 deletions
This file was deleted.

README.md

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

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

88
## Installation
@@ -881,11 +881,11 @@ On Windows, use the corresponding command;
881881
[MIT](LICENSE)
882882

883883
[rfc-6265bis-03-4.1.2.7]: https://tools.ietf.org/html/draft-ietf-httpbis-rfc6265bis-03#section-4.1.2.7
884+
[ci-image]: https://badgen.net/github/checks/expressjs/session/master?label=ci
885+
[ci-url]: https://github.com/expressjs/session/actions?query=workflow%3Aci
884886
[coveralls-image]: https://badgen.net/coveralls/c/github/expressjs/session/master
885887
[coveralls-url]: https://coveralls.io/r/expressjs/session?branch=master
886888
[node-url]: https://nodejs.org/en/download
887889
[npm-downloads-image]: https://badgen.net/npm/dm/express-session
888890
[npm-url]: https://npmjs.org/package/express-session
889891
[npm-version-image]: https://badgen.net/npm/v/express-session
890-
[travis-image]: https://badgen.net/travis/expressjs/session/master
891-
[travis-url]: https://travis-ci.org/expressjs/session

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,8 +41,8 @@
4141
"scripts": {
4242
"lint": "eslint --plugin markdown --ext js,md . && node ./scripts/lint-readme.js",
4343
"test": "mocha --require test/support/env --check-leaks --bail --no-exit --reporter spec test/",
44+
"test-ci": "nyc --reporter=lcov --reporter=text npm test",
4445
"test-cov": "nyc npm test",
45-
"test-travis": "nyc npm test -- --no-exit",
4646
"version": "node scripts/version-history.js && git add HISTORY.md"
4747
}
4848
}

0 commit comments

Comments
 (0)