Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: Auto release on action #33

Merged
merged 3 commits into from
Dec 17, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .eslintrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"extends": "eslint-config-egg"
}
51 changes: 13 additions & 38 deletions .github/workflows/nodejs.yml
Original file line number Diff line number Diff line change
@@ -1,46 +1,21 @@
# 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
name: CI

on:
push:
branches:
- main
- master
branches: [ master ]

pull_request:
branches:
- main
- master
branches: [ master ]

schedule:
- cron: '0 2 * * *'

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

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

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

- name: Continuous Integration
run: npm run ci

- name: Code Coverage
uses: codecov/codecov-action@v1
with:
token: ${{ secrets.CODECOV_TOKEN }}
jobs:
Job:
name: Node.js
uses: artusjs/github-actions/.github/workflows/node-test.yml@v1
with:
os: 'ubuntu-latest, macos-latest'
version: '14, 16, 18'
19 changes: 19 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
name: Release

on:
# 合并后自动发布
push:
branches: [ master ]

# 手动发布
workflow_dispatch: {}

jobs:
release:
name: Node.js
uses: artusjs/github-actions/.github/workflows/node-release.yml@v1
secrets:
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
GIT_TOKEN: ${{ secrets.GIT_TOKEN }}
with:
checkTest: false
15 changes: 6 additions & 9 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,19 +8,21 @@
"lib"
],
"scripts": {
"lint": "eslint test",
"test": "egg-bin test",
"ci": "egg-bin cov",
"contributors": "git-contributor"
},
"dependencies": {},
"devDependencies": {
"@types/node": "^12.7.2",
"egg-bin": "^4.19.0",
"egg-ci": "^2.1.0",
"@types/node": "14",
"egg-bin": "^5.6.1",
"eslint": "^8.30.0",
"eslint-config-egg": "^12.1.0",
"git-contributor": "^1.1.0",
"mm": "*",
"runscript": "^1.4.0",
"typescript": "^3.5.3"
"typescript": "4"
},
"repository": {
"type": "git",
Expand All @@ -35,11 +37,6 @@
"engines": {
"node": ">= 10.0.0"
},
"ci": {
"version": "14, 16, 18",
"type": "github",
"os": "linux, macos"
},
"author": "fengmk2 <fengmk2@gmail.com>",
"license": "MIT"
}
34 changes: 17 additions & 17 deletions test/address.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ describe('test/address.test.js', () => {
mm.data(child, 'exec', fs.readFileSync(path.join(fixtures, 'darwin.txt'), 'utf8'));
address('vnic', (err, addr) => {
assert(!err);
assert.strictEqual(addr.ip, '10.211.55.2')
assert.strictEqual(addr.ip, '10.211.55.2');
assert(!addr.ipv6);
done();
});
Expand Down Expand Up @@ -180,13 +180,13 @@ describe('test/address.test.js', () => {
mm(os, 'networkInterfaces', () => {
return {
lo:
[ { address: '127.0.0.1',
family: 'IPv4',
internal: true } ],
[{ address: '127.0.0.1',
family: 'IPv4',
internal: true }],
bond0:
[ { address: '10.206.52.79',
family: 'IPv4',
internal: false } ] };
[{ address: '10.206.52.79',
family: 'IPv4',
internal: false }] };
});
assert.strictEqual(address.ip(), '10.206.52.79');
});
Expand All @@ -195,17 +195,17 @@ describe('test/address.test.js', () => {
mm(os, 'networkInterfaces', () => {
return {
lo:
[ { address: '127.0.0.1',
family: 'IPv4',
internal: true } ],
utun0:
[ { address: 'fe80::696:ad3d:eeec:1722',
family: 'IPv6',
internal: false } ],
[{ address: '127.0.0.1',
family: 'IPv4',
internal: true }],
utun0:
[{ address: 'fe80::696:ad3d:eeec:1722',
family: 'IPv6',
internal: false }],
utun1:
[ { address: '10.206.52.79',
family: 'IPv4',
internal: false } ] };
[{ address: '10.206.52.79',
family: 'IPv4',
internal: false }] };
});
assert.strictEqual(address.ip('utun'), '10.206.52.79');
assert.strictEqual(address.ipv6('utun'), 'fe80::696:ad3d:eeec:1722');
Expand Down