Skip to content

Commit

Permalink
ci: Adding TypeScript build test (#1957)
Browse files Browse the repository at this point in the history
  • Loading branch information
wellwelwel authored Apr 16, 2023
1 parent 076b8c2 commit d6be503
Show file tree
Hide file tree
Showing 4 changed files with 61 additions and 0 deletions.
38 changes: 38 additions & 0 deletions .github/workflows/ci-tsc-build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
name: CI - TypeScript Build

on:
pull_request:
push:
branches: [ main ]

workflow_dispatch:

jobs:
tests-tsc-build:
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
node-version: [18.x]

name: Node.js ${{ matrix.node-version }}
steps:
- uses: actions/checkout@v3

- name: Set up Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v3
with:
node-version: ${{ matrix.node-version }}

- name: Cache dependencies
uses: actions/cache@v3
with:
path: ~/.npm
key: npm-${{ hashFiles('package-lock.json') }}
restore-keys: npm-

- name: Install npm dependencies
run: npm ci

- name: Testing TypeScript build
run: npm run test:tsc-build
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
"lint:code": "eslint index.js promise.js \"lib/**/*.js\" \"test/**/*.js\" \"benchmarks/**/*.js\"",
"lint:docs": "eslint Contributing.md \"documentation/**/*.md\" \"examples/*.js\"",
"test": "node ./test/run.js",
"test:tsc-build": "cd \"test/tsc-build\" && npx tsc -p \"tsconfig.json\"",
"coverage-test": "c8 -r cobertura -r lcov -r text node ./test/run.js",
"benchmark": "node ./benchmarks/benchmark.js",
"prettier": "prettier --single-quote --trailing-comma none --write \"{lib,examples,test}/**/*.js\"",
Expand Down
4 changes: 4 additions & 0 deletions test/tsc-build/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
import mysql from '../../index';
import mysqlp from '../../promise';

export { mysql, mysqlp };
18 changes: 18 additions & 0 deletions test/tsc-build/tsconfig.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
{
"include": ["index.ts"],
"compilerOptions": {
"target": "ES2016",
"module": "CommonJS",
"moduleResolution": "Node",
"isolatedModules": true,
"esModuleInterop": true,
"allowSyntheticDefaultImports": true,
"strict": true,
"alwaysStrict": true,
"noImplicitAny": true,
"strictFunctionTypes": false,
"skipLibCheck": false,
"noEmitOnError": true,
"noEmit": true
}
}

0 comments on commit d6be503

Please sign in to comment.