Skip to content

Commit

Permalink
Add CI w/ test coverage
Browse files Browse the repository at this point in the history
  • Loading branch information
sangaman committed Aug 18, 2023
1 parent 9a26e96 commit 9964fd9
Show file tree
Hide file tree
Showing 2 changed files with 52 additions and 0 deletions.
49 changes: 49 additions & 0 deletions .github/workflows/main.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
name: CI Build

on:
push:
branches: [ "main" ]
pull_request:
types: [opened, synchronize, reopened]

jobs:
build:
runs-on: ubuntu-latest

strategy:
matrix:
node-version: [lts, latest]

steps:

- uses: actions/checkout@v3
with:
fetch-depth: 0

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

- name: Install
run: |
npm ci
- name: Build
run: |
npm run build
- name: Lint & Format
run: |
npm run lint-check
npm run prettier-check
- name: Tests & Coverage
run: |
npm run coverage-ci
- name: SonarCloud Scan
uses: SonarSource/sonarcloud-github-action@master
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
SONAR_TOKEN: ${{ secrets.SONARCLOUD_TOKEN }}
3 changes: 3 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,11 @@
"scripts": {
"build": "tsc",
"coverage": "c8 npm test",
"coverage-ci": "c8 --reporter=lcov npm test",
"lint": "eslint --quiet --fix --cache index.ts",
"lint-check": "eslint index.ts",
"prettier": "prettier index.ts test/*.ts --write",
"prettier-check": "prettier index.ts test/*.ts --check",
"test": "tsx --test test/test.ts"
},
"repository": {
Expand Down

0 comments on commit 9964fd9

Please sign in to comment.