diff --git a/.eslintrc.json b/.eslintrc.json index 4a823c9..a4cabfd 100644 --- a/.eslintrc.json +++ b/.eslintrc.json @@ -46,5 +46,7 @@ "react-hooks/rules-of-hooks": "error", "react-hooks/exhaustive-deps": "warn", "@typescript-eslint/no-require-imports": "off" + "@typescript-eslint/no-unused-vars": [ + } } diff --git a/.github/workflows/sonarqube.yml b/.github/workflows/sonarqube.yml new file mode 100644 index 0000000..7b5e123 --- /dev/null +++ b/.github/workflows/sonarqube.yml @@ -0,0 +1,51 @@ +name: SonarQube Analysis + +on: + push: + branches: ["main", "dev"] + pull_request: + branches: ["main", "dev"] + workflow_dispatch: + +permissions: + pull-requests: read # Allows SonarQube to decorate PRs with analysis results + +jobs: + analysis: + runs-on: ubuntu-latest + + steps: + # 1. 코드 체크아웃 + - name: Checkout code + uses: actions/checkout@v3 + + # 2. Node.js 환경 설정 (필요한 경우) + - name: Set up Node.js + uses: actions/setup-node@v3 + with: + node-version: '18' # Node.js 버전을 프로젝트에 맞게 변경 + + # 3. 의존성 설치 + - name: Install dependencies + run: npm install + + # 4. 테스트 커버리지 생성 (lcov 파일) + - name: Run tests and generate coverage + run: npm run test:coverage # 테스트 스크립트는 프로젝트에 따라 다를 수 있음 + + # 5. SonarQube 분석 실행 + - name: Analyze with SonarQube + uses: SonarSource/sonarqube-scan-action@7295e71c9583053f5bf40e9d4068a0c974603ec8 + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # Needed to get PR information + SONAR_TOKEN: ${{ secrets.GCP_SONAR_USER_TOKEN }} # SonarQube token + SONAR_HOST_URL: ${{ secrets.GCP_SONAR_URL }} # SonarQube URL + with: + args: | + -Dsonar.projectKey=bns # 실제 프로젝트 키로 변경 + -Dsonar.sources=src + -Dsonar.tests=src/tests # 'tests' 디렉터리 위치를 확인하고 수정 + -Dsonar.javascript.lcov.reportPaths=coverage/lcov.info + -Dsonar.projectVersion=1.0 + -Dsonar.language=ts + -Dsonar.verbose=true