Skip to content

Commit

Permalink
Setup Codecov (#145)
Browse files Browse the repository at this point in the history
* Setup codecov

* codecov config

* add codecoverage reports

* fix codecov component name

* add codecov badge
  • Loading branch information
leordev authored Jan 22, 2024
1 parent 9d3e9e8 commit d22baae
Show file tree
Hide file tree
Showing 11 changed files with 209 additions and 6 deletions.
5 changes: 5 additions & 0 deletions .github/workflows/integrity-check.yml
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,11 @@ jobs:
name: junit-results
path: packages/*/results.xml

- name: Upload test coverage to Codecov
uses: codecov/codecov-action@eaaf4bedf32dbdc6b720b63067d99c4d77d6047d # v3.1.4
env:
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}

- name: Generate an access token to trigger downstream repo
uses: actions/create-github-app-token@2986852ad836768dfea7781f31828eb3e17990fa # v1.6.2
id: generate_token
Expand Down
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
# tbdex-js

[![codecov](https://codecov.io/github/TBD54566975/tbdex-js/graph/badge.svg?token=NE0263LUKG)](https://codecov.io/github/TBD54566975/tbdex-js)

This repo contains 3 npm packages:

- [`@tbdex/protocol`](./packages/protocol/) - create, parse, verify, and validate the tbdex messages and resources defined in the [protocol draft specification](https://github.com/TBD54566975/tbdex-protocol/blob/main/README.md)
Expand Down
33 changes: 33 additions & 0 deletions codecov.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
comment:
layout: "header, diff, components"

component_management:
default_rules:
statuses:
- type: project
target: auto # auto compares coverage to the previous base commit
threshold: 5% # allows a 5% drop from the previous base commit coverage
- type: patch
target: 90 # every PR opened should strive for at least 90% coverage

individual_components:
- component_id: package-protocol
name: protocol
paths: ["packages/protocol/**"]

- component_id: package-http-client
name: http-client
paths: ["packages/http-client/**"]

- component_id: package-http-server
name: http-server
paths: ["packages/http-server/**"]

coverage:
status:
project:
default:
informational: true
patch:
default:
informational: true # Don't gate PRs based on Codecov passing thresholds
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
"@types/mocha": "10.0.1",
"@typescript-eslint/eslint-plugin": "6.7.0",
"@typescript-eslint/parser": "6.7.0",
"c8": "^9.1.0",
"eslint": "8.49.0",
"mocha": "10.2.0",
"mocha-junit-reporter": "2.2.1",
Expand Down
19 changes: 19 additions & 0 deletions packages/http-client/.c8rc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
{
"all": true,
"cache": false,
"extension": [
".js"
],
"include": [
"tests/compiled/src/**"
],
"exclude": [
"tests/compiled/src/index.js",
"tests/compiled/src/types.js",
"tests/compiled/src/types/**"
],
"reporter": [
"cobertura",
"text"
]
}
4 changes: 2 additions & 2 deletions packages/http-client/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -88,12 +88,12 @@
"build:esm": "rimraf dist/esm dist/types && tsc",
"build:cjs": "rimraf dist/cjs && tsc -p tsconfig.cjs.json && echo '{\"type\": \"commonjs\"}' > ./dist/cjs/package.json",
"build:browser": "rimraf dist/browser.mjs dist/browser.js && node build/bundles.js",
"test:node": "rimraf tests/compiled && tsc -p tests/tsconfig.json && mocha",
"test:node": "rimraf tests/compiled && tsc -p tests/tsconfig.json && c8 mocha",
"test:browser": "karma start karma.conf.cjs",
"build": "pnpm clean && pnpm build:esm && pnpm build:cjs && pnpm build:browser",
"lint": "eslint . --ext .ts --max-warnings 0",
"lint:fix": "eslint . --ext .ts --fix",
"docs": "pnpm build:esm && typedoc --plugin typedoc-plugin-markdown --out docs src/main.ts",
"try": "pnpm build:esm && node dist/esm/src/try.js"
}
}
}
19 changes: 19 additions & 0 deletions packages/http-server/.c8rc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
{
"all": true,
"cache": false,
"extension": [
".js"
],
"include": [
"tests/compiled/src/**"
],
"exclude": [
"tests/compiled/src/index.js",
"tests/compiled/src/types.js",
"tests/compiled/src/types/**"
],
"reporter": [
"cobertura",
"text"
]
}
4 changes: 2 additions & 2 deletions packages/http-server/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -43,10 +43,10 @@
"clean": "rimraf dist tests/compiled",
"lint": "eslint . --ext .ts --max-warnings 0",
"lint:fix": "eslint . --ext .ts --fix",
"test:node": "rimraf tests/compiled && tsc -p tests/tsconfig.json && mocha",
"test:node": "rimraf tests/compiled && tsc -p tests/tsconfig.json && c8 mocha",
"try": "pnpm build && node dist/try.js"
},
"keywords": [
"tbdex"
]
}
}
19 changes: 19 additions & 0 deletions packages/protocol/.c8rc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
{
"all": true,
"cache": false,
"extension": [
".js"
],
"include": [
"tests/compiled/src/**"
],
"exclude": [
"tests/compiled/src/index.js",
"tests/compiled/src/types.js",
"tests/compiled/src/types/**"
],
"reporter": [
"cobertura",
"text"
]
}
4 changes: 2 additions & 2 deletions packages/protocol/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@
"build:cjs": "rimraf dist/cjs && tsc -p tsconfig.cjs.json && echo '{\"type\": \"commonjs\"}' > ./dist/cjs/package.json",
"build:browser": "rimraf dist/browser.mjs dist/browser.js && node build/bundles.js",
"cp:test-vectors": "mkdir -p generated/test-vectors/ && cp -r ../../tbdex/hosted/test-vectors/protocol/vectors/ generated/test-vectors",
"test:node": "rimraf tests/compiled && pnpm compile-validators && pnpm cp:test-vectors && tsc -p tests/tsconfig.json && mocha",
"test:node": "rimraf tests/compiled && pnpm compile-validators && pnpm cp:test-vectors && tsc -p tests/tsconfig.json && c8 mocha",
"test:browser": "pnpm compile-validators && pnpm cp:test-vectors && karma start karma.conf.cjs",
"generate-test-vectors": "tsc -p tests/tsconfig.json && node tests/compiled/tests/generate-test-vectors.js",
"build": "pnpm clean && pnpm compile-validators && pnpm cp:test-vectors && pnpm build:esm && pnpm build:cjs && pnpm build:browser",
Expand All @@ -96,4 +96,4 @@
"docs": "pnpm build:esm && typedoc --plugin typedoc-plugin-markdown --out docs src/main.ts",
"try": "pnpm compile-validators && pnpm cp:test-vectors && pnpm build:esm && node dist/esm/src/try.js"
}
}
}
105 changes: 105 additions & 0 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit d22baae

Please sign in to comment.