diff --git a/.github/workflows/angular.yml b/.github/workflows/angular.yml index f4392da3a..8a5eafc04 100644 --- a/.github/workflows/angular.yml +++ b/.github/workflows/angular.yml @@ -81,5 +81,13 @@ jobs: pnpm run build:core pnpm run build:angular pnpm run build:angular-formly - - name: Test + - name: Test with coverage run: pnpm --filter @haiilo/catalyst-angular-workspace run test:ci + - name: Upload coverage to Codecov + uses: codecov/codecov-action@v5 + with: + token: ${{ secrets.CODECOV_TOKEN }} + files: ./angular/coverage/**/lcov.info + flags: angular + name: angular-coverage + fail_ci_if_error: true diff --git a/.github/workflows/core.yml b/.github/workflows/core.yml index 280ddb9e8..53b0cb066 100644 --- a/.github/workflows/core.yml +++ b/.github/workflows/core.yml @@ -106,5 +106,13 @@ jobs: run: pnpm run build:tokens - name: Install Chrome run: node node_modules/puppeteer/install.mjs - - name: Test + - name: Test with coverage run: pnpm --filter @haiilo/catalyst run test + - name: Upload coverage to Codecov + uses: codecov/codecov-action@v5 + with: + token: ${{ secrets.CODECOV_TOKEN }} + files: ./core/coverage/lcov.info + flags: core + name: core-coverage + fail_ci_if_error: true diff --git a/angular/angular.json b/angular/angular.json index 235a52e42..5edeaa8d8 100644 --- a/angular/angular.json +++ b/angular/angular.json @@ -30,7 +30,9 @@ "tsConfig": "projects/catalyst/tsconfig.spec.json", "watch": false, "browsers": ["chromium"], - "runnerConfig": "vitest.config.ts" + "runnerConfig": "vitest.config.ts", + "coverage": true, + "coverageReporters": ["lcov", "json", "text"] } } } @@ -62,7 +64,9 @@ "tsConfig": "projects/catalyst-formly/tsconfig.spec.json", "watch": false, "browsers": ["chromium"], - "runnerConfig": "vitest.config.ts" + "runnerConfig": "vitest.config.ts", + "coverage": true, + "coverageReporters": ["lcov", "json", "text"] } } } diff --git a/codecov.yml b/codecov.yml new file mode 100644 index 000000000..6b6d63908 --- /dev/null +++ b/codecov.yml @@ -0,0 +1,30 @@ +coverage: + status: + project: + default: + target: 50% + threshold: 1% + if_ci_failed: error + patch: + default: + target: 70% + threshold: 1% + if_ci_failed: error + +comment: + layout: "header, diff, flags, components" + behavior: default + require_changes: false + require_base: false + require_head: true + +flags: + core: + paths: + - core/src/ + carryforward: true + angular: + paths: + - angular/projects/catalyst/src/ + - angular/projects/catalyst-formly/src/ + carryforward: true diff --git a/core/stencil.config.ts b/core/stencil.config.ts index 950def2ef..5dad20cb3 100644 --- a/core/stencil.config.ts +++ b/core/stencil.config.ts @@ -116,6 +116,9 @@ export const config: Config = { transform: { '\\.(jpg|jpeg|png|gif|eot|otf|webp|svg|ttf|woff|woff2|mp4|webm|wav|mp3|m4a|aac|oga)$': './stencil.transformer.js' }, - transformIgnorePatterns: ['node_modules/(?!(?:.pnpm/)?(@haiilo))'] + transformIgnorePatterns: ['node_modules/(?!(?:.pnpm/)?(@haiilo))'], + collectCoverage: true, + coverageDirectory: 'coverage', + coverageReporters: ['lcov', 'text', 'json-summary', 'html'] } };