Skip to content

Commit

Permalink
🤖 TEST: Run test on GitHub action (#27)
Browse files Browse the repository at this point in the history
  • Loading branch information
fengmk2 authored Apr 29, 2022
1 parent 2b5fb44 commit 823b70c
Show file tree
Hide file tree
Showing 8 changed files with 188 additions and 208 deletions.
46 changes: 46 additions & 0 deletions .github/workflows/nodejs.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
# This workflow will do a clean install of node dependencies, build the source code and run tests across different versions of node
# For more information see: https://help.github.com/actions/language-and-framework-guides/using-nodejs-with-github-actions

name: Node.js CI

on:
push:
branches:
- main
- master
pull_request:
branches:
- main
- master
schedule:
- cron: '0 2 * * *'

jobs:
build:
runs-on: ${{ matrix.os }}

strategy:
fail-fast: false
matrix:
node-version: [12, 14, 16, 18]
os: [ubuntu-latest, macos-latest]

steps:
- name: Checkout Git Source
uses: actions/checkout@v2

- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v1
with:
node-version: ${{ matrix.node-version }}

- name: Install Dependencies
run: npm i -g npminstall && npminstall

- name: Continuous Integration
run: npm run ci

- name: Code Coverage
uses: codecov/codecov-action@v1
with:
token: ${{ secrets.CODECOV_TOKEN }}
12 changes: 0 additions & 12 deletions .travis.yml

This file was deleted.

2 changes: 1 addition & 1 deletion LICENSE.txt
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
This software is licensed under the MIT License.

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

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
Expand Down
32 changes: 7 additions & 25 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,22 +2,14 @@ address
=======

[![NPM version][npm-image]][npm-url]
[![build status][travis-image]][travis-url]
[![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)
[![Test coverage][coveralls-image]][coveralls-url]
[![Gittip][gittip-image]][gittip-url]
[![David deps][david-image]][david-url]
[![npm download][download-image]][download-url]

[npm-image]: https://img.shields.io/npm/v/address.svg?style=flat-square
[npm-url]: https://npmjs.org/package/address
[travis-image]: https://img.shields.io/travis/node-modules/address.svg?style=flat-square
[travis-url]: https://travis-ci.org/node-modules/address
[coveralls-image]: https://img.shields.io/coveralls/node-modules/address.svg?style=flat-square
[coveralls-url]: https://coveralls.io/r/node-modules/address?branch=master
[gittip-image]: https://img.shields.io/gittip/fengmk2.svg?style=flat-square
[gittip-url]: https://www.gittip.com/fengmk2/
[david-image]: https://img.shields.io/david/node-modules/address.svg?style=flat-square
[david-url]: https://david-dm.org/node-modules/address
[download-image]: https://img.shields.io/npm/dm/address.svg?style=flat-square
[download-url]: https://npmjs.org/package/address

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

```js
var address = require('address');
const address = require('address');

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

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

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

```js
address.dns(function (err, addrs) {
address.dns((err, addrs) => {
console.log(addrs);
// ['10.13.2.1', '10.13.2.6']
});
```

## benchmark

run `$ npm run benchmark`

```
18,929 op/s » #ip
17,622 op/s » #ipv6
16,347 op/s » #mac
11,906 op/s » #dns
```

## License

[MIT](LICENSE.txt)

<!-- GITCONTRIBUTOR_START -->

## Contributors
Expand All @@ -108,4 +90,4 @@ run `$ npm run benchmark`

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`.

<!-- GITCONTRIBUTOR_END -->
<!-- GITCONTRIBUTOR_END -->
29 changes: 0 additions & 29 deletions benchmark/address.benchmark.js

This file was deleted.

23 changes: 11 additions & 12 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,26 +8,18 @@
"lib"
],
"scripts": {
"test": "mocha --check-leaks -R spec -t 5000 test/*.test.js",
"test-cov": "istanbul cover node_modules/.bin/_mocha -- --check-leaks -t 5000 test/*.test.js",
"test-travis": "istanbul cover node_modules/.bin/_mocha --report lcovonly -- --check-leaks -t 5000 test/*.test.js",
"benchmark": "matcha",
"autod": "autod -w --prefix '^'",
"test": "egg-bin test",
"ci": "egg-bin cov",
"contributors": "git-contributor"
},
"dependencies": {},
"devDependencies": {
"@types/node": "^12.7.2",
"beautify-benchmark": "*",
"benchmark": "*",
"egg-bin": "^4.19.0",
"egg-ci": "^1.19.0",
"git-contributor": "^1.1.0",
"istanbul": "*",
"matcha": "*",
"mm": "*",
"mocha": "*",
"pedding": "*",
"runscript": "^1.4.0",
"should": "*",
"typescript": "^3.5.3"
},
"repository": {
Expand All @@ -43,6 +35,13 @@
"engines": {
"node": ">= 10.0.0"
},
"ci": {
"version": "12, 14, 16, 18",
"type": "github",
"os": {
"github": "linux, macos"
}
},
"author": "fengmk2 <fengmk2@gmail.com>",
"license": "MIT"
}
Loading

0 comments on commit 823b70c

Please sign in to comment.