diff --git a/.github/workflows/nodejs.yml b/.github/workflows/linux-10.yml similarity index 84% rename from .github/workflows/nodejs.yml rename to .github/workflows/linux-10.yml index b8dd570a..fba143ae 100644 --- a/.github/workflows/nodejs.yml +++ b/.github/workflows/linux-10.yml @@ -1,4 +1,4 @@ -name: CI +name: CI-Linux-10 on: push: @@ -16,8 +16,8 @@ jobs: strategy: fail-fast: false matrix: - node-version: [10, 12, 14] - os: [ubuntu-latest, windows-latest, macos-latest] + node-version: [10] + os: [ubuntu-latest] steps: - name: Checkout Git Source @@ -29,7 +29,7 @@ jobs: node-version: ${{ matrix.node-version }} - name: Install Dependencies - run: npm install + run: npm i npminstall -g && npminstall - name: Continuous Integration run: npm run ci diff --git a/.github/workflows/linux-12.yml b/.github/workflows/linux-12.yml new file mode 100644 index 00000000..634ceaff --- /dev/null +++ b/.github/workflows/linux-12.yml @@ -0,0 +1,40 @@ +name: CI-Linux-12 + +on: + push: + branches: [ master ] + pull_request: + branches: [ master ] + schedule: + - cron: '0 2 * * *' + workflow_dispatch: {} + +jobs: + build: + runs-on: ${{ matrix.os }} + + strategy: + fail-fast: false + matrix: + node-version: [12] + os: [ubuntu-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 npminstall -g && npminstall + + - name: Continuous Integration + run: npm run ci + + - name: Code Coverage + uses: codecov/codecov-action@v1 + with: + token: ${{ secrets.CODECOV_TOKEN }} diff --git a/.github/workflows/linux-14.yml b/.github/workflows/linux-14.yml new file mode 100644 index 00000000..d73e0640 --- /dev/null +++ b/.github/workflows/linux-14.yml @@ -0,0 +1,40 @@ +name: CI-Linux-14 + +on: + push: + branches: [ master ] + pull_request: + branches: [ master ] + schedule: + - cron: '0 2 * * *' + workflow_dispatch: {} + +jobs: + build: + runs-on: ${{ matrix.os }} + + strategy: + fail-fast: false + matrix: + node-version: [14] + os: [ubuntu-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 npminstall -g && npminstall + + - name: Continuous Integration + run: npm run ci + + - name: Code Coverage + uses: codecov/codecov-action@v1 + with: + token: ${{ secrets.CODECOV_TOKEN }} diff --git a/.github/workflows/osx-10.yml b/.github/workflows/osx-10.yml new file mode 100644 index 00000000..850fd3f1 --- /dev/null +++ b/.github/workflows/osx-10.yml @@ -0,0 +1,40 @@ +name: CI-OSX-10 + +on: + push: + branches: [ master ] + pull_request: + branches: [ master ] + schedule: + - cron: '0 2 * * *' + workflow_dispatch: {} + +jobs: + build: + runs-on: ${{ matrix.os }} + + strategy: + fail-fast: false + matrix: + node-version: [10] + os: [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 npminstall -g && npminstall + + - name: Continuous Integration + run: npm run ci + + - name: Code Coverage + uses: codecov/codecov-action@v1 + with: + token: ${{ secrets.CODECOV_TOKEN }} diff --git a/.github/workflows/osx-12.yml b/.github/workflows/osx-12.yml new file mode 100644 index 00000000..382e9c76 --- /dev/null +++ b/.github/workflows/osx-12.yml @@ -0,0 +1,40 @@ +name: CI-OSX-12 + +on: + push: + branches: [ master ] + pull_request: + branches: [ master ] + schedule: + - cron: '0 2 * * *' + workflow_dispatch: {} + +jobs: + build: + runs-on: ${{ matrix.os }} + + strategy: + fail-fast: false + matrix: + node-version: [12] + os: [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 npminstall -g && npminstall + + - name: Continuous Integration + run: npm run ci + + - name: Code Coverage + uses: codecov/codecov-action@v1 + with: + token: ${{ secrets.CODECOV_TOKEN }} diff --git a/.github/workflows/osx-14.yml b/.github/workflows/osx-14.yml new file mode 100644 index 00000000..ebcb9dc6 --- /dev/null +++ b/.github/workflows/osx-14.yml @@ -0,0 +1,40 @@ +name: CI-OSX-14 + +on: + push: + branches: [ master ] + pull_request: + branches: [ master ] + schedule: + - cron: '0 2 * * *' + workflow_dispatch: {} + +jobs: + build: + runs-on: ${{ matrix.os }} + + strategy: + fail-fast: false + matrix: + node-version: [14] + os: [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 npminstall -g && npminstall + + - name: Continuous Integration + run: npm run ci + + - name: Code Coverage + uses: codecov/codecov-action@v1 + with: + token: ${{ secrets.CODECOV_TOKEN }} diff --git a/.github/workflows/windows-10.yml b/.github/workflows/windows-10.yml new file mode 100644 index 00000000..eea012dd --- /dev/null +++ b/.github/workflows/windows-10.yml @@ -0,0 +1,40 @@ +name: CI-Windows-10 + +on: + push: + branches: [ master ] + pull_request: + branches: [ master ] + schedule: + - cron: '0 2 * * *' + workflow_dispatch: {} + +jobs: + build: + runs-on: ${{ matrix.os }} + + strategy: + fail-fast: false + matrix: + node-version: [10] + os: [windows-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 npminstall -g && npminstall + + - name: Continuous Integration + run: npm run ci + + - name: Code Coverage + uses: codecov/codecov-action@v1 + with: + token: ${{ secrets.CODECOV_TOKEN }} diff --git a/.github/workflows/windows-12.yml b/.github/workflows/windows-12.yml new file mode 100644 index 00000000..aa49827f --- /dev/null +++ b/.github/workflows/windows-12.yml @@ -0,0 +1,40 @@ +name: CI-Windows-12 + +on: + push: + branches: [ master ] + pull_request: + branches: [ master ] + schedule: + - cron: '0 2 * * *' + workflow_dispatch: {} + +jobs: + build: + runs-on: ${{ matrix.os }} + + strategy: + fail-fast: false + matrix: + node-version: [12] + os: [windows-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 npminstall -g && npminstall + + - name: Continuous Integration + run: npm run ci + + - name: Code Coverage + uses: codecov/codecov-action@v1 + with: + token: ${{ secrets.CODECOV_TOKEN }} diff --git a/.github/workflows/windows-14.yml b/.github/workflows/windows-14.yml new file mode 100644 index 00000000..71539b4f --- /dev/null +++ b/.github/workflows/windows-14.yml @@ -0,0 +1,40 @@ +name: CI-Windows-14 + +on: + push: + branches: [ master ] + pull_request: + branches: [ master ] + schedule: + - cron: '0 2 * * *' + workflow_dispatch: {} + +jobs: + build: + runs-on: ${{ matrix.os }} + + strategy: + fail-fast: false + matrix: + node-version: [14] + os: [windows-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 npminstall -g && npminstall + + - name: Continuous Integration + run: npm run ci + + - name: Code Coverage + uses: codecov/codecov-action@v1 + with: + token: ${{ secrets.CODECOV_TOKEN }} diff --git a/README.md b/README.md index 4d2edecd..64cd97c4 100644 --- a/README.md +++ b/README.md @@ -1,7 +1,7 @@ # egg-bin [![NPM version][npm-image]][npm-url] -[![build status][travis-image]][travis-url] +[![build status][github-actions]][github-actions-url] [![Test coverage][codecov-image]][codecov-url] [![David deps][david-image]][david-url] [![Known Vulnerabilities][snyk-image]][snyk-url] @@ -9,8 +9,8 @@ [npm-image]: https://img.shields.io/npm/v/egg-bin.svg?style=flat-square [npm-url]: https://npmjs.org/package/egg-bin -[travis-image]: https://img.shields.io/travis/eggjs/egg-bin.svg?style=flat-square -[travis-url]: https://travis-ci.org/eggjs/egg-bin +[github-actions]: https://github.com/eggjs/egg-bin/actions/workflows/nodejs.yml/badge.svg?branch=master +[github-actions-url]: https://github.com/eggjs/egg-bin/actions/workflows/nodejs.yml [codecov-image]: https://codecov.io/gh/eggjs/egg-bin/branch/master/graph/badge.svg [codecov-url]: https://codecov.io/gh/eggjs/egg-bin [david-image]: https://img.shields.io/david/eggjs/egg-bin.svg?style=flat-square diff --git a/appveyor.yml b/appveyor.yml deleted file mode 100644 index 7c808d71..00000000 --- a/appveyor.yml +++ /dev/null @@ -1,16 +0,0 @@ -environment: - matrix: - - nodejs_version: '10' - - nodejs_version: '12' - - nodejs_version: '14' - -install: - - ps: Install-Product node $env:nodejs_version - - npm i npminstall && node_modules\.bin\npminstall - -test_script: - - node --version - - npm --version - - npm run test - -build: off diff --git a/package.json b/package.json index ba06608a..5c742192 100644 --- a/package.json +++ b/package.json @@ -17,7 +17,7 @@ "egg-ts-helper": "^1.25.9", "egg-utils": "^2.4.1", "espower-source": "^2.3.0", - "globby": "^10.0.2", + "globby": "^9.2.0", "inspector-proxy": "^1.2.1", "intelli-espower-loader": "^1.1.0", "jest-changed-files": "^27.0.2", @@ -69,7 +69,7 @@ "test": "npm run lint -- --fix && npm run test-local", "test-local": "node bin/egg-bin.js test -t 3600000", "cov": "nyc -r lcov -r text-summary npm run test-local", - "ci-test-only": "TESTS=test/lib/cmd/cov.test.js npm run test-local", + "ci-test-only": "npm run test-local -- test/lib/cmd/cov.test.js", "ci": "npm run lint && npm run pkgfiles -- --check && npm run ci-test-only && npm run cov", "autod": "node bin/egg-bin.js autod" }, diff --git a/test/fixtures/example-ts-error-stack/node_modules/egg/index.js b/test/fixtures/example-ts-error-stack/node_modules/egg/index.js index a622d0b5..3a6c26e9 100644 --- a/test/fixtures/example-ts-error-stack/node_modules/egg/index.js +++ b/test/fixtures/example-ts-error-stack/node_modules/egg/index.js @@ -5,4 +5,4 @@ module.exports = require('../../../../../node_modules/egg'); setTimeout(() => { console.log('exit by master test end'); process.exit(0); -}, require('os').platform() === 'win32' ? 11000 : 7000); +}, require('os').platform() === 'win32' ? 11000 : 10000); diff --git a/test/fixtures/example-ts-ets/node_modules/egg/index.js b/test/fixtures/example-ts-ets/node_modules/egg/index.js index f7e34bfa..88306d99 100644 --- a/test/fixtures/example-ts-ets/node_modules/egg/index.js +++ b/test/fixtures/example-ts-ets/node_modules/egg/index.js @@ -6,5 +6,5 @@ if (process.execArgv.find(argv => argv.includes('egg-ts-helper'))) { setTimeout(() => { console.log('exit by master test end'); process.exit(0); - }, require('os').platform() === 'win32' ? 11000 : 7000); + }, require('os').platform() === 'win32' ? 120000 : 10000); } diff --git a/test/fixtures/example-ts-pkg/node_modules/egg/index.js b/test/fixtures/example-ts-pkg/node_modules/egg/index.js index db1a2d18..7a559449 100644 --- a/test/fixtures/example-ts-pkg/node_modules/egg/index.js +++ b/test/fixtures/example-ts-pkg/node_modules/egg/index.js @@ -5,5 +5,5 @@ module.exports = require('../../../../../node_modules/egg'); setTimeout(() => { console.log('exit by master test end'); process.exit(0); -}, require('os').platform() === 'win32' ? 11000 : 7000); +}, require('os').platform() === 'win32' ? 11000 : 10000); diff --git a/test/fixtures/example-ts-simple/node_modules/egg/index.js b/test/fixtures/example-ts-simple/node_modules/egg/index.js index 9995e5bd..35a2064f 100644 --- a/test/fixtures/example-ts-simple/node_modules/egg/index.js +++ b/test/fixtures/example-ts-simple/node_modules/egg/index.js @@ -5,4 +5,4 @@ module.exports = require('../../../../../node_modules/egg'); setTimeout(() => { console.log('exit by master test end'); process.exit(0); -}, 6000); +}, 10000); diff --git a/test/fixtures/example-ts/node_modules/egg/index.js b/test/fixtures/example-ts/node_modules/egg/index.js index a622d0b5..3a6c26e9 100644 --- a/test/fixtures/example-ts/node_modules/egg/index.js +++ b/test/fixtures/example-ts/node_modules/egg/index.js @@ -5,4 +5,4 @@ module.exports = require('../../../../../node_modules/egg'); setTimeout(() => { console.log('exit by master test end'); process.exit(0); -}, require('os').platform() === 'win32' ? 11000 : 7000); +}, require('os').platform() === 'win32' ? 11000 : 10000); diff --git a/test/fixtures/example/node_modules/egg/index.js b/test/fixtures/example/node_modules/egg/index.js index 9995e5bd..35a2064f 100644 --- a/test/fixtures/example/node_modules/egg/index.js +++ b/test/fixtures/example/node_modules/egg/index.js @@ -5,4 +5,4 @@ module.exports = require('../../../../../node_modules/egg'); setTimeout(() => { console.log('exit by master test end'); process.exit(0); -}, 6000); +}, 10000); diff --git a/test/fixtures/ts/node_modules/aliyun-egg/index.js b/test/fixtures/ts/node_modules/aliyun-egg/index.js index bcd96029..69f74a7b 100644 --- a/test/fixtures/ts/node_modules/aliyun-egg/index.js +++ b/test/fixtures/ts/node_modules/aliyun-egg/index.js @@ -15,6 +15,6 @@ module.exports.startCluster = options => { setTimeout(() => { console.log('exit by master test end'); process.exit(0); - }, require('os').platform() === 'win32' ? 11000 : 7000); + }, require('os').platform() === 'win32' ? 11000 : 10000); return egg.startCluster(options); }; diff --git a/test/lib/cmd/debug.test.js b/test/lib/cmd/debug.test.js index c27028c1..f65d9086 100644 --- a/test/lib/cmd/debug.test.js +++ b/test/lib/cmd/debug.test.js @@ -16,8 +16,8 @@ describe('test/lib/cmd/debug.test.js', () => { return coffee.fork(eggBin, [ 'debug' ], { cwd }) // .debug() .expect('stderr', /Debugger listening/) - // node 8 missing "chrome-devtools" url - // .expect('stderr', /chrome-devtools:/) + // node 8 missing "devtools" url + // .expect('stderr', /devtools:/) .expect('stdout', /"workers":1/) .expect('code', 0) .end(); @@ -72,7 +72,7 @@ describe('test/lib/cmd/debug.test.js', () => { mm(process.env, 'VSCODE_CLI', ''); const app = coffee.fork(eggBin, [ 'debug' ], { cwd }); // app.debug(); - if (newDebugger) app.expect('stdout', /DevTools → chrome-devtools:.*:9999/); + if (newDebugger) app.expect('stdout', /DevTools → devtools:.*:9999/); yield app.expect('stderr', /Debugger listening/) .expect('stdout', /Debug Proxy online, now you could attach to 9999/) .expect('code', 0) @@ -83,7 +83,7 @@ describe('test/lib/cmd/debug.test.js', () => { mm(process.env, 'VSCODE_CLI', ''); const app = coffee.fork(eggBin, [ 'debug', '--proxy=6666' ], { cwd }); // app.debug(); - if (newDebugger) app.expect('stdout', /DevTools → chrome-devtools:.*:6666/); + if (newDebugger) app.expect('stdout', /DevTools → devtools:.*:6666/); yield app.expect('stderr', /Debugger listening/) .expect('stdout', /Debug Proxy online, now you could attach to 6666/) .expect('code', 0) @@ -95,7 +95,7 @@ describe('test/lib/cmd/debug.test.js', () => { const app = coffee.fork(eggBin, [ 'debug' ], { cwd }); // app.debug(); yield app.expect('stderr', /Debugger listening/) - .notExpect('stdout', /DevTools → chrome-devtools:.*:9999/) + .notExpect('stdout', /DevTools → devtools:.*:9999/) .notExpect('stdout', /Debug Proxy online, now you could attach to 9999/) .expect('code', 0) .end(); @@ -107,7 +107,7 @@ describe('test/lib/cmd/debug.test.js', () => { // app.debug(); yield app.expect('stderr', /Debugger listening/) .notExpect('stdout', /Debug Proxy online, now you could attach to 9999/) - .notExpect('stdout', /DevTools → chrome-devtools:.*:9999/) + .notExpect('stdout', /DevTools → devtools:.*:9999/) .expect('code', 0) .end(); }); @@ -118,7 +118,7 @@ describe('test/lib/cmd/debug.test.js', () => { // app.debug(); yield app.expect('stderr', /Debugger listening/) .notExpect('stdout', /Debug Proxy online, now you could attach to 9999/) - .notExpect('stdout', /DevTools → chrome-devtools:.*:9999/) + .notExpect('stdout', /DevTools → devtools:.*:9999/) .expect('code', 0) .end(); }); diff --git a/test/lib/cmd/test.test.js b/test/lib/cmd/test.test.js index cd8b5125..e264dac4 100644 --- a/test/lib/cmd/test.test.js +++ b/test/lib/cmd/test.test.js @@ -210,7 +210,7 @@ describe('test/lib/cmd/test.test.js', () => { if (err) return done(err); const { stdout, code } = result; assert(stdout.match(/Error: this is an error/)); - assert(stdout.match(/test\/promise.test.js:\d+:\d+/)); + assert(stdout.match(/test[\/\\]{1}promise.test.js:\d+:\d+/)); assert(stdout.match(/\bat\s+/g).length); assert(code === 1); done(err); @@ -225,8 +225,8 @@ describe('test/lib/cmd/test.test.js', () => { if (err) return done(err); const { stdout, code } = result; assert(stdout.match(/Error: this is an error/)); - assert(stdout.match(/test\/sleep.test.js:\d+:\d+/)); - assert(stdout.match(/node_modules\/my-sleep\/index.js:\d+:\d+/)); + assert(stdout.match(/test[\/\\]{1}sleep.test.js:\d+:\d+/)); + assert(stdout.match(/node_modules[\/\\]{1}my-sleep[\/\\]{1}index.js:\d+:\d+/)); assert(stdout.match(/\bat\s+/g).length); assert(code === 1); done(err); diff --git a/test/my-egg-bin.test.js b/test/my-egg-bin.test.js index b0084c15..beae9f35 100644 --- a/test/my-egg-bin.test.js +++ b/test/my-egg-bin.test.js @@ -95,7 +95,7 @@ describe('test/my-egg-bin.test.js', () => { coffee.fork(eggBin, [ 'error' ], { cwd }) .debug() .expect('stderr', /Error: this is an error/) - .expect('stderr', /fixtures\/my-egg-bin\/lib\/cmd\/error.js:/) + .expect('stderr', /fixtures[\/\\]{1}my-egg-bin[\/\\]{1}lib[\/\\]{1}cmd[\/\\]{1}error.js:/) .expect('code', 1) .end(done); }); diff --git a/test/ts.test.js b/test/ts.test.js index b7e59fec..421edb31 100644 --- a/test/ts.test.js +++ b/test/ts.test.js @@ -5,6 +5,7 @@ const coffee = require('coffee'); const mm = require('mm'); const fs = require('fs'); const rimraf = require('mz-modules/rimraf'); +const os = require('os'); describe('test/ts.test.js', () => { const eggBin = require.resolve('../bin/egg-bin'); @@ -79,7 +80,7 @@ describe('test/ts.test.js', () => { cwd = path.join(__dirname, './fixtures/example-ts-cluster'); return coffee.fork(eggBin, [ 'cov', '--ts' ], { cwd }) .debug() - .expect('stdout', process.env.NYC_ROOT_ID ? /Coverage summary/ : /Statements.*100%/) + .expect('stdout', process.env.NYC_ROOT_ID || os.platform() === 'win32' ? /Coverage summary/ : /Statements.*100%/) .expect('code', 0) .end(); }); @@ -108,8 +109,8 @@ describe('test/ts.test.js', () => { return coffee.fork(eggBin, [ 'test' ], { cwd }) .debug() .expect('stdout', /error/) - .expect('stdout', /test\/index\.test\.ts:8:11\)/) - .expect('stdout', /test\/index\.test\.ts:14:5\)/) + .expect('stdout', /test[\/\\]{1}index\.test\.ts:8:11\)/) + .expect('stdout', /test[\/\\]{1}index\.test\.ts:14:5\)/) .expect('stdout', /assert\(obj\.key === '222'\)/) .expect('stdout', /| {3}| {3}|/) .expect('stdout', /| {3}| {3}false/) @@ -122,8 +123,8 @@ describe('test/ts.test.js', () => { return coffee.fork(eggBin, [ 'test', '--tscompiler=esbuild-register' ], { cwd }) .debug() .expect('stdout', /error/) - .expect('stdout', /test\/index\.test\.ts:8:11\)/) - .expect('stdout', /test\/index\.test\.ts:14:5\)/) + .expect('stdout', /test[\/\\]{1}index\.test\.ts:8:11\)/) + .expect('stdout', /test[\/\\]{1}index\.test\.ts:14:5\)/) .expect('stdout', /assert\(obj\.key === "222"\)/) .expect('stdout', /| {3}| {3}|/) .expect('stdout', /| {3}| {3}false/) @@ -136,8 +137,8 @@ describe('test/ts.test.js', () => { return coffee.fork(eggBin, [ 'test' ], { cwd }) // .debug() .expect('stdout', /error/) - .expect('stdout', /test\/index\.test\.ts:8:11\)/) - .expect('stdout', /test\/index\.test\.ts:14:5\)/) + .expect('stdout', /test[\/\\]{1}index\.test\.ts:8:11\)/) + .expect('stdout', /test[\/\\]{1}index\.test\.ts:14:5\)/) .expect('stdout', /assert\(obj\.key === '222'\)/) .expect('stdout', /| {3}| {3}|/) .expect('stdout', /| {3}| {3}false/)