Skip to content

Commit

Permalink
Add manual workflow for coverage
Browse files Browse the repository at this point in the history
  • Loading branch information
Tlacenka committed May 16, 2024
1 parent 63ff72e commit 2452a06
Show file tree
Hide file tree
Showing 4 changed files with 43 additions and 2 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ jobs:
cache: npm
- name: Install dependencies
run: npm ci
- name: run unit tests
- name: Run unit tests
run: npm run test

build:
Expand Down
41 changes: 41 additions & 0 deletions .github/workflows/coverage.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
name: Coverage

on:
workflow_dispatch:
inputs:
artifact:
type: boolean
name:
type: string
default: coverage

jobs:
coverage:
name: Collect unit test coverage
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4

- name: Set up Node.js
uses: actions/setup-node@v4
with:
node-version-file: .nvmrc
cache: npm

- name: Install dependencies
run: npm ci

- name: Run unit tests
run: npm run test:coverage

- name: Compress coverage results into ZIP
if: ${{ inputs.artifact }}
run: cd coverage && zip -r ../coverage.zip *

- name: Upload coverage artifact
if: ${{ inputs.artifact }}
uses: actions/upload−artifact@v4
with:
name: ${{ inputs.name }}
path: coverage.zip
1 change: 0 additions & 1 deletion jest.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,4 @@
module.exports = {
preset: "ts-jest",
testEnvironment: "node",
collectCoverage: true,
};
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
"build": "tsc",
"start": "node ./dist/index.js",
"test": "jest",
"test:coverage": "jest --collectCoverage --coverageDirectory=coverage --coverageReporters=html --coverageReporters=text",
"lint": "eslint src/**/* --max-warnings=0",
"format": "prettier . --check"
},
Expand Down

0 comments on commit 2452a06

Please sign in to comment.