diff --git a/.github/workflows/ci.yml b/.github/workflows/nodejs.yml similarity index 52% rename from .github/workflows/ci.yml rename to .github/workflows/nodejs.yml index 1a2f17fdd4..dc34e1ce1f 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/nodejs.yml @@ -1,27 +1,35 @@ name: Continuous integration -on: [push, pull_request] +on: + push: + branches: [ master ] + pull_request: + branches: [ master, 1.x ] + schedule: + - cron: '0 2 * * *' jobs: Runner: runs-on: ${{ matrix.os }} strategy: + fail-fast: false matrix: - os: [ubuntu-latest, macOS-latest] - node-version: [8, 10, 12, 14] + os: [ ubuntu-latest, macOS-latest, windows-latest ] + node-version: [ 8, 10, 12, 14 ] steps: - name: Checkout Git Source uses: actions/checkout@master + - name: Setup Node.js uses: actions/setup-node@v1 with: node-version: ${{ matrix.node-version }} + - name: Install Dependencies - run: | - npm install + run: npm i -g npminstall && npminstall + - name: Continuous integration run: npm run ci + - name: Code Coverage - run: | - npm install codecov -g - codecov - env: - CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }} + uses: codecov/codecov-action@v1 + with: + token: ${{ secrets.CODECOV_TOKEN }} diff --git a/appveyor.yml b/appveyor.yml deleted file mode 100644 index 8a20f4667f..0000000000 --- a/appveyor.yml +++ /dev/null @@ -1,19 +0,0 @@ -environment: - matrix: - - nodejs_version: '8' - - nodejs_version: '10' - - nodejs_version: '12' - -platform: - - x64 - -install: - - ps: Install-Product node $env:nodejs_version $env:platform - - npm i npminstall@4 && node_modules\.bin\npminstall - -test_script: - - node --version - - npm --version - - npm run ci - -build: off diff --git a/lib/egg.js b/lib/egg.js index 920c5f1496..d234d90c2f 100644 --- a/lib/egg.js +++ b/lib/egg.js @@ -411,6 +411,8 @@ class EggApplication extends EggCore { const rundir = this.config.rundir; const dumpFile = path.join(rundir, `${this.type}_timing_${process.pid}.json`); fs.writeFileSync(dumpFile, CircularJSON.stringify(json, null, 2)); + this.timing.clear(); + this.timing.disable(); } catch (err) { this.coreLogger.warn(`dumpTiming error: ${err.message}`); } diff --git a/package.json b/package.json index 4dac95983f..3f3b03cc4b 100644 --- a/package.json +++ b/package.json @@ -25,7 +25,7 @@ "delegates": "^1.0.0", "egg-cluster": "^1.23.0", "egg-cookies": "^2.3.0", - "egg-core": "^4.16.1", + "egg-core": "^4.18.0", "egg-development": "^2.4.2", "egg-i18n": "^2.0.0", "egg-jsonp": "^2.0.0", diff --git a/test/lib/egg.test.js b/test/lib/egg.test.js index 6e358505f5..6919f3c3d4 100644 --- a/test/lib/egg.test.js +++ b/test/lib/egg.test.js @@ -145,6 +145,15 @@ describe('test/lib/egg.test.js', () => { assert(json[0].pid === process.pid); }); + it('should disable & clear timing after ready', function* () { + const json = app.timing.toJSON(); + assert(json.length === 0); + app.timing.start('a'); + app.timing.end('a'); + const json2 = app.timing.toJSON(); + assert(json2.length === 0); + }); + it('should ignore error when dumpTiming', done => { mm(fs, 'writeFileSync', () => { throw new Error('mock error');