Skip to content

Commit 823b70c

Browse files
authored
🤖 TEST: Run test on GitHub action (#27)
1 parent 2b5fb44 commit 823b70c

File tree

8 files changed

+188
-208
lines changed

8 files changed

+188
-208
lines changed
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: [12, 14, 16, 18]
26+
os: [ubuntu-latest, macos-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 & 12 deletions
This file was deleted.

‎LICENSE.txt‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
This software is licensed under the MIT License.
22

33
Copyright (C) 2013 - 2014 fengmk2 <fengmk2@gmail.com>
4-
Copyright (C) 2015 - 2016 node-modules
4+
Copyright (C) 2015 - present node-modules and other contributors.
55

66
Permission is hereby granted, free of charge, to any person obtaining a copy
77
of this software and associated documentation files (the "Software"), to deal

‎README.md‎

Lines changed: 7 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -2,22 +2,14 @@ address
22
=======
33

44
[![NPM version][npm-image]][npm-url]
5-
[![build status][travis-image]][travis-url]
5+
[![Node.js CI](https://github.com/node-modules/address/actions/workflows/nodejs.yml/badge.svg)](https://github.com/node-modules/address/actions/workflows/nodejs.yml)
66
[![Test coverage][coveralls-image]][coveralls-url]
7-
[![Gittip][gittip-image]][gittip-url]
8-
[![David deps][david-image]][david-url]
97
[![npm download][download-image]][download-url]
108

119
[npm-image]: https://img.shields.io/npm/v/address.svg?style=flat-square
1210
[npm-url]: https://npmjs.org/package/address
13-
[travis-image]: https://img.shields.io/travis/node-modules/address.svg?style=flat-square
14-
[travis-url]: https://travis-ci.org/node-modules/address
1511
[coveralls-image]: https://img.shields.io/coveralls/node-modules/address.svg?style=flat-square
1612
[coveralls-url]: https://coveralls.io/r/node-modules/address?branch=master
17-
[gittip-image]: https://img.shields.io/gittip/fengmk2.svg?style=flat-square
18-
[gittip-url]: https://www.gittip.com/fengmk2/
19-
[david-image]: https://img.shields.io/david/node-modules/address.svg?style=flat-square
20-
[david-url]: https://david-dm.org/node-modules/address
2113
[download-image]: https://img.shields.io/npm/dm/address.svg?style=flat-square
2214
[download-url]: https://npmjs.org/package/address
2315

@@ -36,7 +28,7 @@ $ npm install address
3628
Get IP is sync and get MAC is async for now.
3729

3830
```js
39-
var address = require('address');
31+
const address = require('address');
4032

4133
// default interface 'eth' on linux, 'en' on osx.
4234
address.ip(); // '192.168.0.2'
@@ -57,12 +49,12 @@ address.mac('vboxnet', function (err, addr) {
5749
### Get all addresses: IPv4, IPv6 and MAC
5850

5951
```js
60-
address(function (err, addrs) {
52+
address((err, addrs) => {
6153
console.log(addrs.ip, addrs.ipv6, addrs.mac);
6254
// '192.168.0.2', 'fe80::7aca:39ff:feb0:e67d', '78:ca:39:b0:e6:7d'
6355
});
6456

65-
address('vboxnet', function (err, addrs) {
57+
address('vboxnet', (err, addrs) => {
6658
console.log(addrs.ip, addrs.ipv6, addrs.mac);
6759
// '192.168.56.1', null, '0a:00:27:00:00:00'
6860
});
@@ -78,26 +70,16 @@ address.interface('IPv4', 'eth1');
7870
### Get DNS servers
7971

8072
```js
81-
address.dns(function (err, addrs) {
73+
address.dns((err, addrs) => {
8274
console.log(addrs);
8375
// ['10.13.2.1', '10.13.2.6']
8476
});
8577
```
8678

87-
## benchmark
88-
89-
run `$ npm run benchmark`
90-
91-
```
92-
18,929 op/s » #ip
93-
17,622 op/s » #ipv6
94-
16,347 op/s » #mac
95-
11,906 op/s » #dns
96-
```
97-
9879
## License
9980

10081
[MIT](LICENSE.txt)
82+
10183
<!-- GITCONTRIBUTOR_START -->
10284

10385
## Contributors
@@ -108,4 +90,4 @@ run `$ npm run benchmark`
10890

10991
This project follows the git-contributor [spec](https://github.com/xudafeng/git-contributor), auto updated at `Fri Apr 29 2022 20:59:23 GMT+0800`.
11092

111-
<!-- GITCONTRIBUTOR_END -->
93+
<!-- GITCONTRIBUTOR_END -->

‎benchmark/address.benchmark.js‎

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

‎package.json‎

Lines changed: 11 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -8,26 +8,18 @@
88
"lib"
99
],
1010
"scripts": {
11-
"test": "mocha --check-leaks -R spec -t 5000 test/*.test.js",
12-
"test-cov": "istanbul cover node_modules/.bin/_mocha -- --check-leaks -t 5000 test/*.test.js",
13-
"test-travis": "istanbul cover node_modules/.bin/_mocha --report lcovonly -- --check-leaks -t 5000 test/*.test.js",
14-
"benchmark": "matcha",
15-
"autod": "autod -w --prefix '^'",
11+
"test": "egg-bin test",
12+
"ci": "egg-bin cov",
1613
"contributors": "git-contributor"
1714
},
1815
"dependencies": {},
1916
"devDependencies": {
2017
"@types/node": "^12.7.2",
21-
"beautify-benchmark": "*",
22-
"benchmark": "*",
18+
"egg-bin": "^4.19.0",
19+
"egg-ci": "^1.19.0",
2320
"git-contributor": "^1.1.0",
24-
"istanbul": "*",
25-
"matcha": "*",
2621
"mm": "*",
27-
"mocha": "*",
28-
"pedding": "*",
2922
"runscript": "^1.4.0",
30-
"should": "*",
3123
"typescript": "^3.5.3"
3224
},
3325
"repository": {
@@ -43,6 +35,13 @@
4335
"engines": {
4436
"node": ">= 10.0.0"
4537
},
38+
"ci": {
39+
"version": "12, 14, 16, 18",
40+
"type": "github",
41+
"os": {
42+
"github": "linux, macos"
43+
}
44+
},
4645
"author": "fengmk2 <fengmk2@gmail.com>",
4746
"license": "MIT"
4847
}

0 commit comments

Comments
 (0)