Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ci(codecov): upload coverage #65

Merged
merged 1 commit into from
Apr 21, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 26 additions & 0 deletions .github/workflows/codecov.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
name: CI

on:
push:
branches: [main]
pull_request:
types: [opened, synchronize, reopened]
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

jobs:
codecov:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- run: corepack enable
- uses: actions/setup-node@v4
with:
node-version: 20
cache: 'yarn'
- run: yarn install
- run: yarn test
- uses: codecov/codecov-action@v4
env:
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

secret에 추가필요

13 changes: 13 additions & 0 deletions codecov.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
coverage:
status:
patch: off
project:
default:
target: 100%
threshold: 10%
Comment on lines +6 to +7
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

테스트 커버리지 목표: 100% threshold 10%라서 90%의 테스트 커버리가 넘지 못하는 PR은 PR status check에서 x를 받게 됩니다


comment:
layout: 'header, reach, diff, flags, components'

ignore:
- '**/*.test-d.*'
Comment on lines +12 to +13
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

codecov에서 test-d파일은 아직 테스트코드로 보지 않고 있습니다. 하지만 test-d는 vitest에서 타입테스트를 위해서 사용되고 있습니다. 커버율에 포함되지 않게 처리했습니다.

7 changes: 5 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,8 @@
"changeset:publish": "changeset publish",
"changeset:version": "changeset version",
"packlint": "packlint sort -R",
"test": "vitest",
"test": "vitest run --coverage --typecheck",
"test:watch": "vitest --ui --coverage --typecheck",
Comment on lines +40 to +41
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  1. test coverage와 typecheck을 위해 viteset option을 추가합니다.
  2. vitest/ui를 사용해 watch모드인 경우 쉽게 해당 테스트 문제를 파악하고 커버리지를 파악할 수 있게 됩니다.

"typecheck": "tsc --noEmit"
},
"devDependencies": {
Expand All @@ -47,13 +48,15 @@
"@types/node": "^20.11.30",
"@typescript-eslint/eslint-plugin": "^5.39.0",
"@typescript-eslint/parser": "^5.39.0",
"@vitest/coverage-istanbul": "^1.5.0",
"@vitest/ui": "^1.5.0",
"eslint": "^7",
"eslint-config-prettier": "^8.5.0",
"packlint": "^0.2.4",
"prettier": "^3.2.5",
"tsup": "^8.0.2",
"typescript": "^5.4.3",
"vitest": "^1.4.0"
"vitest": "^1.5.0"
},
"publishConfig": {
"access": "public",
Expand Down
13 changes: 13 additions & 0 deletions vitest.config.mts
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
import { defineConfig } from 'vitest/config';
import packageJson from './package.json';

export default defineConfig({
test: {
name: packageJson.name,
dir: './src',
coverage: {
provider: 'istanbul',
include: ['src/**/*'],
},
Comment on lines +8 to +11
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

test coverage를 측정하기 시작합니다

},
});
Loading