From 5420a47830ccd82e1648570a4b9709067f4e748b Mon Sep 17 00:00:00 2001 From: fengmk2 Date: Mon, 19 Dec 2022 14:23:20 +0800 Subject: [PATCH] chore: auto release (#104) --- .autod.conf.js | 17 ------------ .github/workflows/nodejs.yml | 52 ++++++++--------------------------- .github/workflows/release.yml | 17 ++++++++++++ README.md | 6 ---- package.json | 18 ++++-------- test/agent_worker.test.js | 2 +- test/app_worker.test.js | 2 +- test/https.test.js | 4 +-- test/master.test.js | 2 +- test/worker_threads.test.js | 2 +- 10 files changed, 40 insertions(+), 82 deletions(-) delete mode 100644 .autod.conf.js create mode 100644 .github/workflows/release.yml diff --git a/.autod.conf.js b/.autod.conf.js deleted file mode 100644 index c6d99ea..0000000 --- a/.autod.conf.js +++ /dev/null @@ -1,17 +0,0 @@ -'use strict'; - -module.exports = { - write: true, - prefix: '^', - devprefix: '^', - exclude: [ - 'test/fixtures', - ], - devdep: [ - 'autod', - 'egg', - 'egg-bin', - 'eslint', - 'eslint-config-egg', - ] -}; diff --git a/.github/workflows/nodejs.yml b/.github/workflows/nodejs.yml index 4df7840..aebe8bb 100644 --- a/.github/workflows/nodejs.yml +++ b/.github/workflows/nodejs.yml @@ -1,46 +1,18 @@ -# 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 - pull_request: - branches: - - main - - master - schedule: - - cron: '0 2 * * *' - -jobs: - build: - runs-on: ${{ matrix.os }} - - strategy: - fail-fast: false - matrix: - node-version: [14, 16] - os: [ubuntu-latest, macos-latest] + branches: [ master ] - steps: - - name: Checkout Git Source - uses: actions/checkout@v2 - - - name: Use Node.js ${{ matrix.node-version }} - uses: actions/setup-node@v3 - with: - node-version: ${{ matrix.node-version }} - - - name: Install Dependencies - run: npm i + pull_request: + branches: [ master ] - - name: Continuous Integration - run: npm run ci + workflow_dispatch: {} - - name: Code Coverage - uses: codecov/codecov-action@v3 - 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' diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml new file mode 100644 index 0000000..1612587 --- /dev/null +++ b/.github/workflows/release.yml @@ -0,0 +1,17 @@ +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 diff --git a/README.md b/README.md index 0d8f93c..874be13 100644 --- a/README.md +++ b/README.md @@ -1,20 +1,14 @@ # egg-cluster [![NPM version][npm-image]][npm-url] -[![build status][travis-image]][travis-url] [![Test coverage][codecov-image]][codecov-url] -[![David deps][david-image]][david-url] [![Known Vulnerabilities][snyk-image]][snyk-url] [![npm download][download-image]][download-url] [npm-image]: https://img.shields.io/npm/v/egg-cluster.svg?style=flat-square [npm-url]: https://npmjs.org/package/egg-cluster -[travis-image]: https://img.shields.io/travis/eggjs/egg-cluster.svg?style=flat-square -[travis-url]: https://travis-ci.org/eggjs/egg-cluster [codecov-image]: https://codecov.io/github/eggjs/egg-cluster/coverage.svg?branch=master [codecov-url]: https://codecov.io/github/eggjs/egg-cluster?branch=master -[david-image]: https://img.shields.io/david/eggjs/egg-cluster.svg?style=flat-square -[david-url]: https://david-dm.org/eggjs/egg-cluster [snyk-image]: https://snyk.io/test/npm/egg-cluster/badge.svg?style=flat-square [snyk-url]: https://snyk.io/test/npm/egg-cluster [download-image]: https://img.shields.io/npm/dm/egg-cluster.svg?style=flat-square diff --git a/package.json b/package.json index 02adb9b..7d77ae6 100644 --- a/package.json +++ b/package.json @@ -4,13 +4,11 @@ "description": "cluster manager for egg", "main": "index.js", "scripts": { - "autod": "autod", "lint": "eslint .", "test": "npm run lint -- --fix && npm run test-local", "test-local": "egg-bin test", "cov": "egg-bin cov --prerequire --timeout 100000", - "ci": "npm run lint && egg-bin pkgfiles --check && npm run cov", - "pkgfiles": "egg-bin pkgfiles" + "ci": "npm run lint && npm run cov" }, "files": [ "index.js", @@ -51,13 +49,11 @@ }, "devDependencies": { "address": "^1.0.3", - "autod": "^3.0.1", "coffee": "^5.2.1", - "egg": "^2.20.0", - "egg-bin": "^4.11.1", - "egg-ci": "^2.2.0", + "egg": "^3.9.0", + "egg-bin": "^5.6.1", "egg-errors": "^2.2.0", - "egg-mock": "^3.22.1", + "egg-mock": "^5.4.0", "eslint": "^8.26.0", "eslint-config-egg": "^12.1.0", "mz": "^2.7.0", @@ -67,10 +63,6 @@ "typescript": "^2.7.2" }, "engines": { - "node": ">= 8.0.0" - }, - "ci": { - "type": "github", - "version": "14, 16, 18" + "node": ">= 14.0.0" } } diff --git a/test/agent_worker.test.js b/test/agent_worker.test.js index 3de2972..9cb7c7f 100644 --- a/test/agent_worker.test.js +++ b/test/agent_worker.test.js @@ -12,7 +12,7 @@ describe('test/agent_worker.test.js', () => { let app; describe('Fork Agent', () => { - afterEach(() => app.close()); + afterEach(() => app && app.close()); it('support config agent debug port', () => { mm(process.env, 'EGG_AGENT_DEBUG_PORT', '15800'); diff --git a/test/app_worker.test.js b/test/app_worker.test.js index 7f845e6..7a48b39 100644 --- a/test/app_worker.test.js +++ b/test/app_worker.test.js @@ -11,7 +11,7 @@ const utils = require('./utils'); describe('test/app_worker.test.js', () => { let app; - afterEach(() => app.close()); + afterEach(() => app && app.close()); describe('app worker', () => { before(() => { diff --git a/test/https.test.js b/test/https.test.js index 0167e3c..1b9500c 100644 --- a/test/https.test.js +++ b/test/https.test.js @@ -12,7 +12,7 @@ describe('test/https.test.js', () => { afterEach(mm.restore); describe('start https server with cluster options', () => { - afterEach(() => app.close()); + afterEach(() => app && app.close()); it('should success with status 200', function* () { @@ -41,7 +41,7 @@ describe('test/https.test.js', () => { }); describe('start https server with app config cluster', () => { - afterEach(() => app.close()); + afterEach(() => app && app.close()); it('should success with status 200', function* () { const baseDir = path.join(__dirname, 'fixtures/apps/https-server-config'); diff --git a/test/master.test.js b/test/master.test.js index 7bb5af4..3ada999 100644 --- a/test/master.test.js +++ b/test/master.test.js @@ -18,7 +18,7 @@ describe('test/master.test.js', () => { afterEach(mm.restore); describe('start master', () => { - afterEach(() => app.close()); + afterEach(() => app && app.close()); it('start success in local env', done => { mm.env('local'); diff --git a/test/worker_threads.test.js b/test/worker_threads.test.js index fdf9d66..cba6c49 100644 --- a/test/worker_threads.test.js +++ b/test/worker_threads.test.js @@ -6,7 +6,7 @@ describe('worker_threads', () => { let app; describe('Fork Agent', () => { - afterEach(() => app.close()); + afterEach(() => app && app.close()); it('support config agent debug port', async () => { app = utils.cluster('apps/agent-worker-threads', { startMode: 'worker_threads' });