diff --git a/.deepsource.toml b/.deepsource.toml index 6b046d6..883e614 100644 --- a/.deepsource.toml +++ b/.deepsource.toml @@ -1,12 +1,17 @@ version = 1 [[analyzers]] -name = "typescript" +name = "javascript" enabled = true + [analyzers.meta] + environment = ["nodejs"] + style_guide = "airbnb" + [[analyzers]] -name = "javascript" +name = "test-coverage" enabled = true -[analyzers.meta] -env = ["nodejs"] \ No newline at end of file +[[transformers]] +name = "prettier" +enabled = true diff --git a/.github/workflows/deepsource.yml b/.github/workflows/deepsource.yml index 344e77a..ebe79fa 100644 --- a/.github/workflows/deepsource.yml +++ b/.github/workflows/deepsource.yml @@ -1,44 +1,40 @@ -name: Deepsource Code Review +name: DeepSource Code Review on: pull_request: - branches: - - main - - develop + types: [opened, synchronize] jobs: - deepsource-review: + analyze: + name: Analyze runs-on: ubuntu-latest + steps: - - name: Checkout code - uses: actions/checkout@v4 - with: - fetch-depth: 0 + - name: Checkout repository + uses: actions/checkout@v2 - name: Setup Node.js - uses: actions/setup-node@v4 + uses: actions/setup-node@v2 with: - node-version: '20' - cache: 'npm' + node-version: '18' - name: Install dependencies run: npm ci - - name: Run Lint + - name: Run linter run: npm run lint - - name: Run Deepsource CLI - env: - DEEPSOURCE_TOKEN: ${{ secrets.DEEPSOURCE_TOKEN }} - run: | - # Deepsource CLI 설치 - curl https://deepsource.io/cli | sh - - # Lint 분석 실행 - ./bin/deepsource report --analyzer lint \ - --key typescript \ - --value "$(cat lint-report.json)" - - # 필요한 경우 테스트 커버리지 추가 - # - name: Run Tests with Coverage - # run: npm run test:coverage + - name: Run tests and generate coverage + run: npm test -- --coverage + + - name: Upload coverage to DeepSource + uses: deepsourcelabs/test-coverage-action@master + with: + key: javascript + coverage-file: ./coverage/lcov.info + dsn: ${{ secrets.DEEPSOURCE_DSN }} + + - name: DeepSource Analyze + uses: deepsourcelabs/analyze-action@v1 + with: + dsn: ${{ secrets.DEEPSOURCE_DSN }} diff --git a/.gitignore b/.gitignore index caaf1be..97c5073 100644 --- a/.gitignore +++ b/.gitignore @@ -36,4 +36,5 @@ yarn-error.log* *.tsbuildinfo next-env.d.ts -*storybook.log \ No newline at end of file +# storybook +*storybook.log diff --git a/jest.config.js b/jest.config.js new file mode 100644 index 0000000..c0b6250 --- /dev/null +++ b/jest.config.js @@ -0,0 +1,10 @@ +module.exports = { + collectCoverage: true, + coverageReporters: ['lcov', 'text'], + coverageDirectory: 'coverage', + testEnvironment: 'jsdom', + setupFilesAfterEnv: ['/jest.setup.js'], + moduleNameMapper: { + '^@/(.*)$': '/src/$1', + }, +}; diff --git a/package.json b/package.json index 4da267b..87ac8cf 100644 --- a/package.json +++ b/package.json @@ -13,7 +13,8 @@ "prepare": "husky", "postinstall": "husky install", "storybook": "storybook dev -p 6006", - "build-storybook": "storybook build" + "build-storybook": "storybook build", + "test": "jest --coverage" }, "dependencies": { "@tanstack/react-query": "^5.59.14",