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 : 소나큐브 추가 #3

Open
wants to merge 8 commits into
base: dev
Choose a base branch
from
Open
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
2 changes: 2 additions & 0 deletions .eslintrc.json
Original file line number Diff line number Diff line change
Expand Up @@ -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": [

}
}
51 changes: 51 additions & 0 deletions .github/workflows/sonarqube.yml
Original file line number Diff line number Diff line change
@@ -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
Loading