forked from sidorares/node-mysql2
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
add lint and CI workflows (sidorares#1399)
add lint and ci workflows
- Loading branch information
Showing
12 changed files
with
182 additions
and
11 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,69 @@ | ||
name: CI - Linux | ||
|
||
on: | ||
pull_request: | ||
push: | ||
branches: [ main ] | ||
|
||
workflow_dispatch: | ||
|
||
env: | ||
MYSQL_PORT: 3306 | ||
MYSQL_USER: root | ||
MYSQL_DATABASE: test | ||
|
||
jobs: | ||
tests-linux: | ||
runs-on: ubuntu-latest | ||
strategy: | ||
fail-fast: false | ||
matrix: | ||
node-version: [16.x] | ||
mysql-version: ["mysql:8.0.18", "mysql:8.0.22", "mysql:5.7"] | ||
use-compression: [0] | ||
use-tls: [0] | ||
# TODO - add mariadb to the matrix. currently few tests are broken due to mariadb incompatibilities | ||
include: | ||
- node-version: "16.x" | ||
mysql-version: "mysql:8.0.18" | ||
use-compression: 1 | ||
use-tls: 0 | ||
- node-version: "16.x" | ||
mysql-version: "mysql:8.0.18" | ||
use-compression: 0 | ||
use-tls: 1 | ||
- node-version: "16.x" | ||
mysql-version: "mysql:8.0.18" | ||
use-compression: 1 | ||
use-tls: 1 | ||
- node-version: "14.x" | ||
mysql-version: "mysql:5.7" | ||
- node-version: "12.x" | ||
mysql-version: "mysql:5.7" | ||
- filter: "5.1only" | ||
node-version: "16.x" | ||
mysql-version: "datagrip/mysql:5.1" | ||
|
||
name: Node.js ${{ matrix.node-version }} - DB ${{ matrix.mysql-version }} - SSL=${{matrix.use-tls}} Compression=${{matrix.use-compression}} | ||
|
||
steps: | ||
- uses: actions/checkout@v2 | ||
- name: Set up MySQL | ||
run: docker run -d -e MYSQL_ALLOW_EMPTY_PASSWORD=1 -e MYSQL_ROOT_PASSWORD=${{ env.MYSQL_PASSWORD }} -e MYSQL_DATABASE=${{ env.MYSQL_DATABASE }} -v $PWD/mysqldata:/var/lib/mysql/ -v $PWD/examples/custom-conf:/etc/mysql/conf.d -v $PWD/examples/ssl/certs:/certs -p ${{ env.MYSQL_PORT }}:3306 ${{ matrix.mysql-version }} | ||
- name: Set up Node.js ${{ matrix.node-version }} | ||
uses: actions/setup-node@v2 | ||
with: | ||
node-version: ${{ matrix.node-version }} | ||
- name: Cache dependencies | ||
uses: actions/cache@v2 | ||
with: | ||
path: ~/.npm | ||
key: npm-${{ hashFiles('package-lock.json') }} | ||
restore-keys: npm- | ||
|
||
- name: Install npm dependencies | ||
run: npm ci | ||
- name: Wait mysql server is ready | ||
run: node tools/wait-up.js | ||
- name: Run tests | ||
run: FILTER=${{matrix.filter}} MYSQL_USE_TLS=${{ matrix.use-tls }} MYSQL_USE_COMPRESSION=${{ matrix.use-compression }} npm test |
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,54 @@ | ||
name: CI - Windows | ||
|
||
on: | ||
pull_request: | ||
push: | ||
branches: [ main ] | ||
|
||
workflow_dispatch: | ||
|
||
env: | ||
MYSQL_PORT: 3306 | ||
MYSQL_USER: root | ||
MYSQL_DATABASE: test | ||
|
||
jobs: | ||
tests-windows: | ||
runs-on: windows-latest | ||
strategy: | ||
fail-fast: false | ||
matrix: | ||
node-version: [16.x] | ||
mysql-version: ['8.0'] | ||
use-compression: [0, 1] | ||
use-tls: [0, 1] | ||
|
||
name: Node.js ${{ matrix.node-version }} - DB ${{ matrix.mysql-version }} - SSL=${{matrix.use-tls}} Compression=${{matrix.use-compression}} | ||
|
||
steps: | ||
- uses: actions/checkout@v2 | ||
- name: Set up MySQL | ||
uses: shogo82148/actions-setup-mysql@v1 | ||
with: | ||
mysql-version: ${{ matrix.mysql-version }} | ||
- name: Set up Node.js ${{ matrix.node-version }} | ||
uses: actions/setup-node@v2 | ||
with: | ||
node-version: ${{ matrix.node-version }} | ||
- name: Cache dependencies | ||
uses: actions/cache@v2 | ||
with: | ||
path: ~/.npm | ||
key: npm-${{ hashFiles('package-lock.json') }} | ||
restore-keys: npm- | ||
|
||
- name: Install npm dependencies | ||
run: npm install | ||
- name: Wait mysql server is ready | ||
run: node tools/wait-up.js | ||
- run: node tools/create-db.js | ||
- name: Run tests | ||
run: npm test | ||
env: | ||
MYSQL_USE_TLS: ${{ matrix.use-tls }} | ||
MYSQL_USE_COMPRESSION: ${{ matrix.use-compression }} |
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,31 @@ | ||
name: lint | ||
|
||
on: | ||
pull_request: | ||
push: | ||
branches: [ master ] | ||
|
||
env: | ||
NODE_VERSION: 16.x | ||
|
||
jobs: | ||
lint-js: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v2 | ||
- name: Use Node.js ${{ env.NODE_VERSION }} | ||
uses: actions/setup-node@v2 | ||
with: | ||
node-version: ${{ env.NODE_VERSION }} | ||
- name: Cache dependencies | ||
uses: actions/cache@v2 | ||
with: | ||
path: ~/.npm | ||
key: npm-${{ hashFiles('package-lock.json') }} | ||
restore-keys: npm- | ||
- name: Install ESLint + ESLint configs/plugins | ||
run: npm install --only=dev | ||
- name: Lint JS files | ||
run: npm run lint:code | ||
- name: Lint JS snippets in docs | ||
run: npm run lint:docs |
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
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
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,11 @@ | ||
'use strict'; | ||
|
||
const conn = require('../test/common.js').createConnection({ database: 'mysql' }); | ||
conn.query('CREATE DATABASE IF NOT EXISTS test', (err) => { | ||
if (err) { | ||
console.log(err); | ||
return process.exit(-1); | ||
} | ||
|
||
conn.end(); | ||
}); |