Skip to content

Commit 9c791b7

Browse files
committed
Adding CI coverage
1 parent a485136 commit 9c791b7

4 files changed

Lines changed: 54 additions & 2 deletions

File tree

.c8rc.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
11
{
2-
"reporter": ["text", "html"]
2+
"reporter": ["text", "html", "lcov"],
3+
"reports-dir": "./coverage"
34
}

.github/workflows/ci.yml

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
name: HDS Lib JS CI
2+
3+
on:
4+
pull_request:
5+
branches:
6+
- '*'
7+
push:
8+
branches:
9+
- 'main'
10+
11+
jobs:
12+
build:
13+
runs-on: ubuntu-22.04
14+
15+
strategy:
16+
matrix:
17+
node-version: [20.x, 22.x]
18+
19+
steps:
20+
- name: Checkout repository
21+
uses: actions/checkout@v4
22+
23+
- name: Install Node.js ${{ matrix.node-version }}
24+
uses: actions/setup-node@v4
25+
with:
26+
node-version: ${{ matrix.node-version }}
27+
28+
- name: Install dependencies
29+
run: npm install
30+
31+
- name: Build
32+
run: npm run build
33+
34+
- name: Lint
35+
run: npm run lint
36+
37+
- name: Run tests with coverage
38+
run: npm run test:coverage:ci
39+
40+
- name: Upload coverage to Codecov
41+
if: matrix.node-version == '22.x'
42+
uses: codecov/codecov-action@v4
43+
with:
44+
token: ${{ secrets.CODECOV_TOKEN }}
45+
slug: healthdatasafe/hds-lib-js
46+
files: ./coverage/lcov.info
47+
fail_ci_if_error: false

README.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,8 @@
11
# HDS JAVASCRIPT LIBRARY
22

3+
[![CI](https://github.com/healthdatasafe/hds-lib-js/actions/workflows/ci.yml/badge.svg)](https://github.com/healthdatasafe/hds-lib-js/actions/workflows/ci.yml)
4+
[![codecov](https://codecov.io/gh/healthdatasafe/hds-lib-js/graph/badge.svg)](https://codecov.io/gh/healthdatasafe/hds-lib-js)
5+
36
Generic toolkit for server and web applications.
47

58
1. Manages global settings for the lib (servers, localization, logger)

package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
"scripts": {
66
"test": "NODE_ENV=test mocha tests --test-reporter=spec",
77
"test:coverage": "NODE_ENV=test c8 mocha tests --test-reporter=spec",
8+
"test:coverage:ci": "NODE_ENV=test c8 mocha tests --test-reporter=spec --timeout=20000",
89
"build": "npm run build:ts; npm run build:webpack",
910
"build:ts": "tsc",
1011
"build:webpack": "webpack",
@@ -32,6 +33,7 @@
3233
"homepage": "https://github.com/healthdatasafe/hds-lib-js#readme",
3334
"devDependencies": {
3435
"assert": "^2.1.0",
36+
"c8": "^10.1.3",
3537
"copy-webpack-plugin": "^13.0.0",
3638
"eslint": "^9.18.0",
3739
"globals": "^15.14.0",
@@ -46,7 +48,6 @@
4648
"dependencies": {
4749
"@pryv/monitor": "3.0.1",
4850
"@pryv/socket.io": "3.0.1",
49-
"c8": "^10.1.3",
5051
"events": "^3.3.0",
5152
"pryv": "3.0.1",
5253
"short-unique-id": "^5.3.2"

0 commit comments

Comments
 (0)