Skip to content

Commit

Permalink
Add CI w/ SonarCloud 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 0da034a
Show file tree
Hide file tree
Showing 3 changed files with 50 additions and 0 deletions.
45 changes: 45 additions & 0 deletions .github/workflows/main.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
name: CI Build

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

jobs:
build:
runs-on: ubuntu-latest

steps:

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

- name: Use Node.js latest
uses: actions/setup-node@v3
with:
node-version: latest

- 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
2 changes: 2 additions & 0 deletions sonar-project.properties
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
sonar.projectKey=sangaman_bip136js
sonar.organization=sangaman

0 comments on commit 0da034a

Please sign in to comment.