-
Notifications
You must be signed in to change notification settings - Fork 61
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
🤖 TEST: Run test on GitHub Action (#19)
Only run test on Node.js >= 14
- Loading branch information
Showing
21 changed files
with
145 additions
and
131 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
# 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 }} | ||
|
||
services: | ||
mysql: | ||
image: mysql:5 | ||
env: | ||
MYSQL_ALLOW_EMPTY_PASSWORD: true | ||
MYSQL_DATABASE: test | ||
ports: | ||
- 3306:3306 | ||
options: --health-cmd="mysqladmin ping" --health-interval=10s --health-timeout=5s --health-retries=5 | ||
|
||
strategy: | ||
fail-fast: false | ||
matrix: | ||
node-version: [14, 16, 18] | ||
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 | ||
|
||
- name: Continuous Integration | ||
run: npm run ci | ||
|
||
- name: Code Coverage | ||
uses: codecov/codecov-action@v1 | ||
with: | ||
token: ${{ secrets.CODECOV_TOKEN }} |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
6 changes: 3 additions & 3 deletions
6
test/fixtures/apps/mysqlapp-multi-client-wrong/app/controller/home.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,9 @@ | ||
'use strict'; | ||
|
||
module.exports = function* () { | ||
const dataArr = yield this.service.user.list(this); | ||
module.exports = async (ctx) => { | ||
const dataArr = await ctx.service.user.list(ctx); | ||
|
||
this.body = { | ||
ctx.body = { | ||
hasRows: dataArr[0].length > 0 && dataArr[1].length > 0 && dataArr[2].length > 0, | ||
}; | ||
}; |
7 changes: 3 additions & 4 deletions
7
test/fixtures/apps/mysqlapp-multi-client-wrong/app/service/user.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,9 @@ | ||
'use strict'; | ||
|
||
exports.list = function* (ctx) { | ||
|
||
return yield [ | ||
exports.list = async (ctx) => { | ||
return await Promise.all([ | ||
ctx.app.mysqls.get('db1').query('select * from npm_auth'), | ||
ctx.app.mysqls.get('db2').query('select * from npm_auth'), | ||
ctx.app.mysqls.get('db3').query('select * from npm_auth'), | ||
]; | ||
]); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
'use strict'; | ||
|
||
exports.list = function* (ctx) { | ||
return yield ctx.app.mysql.query('select * from npm_auth'); | ||
exports.list = async (ctx) => { | ||
return await ctx.app.mysql.query('select * from npm_auth'); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,16 +1,15 @@ | ||
'use strict'; | ||
|
||
const co = require('co'); | ||
const fs = require('fs'); | ||
const path = require('path'); | ||
|
||
module.exports = function(agent) { | ||
module.exports = agent => { | ||
const done = agent.readyCallback('agent-mysql'); | ||
const p = path.join(__dirname, 'run/agent_result.json'); | ||
fs.existsSync(p) && fs.unlinkSync(p); | ||
|
||
co(function* () { | ||
const result = yield agent.mysql.query('select now() as currentTime;'); | ||
(async () => { | ||
const result = await agent.mysql.query('select now() as currentTime;'); | ||
fs.writeFileSync(p, JSON.stringify(result)); | ||
}).then(done, done); | ||
})().then(done).catch(done); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
'use strict'; | ||
|
||
exports.list = function* (ctx) { | ||
return yield ctx.app.mysql.query('select * from npm_auth'); | ||
exports.list = async (ctx) => { | ||
return await ctx.app.mysql.query('select * from npm_auth'); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -8,7 +8,7 @@ exports.mysql = { | |
password: '', | ||
database: 'test', | ||
}, | ||
agent:true | ||
agent: true | ||
}; | ||
|
||
exports.keys = 'foo'; |
Oops, something went wrong.