Skip to content

Commit e1b508c

Browse files
committed
ci: enable testing
Signed-off-by: Rifa Achrinza <[email protected]>
1 parent cb43ab3 commit e1b508c

File tree

4 files changed

+10669
-1
lines changed

4 files changed

+10669
-1
lines changed

.github/workflows/ci.yaml

Lines changed: 123 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,123 @@
1+
name: CI
2+
3+
on:
4+
push:
5+
branches:
6+
- master
7+
pull_request:
8+
branches:
9+
- master
10+
schedule:
11+
- cron: '0 2 * * 1' # At 02:00 on Monday
12+
13+
permissions: {}
14+
15+
jobs:
16+
test:
17+
name: Test
18+
runs-on: ubuntu-latest
19+
timeout-minutes: 15
20+
# services:
21+
# mssql:
22+
# image: mcr.microsoft.com/mssql/server:2019-latest
23+
# env:
24+
# ACCEPT_EULA: 'Y'
25+
# ports:
26+
# - 1433:1433
27+
strategy:
28+
matrix:
29+
node-version: [10, 12, 14, 16, 17]
30+
# mongodb-version: [4.4]
31+
fail-fast: false
32+
steps:
33+
- uses: actions/checkout@v2
34+
- name: Use Node.js ${{ matrix.node-version }}
35+
uses: actions/setup-node@v1
36+
with:
37+
node-version: ${{ matrix.node-version }}
38+
- uses: Yuri6037/[email protected]
39+
- name: Setup database
40+
run: |
41+
faketty ./setup.sh
42+
export MSSQL_HOST="localhost"
43+
export MSSQL_PORT=1433
44+
export MSSQL_USER="sa"
45+
export MSSQL_PASSWORD="M55sqlT35t"
46+
export MSSQL_DATABASE="master"
47+
- name: Bootstrap project
48+
run: npm ci --ignore-scripts
49+
- name: Update NPM (Node.js v10)
50+
if: matrix.node-version == 10
51+
run: npm install --global npm@7
52+
- name: Update NPM
53+
if: matrix.node-version != 10
54+
run: npm install --global npm@8
55+
- name: Run tests
56+
run: npm test --ignore-scripts
57+
- name: Publish coverage report to Coveralls
58+
uses: coverallsapp/github-action@master
59+
with:
60+
github-token: ${{ secrets.GITHUB_TOKEN }}
61+
flag-name: run-${{ matrix.os }}-node@${{ matrix.node-version }}
62+
path-to-lcov: ${{ github.workspace }}/coverage/lcov.info
63+
parallel: true
64+
65+
posttest:
66+
name: Post-Test
67+
needs: test
68+
runs-on: ubuntu-latest
69+
steps:
70+
- name: Coveralls finished
71+
uses: coverallsapp/github-action@master
72+
with:
73+
github-token: ${{ secrets.github_token }}
74+
parallel-finished: true
75+
76+
code-lint:
77+
name: Code Lint
78+
runs-on: ubuntu-latest
79+
steps:
80+
- uses: actions/checkout@v2
81+
- name: Use Node.js 16
82+
uses: actions/setup-node@v2
83+
with:
84+
node-version: 16
85+
- name: Bootstrap project
86+
run: npm ci --ignore-scripts
87+
- name: Verify code linting
88+
run: npm run lint
89+
90+
commit-lint:
91+
name: Commit Lint
92+
runs-on: ubuntu-latest
93+
steps:
94+
- uses: actions/checkout@v2
95+
with:
96+
fetch-depth: 0
97+
- name: Use Node.js 16
98+
uses: actions/setup-node@v2
99+
with:
100+
node-version: 16
101+
- name: Bootstrap project
102+
run: npm ci --ignore-scripts
103+
- name: Verify commit linting
104+
run: npx --no-install commitlint --from origin/master --to HEAD --verbose
105+
106+
codeql:
107+
name: CodeQL
108+
runs-on: ubuntu-latest
109+
permissions:
110+
# See: https://github.com/github/codeql-action/blob/008b2cc71c4cf3401f45919d8eede44a65b4a322/README.md#usage
111+
security-events: write
112+
steps:
113+
- name: Checkout repository
114+
uses: actions/checkout@v2
115+
116+
- name: Initialize CodeQL
117+
uses: github/codeql-action/init@v1
118+
with:
119+
languages: 'javascript'
120+
config-file: ./.github/codeql/codeql-config.yml
121+
122+
- name: Perform CodeQL Analysis
123+
uses: github/codeql-action/analyze@v1

.npmrc

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1,2 @@
1-
package-lock=false
1+
package-lock=true
2+
scripts-prepend-node-path=true

0 commit comments

Comments
 (0)