Skip to content

Commit bcadb55

Browse files
committed
test: run test on github action
1 parent 134ec9b commit bcadb55

File tree

4 files changed

+58
-14
lines changed

4 files changed

+58
-14
lines changed

.github/workflows/nodejs.yml

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
# This workflow will do a clean install of node dependencies, build the source code and run tests across different versions of node
2+
# For more information see: https://help.github.com/actions/language-and-framework-guides/using-nodejs-with-github-actions
3+
4+
name: Node.js CI
5+
6+
on:
7+
push:
8+
branches:
9+
- main
10+
- master
11+
pull_request:
12+
branches:
13+
- main
14+
- master
15+
schedule:
16+
- cron: '0 2 * * *'
17+
18+
jobs:
19+
build:
20+
runs-on: ${{ matrix.os }}
21+
22+
strategy:
23+
fail-fast: false
24+
matrix:
25+
node-version: [8, 10, 12, 14, 16]
26+
os: [ubuntu-latest]
27+
28+
steps:
29+
- name: Checkout Git Source
30+
uses: actions/checkout@v2
31+
32+
- name: Use Node.js ${{ matrix.node-version }}
33+
uses: actions/setup-node@v1
34+
with:
35+
node-version: ${{ matrix.node-version }}
36+
37+
- name: Install Dependencies
38+
run: npm i -g npminstall && npminstall
39+
40+
- name: Continuous Integration
41+
run: npm run ci
42+
43+
- name: Code Coverage
44+
uses: codecov/codecov-action@v1
45+
with:
46+
token: ${{ secrets.CODECOV_TOKEN }}

.travis.yml

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

index.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ const vary = require('vary');
1616
* - {Boolean} secureContext `Cross-Origin-Opener-Policy` & `Cross-Origin-Embedder-Policy` headers.', default is false
1717
* @see https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/SharedArrayBuffer/Planned_changes
1818
* @return {Function} cors middleware
19-
* @api public
19+
* @public
2020
*/
2121
module.exports = function(options) {
2222
const defaults = {
@@ -46,7 +46,7 @@ module.exports = function(options) {
4646
}
4747

4848
options.keepHeadersOnError = options.keepHeadersOnError === undefined || !!options.keepHeadersOnError;
49-
49+
5050
return async function cors(ctx, next) {
5151
// If the Origin header is not present terminate this set of steps.
5252
// The request is outside the scope of this specification.

package.json

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,14 +10,13 @@
1010
"test": "NODE_ENV=test mocha --check-leaks -R spec -t 5000 test/*.test.js",
1111
"test-cov": "NODE_ENV=test istanbul cover _mocha -- --check-leaks -t 5000 test/*.test.js",
1212
"ci": "npm run lint && npm run test-cov",
13-
"lint": "eslint index.js test",
14-
"autod": "autod -w --prefix '^'"
13+
"lint": "eslint index.js test"
1514
},
1615
"dependencies": {
1716
"vary": "^1.1.2"
1817
},
1918
"devDependencies": {
20-
"autod": "*",
19+
"egg-ci": "^1.19.0",
2120
"eslint": "^5.15.1",
2221
"eslint-config-egg": "^7.1.0",
2322
"istanbul": "*",
@@ -44,6 +43,13 @@
4443
"engines": {
4544
"node": ">= 8.0.0"
4645
},
47-
"author": "fengmk2 <[email protected]> (http://fengmk2.com)",
46+
"ci": {
47+
"version": "8, 10, 12, 14, 16",
48+
"type": "github",
49+
"os": {
50+
"github": "linux"
51+
}
52+
},
53+
"author": "fengmk2 <[email protected]> (http://github.com/fengmk2)",
4854
"license": "MIT"
4955
}

0 commit comments

Comments
 (0)