Skip to content

Commit

Permalink
ci: add codecov integration, closes leather-io/issues@34
Browse files Browse the repository at this point in the history
  • Loading branch information
camerow committed Sep 19, 2024
1 parent 711c5a9 commit 17b5a3c
Show file tree
Hide file tree
Showing 15 changed files with 85 additions and 61 deletions.
21 changes: 20 additions & 1 deletion .github/workflows/code-checks.yml
Original file line number Diff line number Diff line change
Expand Up @@ -85,5 +85,24 @@ jobs:

- run: pnpm build

- name: Run unit tests
- name: Run unit tests with code coverage
run: pnpm test:unit

test-coverage:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: ./.github/actions/provision
with:
fetch-depth: 0

- run: pnpm build

- name: Run unit tests with code coverage
run: pnpm test:coverage

- name: Upload results to Codecov
uses: codecov/codecov-action@v4
with:
token: ${{secrets.CODECOV_TOKEN}}
files: ./app/mobile/coverage/.tmp/coverage-0.json
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -9,3 +9,4 @@ tsconfig.tsbuildinfo
.DS_Store
leather-styles
**/.env
coverage
7 changes: 6 additions & 1 deletion apps/mobile/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -40,4 +40,9 @@ artifacts/
# The following patterns were generated by expo-cli

expo-env.d.ts
# @end expo-cli
# @end expo-cli

# Coverage reports
coverage
tmp
.tmp
2 changes: 1 addition & 1 deletion apps/mobile/ios/Podfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -1997,7 +1997,7 @@ SPEC CHECKSUMS:
SDWebImageSVGCoder: 15a300a97ec1c8ac958f009c02220ac0402e936c
SDWebImageWebPCoder: e38c0a70396191361d60c092933e22c20d5b1380
SocketRocket: abac6f5de4d4d62d24e11868d7a2f427e0ef940d
Yoga: b9a182ab00cf25926e7f79657d08c5d23c2d03b0
Yoga: 348f8b538c3ed4423eb58a8e5730feec50bce372

PODFILE CHECKSUM: 1183a5e3969c957f2df7140e9b85ba46d355b320

Expand Down
45 changes: 45 additions & 0 deletions codecov.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
coverage:
status:
project:
default:
informational: true
patch:
default:
informational: true

comment:
layout: 'condensed_header, diff, flags, files, components'
require_changes: false # if true: only post the comment if coverage changes
hide_project_coverage: false # [true :: only show coverage on the git diff aka patch coverage]

codecov:
require_ci_to_pass: false

component_management:
individual_components:
- component_id: packages-bitcoin # this is an identifier that should not be changed
name: bitcoin # this is a display name, and can be changed freely
paths:
- packages/bitcoin

- component_id: packages-query
name: query
paths:
- packages/query

- component_id: packages-utils
name: utils
paths:
- packages/utils

- component_id: packages-crypto
name: crypto
paths:
- packages/crypto

- component_id: packages-stacks
name: stacks
paths:
- packages/stacks
# When modifying this file, please validate using
# curl -X POST --data-binary @codecov.yml https://codecov.io/validate
1 change: 0 additions & 1 deletion config/vitest-configs.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ export const defaultVitestUnitTestingConfig = {
test: {
include: 'src/**/*.spec.{ts,tsx}',
coverage: {
provider: 'istanbul',
reporter: ['text', 'json-summary', 'json', 'html'],
reportsDirectory: './coverage',
},
Expand Down
2 changes: 2 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
"syncpack:format": "syncpack format",
"syncpack:lint": "syncpack lint",
"test": "turbo run test",
"test:coverage": "pnpm -r test:coverage",
"test:unit": "pnpm -r test:unit",
"typecheck": "turbo run typecheck"
},
Expand All @@ -37,6 +38,7 @@
"@leather.io/prettier-config": "workspace:*",
"@leather.io/tsconfig-config": "workspace:*",
"@ls-lint/ls-lint": "2.2.3",
"@vitest/coverage-v8": "2.0.5",
"dependency-cruiser": "16.3.10",
"eslint": "8.53.0",
"husky": "9.1.4",
Expand Down
1 change: 0 additions & 1 deletion packages/bitcoin/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,6 @@
"@leather.io/prettier-config": "workspace:*",
"@leather.io/rpc": "workspace:*",
"@leather.io/tsconfig-config": "workspace:*",
"@vitest/coverage-istanbul": "0.34.6",
"eslint": "8.53.0",
"prettier": "3.3.3",
"tslib": "2.6.2",
Expand Down
3 changes: 1 addition & 2 deletions packages/crypto/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
"build": "tsup",
"build:watch": "tsup --watch --onSuccess 'tsup --dts-only'",
"prepublish": "pnpm build",
"test:coverage": "vitest run --coverage",
"test:unit": "vitest run",
"typecheck": "tsc --noEmit"
},
Expand All @@ -21,8 +22,6 @@
"just-memoize": "2.2.0"
},
"devDependencies": {
"@vitest/coverage-istanbul": "0.34.6",
"@vitest/coverage-v8": "2.0.4",
"tsup": "8.1.0",
"vitest": "2.0.5"
},
Expand Down
1 change: 0 additions & 1 deletion packages/query/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,6 @@
"@types/jsdom": "21.1.3",
"@types/lodash.get": "4.4.9",
"@types/react": "18.2.79",
"@vitest/coverage-istanbul": "0.34.6",
"concurrently": "8.2.2",
"eslint": "8.53.0",
"jsdom": "22.1.0",
Expand Down
1 change: 0 additions & 1 deletion packages/query/vitest.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ export default defineProject({
test: {
include: 'src/**/*.spec.{ts,tsx}',
coverage: {
provider: 'istanbul',
reporter: ['text', 'json-summary', 'json', 'html'],
reportsDirectory: './coverage',
},
Expand Down
2 changes: 2 additions & 0 deletions packages/stacks/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@
"build:watch": "tsup --watch --onSuccess 'tsup --dts-only'",
"prepublish": "pnpm build",
"test": "vitest run",
"test:coverage": "vitest run --coverage",
"test:unit": "vitest run",
"typecheck": "tsc --noEmit",
"types": "tsc --declaration --emitDeclarationOnly"
},
Expand Down
1 change: 0 additions & 1 deletion packages/utils/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,6 @@
"@leather.io/eslint-config": "workspace:*",
"@leather.io/prettier-config": "workspace:*",
"@leather.io/tsconfig-config": "workspace:*",
"@vitest/coverage-istanbul": "0.34.6",
"eslint": "8.53.0",
"prettier": "3.3.3",
"tsup": "8.1.0",
Expand Down
57 changes: 7 additions & 50 deletions pnpm-lock.yaml

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

1 change: 0 additions & 1 deletion vitest.workspace.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ export default defineWorkspace([
test: {
include: 'src/**/*.spec.{ts,tsx}',
coverage: {
provider: 'istanbul',
reporter: ['text', 'json-summary', 'json', 'html', 'lcov'],
reportsDirectory: './coverage',
reportOnFailure: true,
Expand Down

0 comments on commit 17b5a3c

Please sign in to comment.