From 134a28f09980c0ca460725354e8de71150f401b3 Mon Sep 17 00:00:00 2001 From: K-KY Date: Fri, 17 Jan 2025 13:01:28 +0900 Subject: [PATCH 1/7] =?UTF-8?q?CI=20:=20=EC=86=8C=EB=82=98=ED=81=90?= =?UTF-8?q?=EB=B8=8C=20=EA=B9=83=ED=97=88=EB=B8=8C=20=EC=95=A1=EC=85=98=20?= =?UTF-8?q?=ED=94=8C=EB=A1=9C=EC=9A=B0=20=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/sonarqube.yml | 51 +++++++++++++++++++++++++++++++++ 1 file changed, 51 insertions(+) create mode 100644 .github/workflows/sonarqube.yml diff --git a/.github/workflows/sonarqube.yml b/.github/workflows/sonarqube.yml new file mode 100644 index 0000000..75cdbb1 --- /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: Setup Node.js + uses: actions/setup-node@v3 + with: + node-version: 18 + + # 3. 의존성 설치 + - name: Install dependencies + run: npm install + + # 4. 빌드 (필요한 경우) + - name: Build the project + run: npm run build + + # 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 토큰 + SONAR_HOST_URL: ${{ secrets.GCP_SONAR_URL }} # SonarQube URL + with: + args: | + -Dsonar.projectKey=your-project-key + -Dsonar.sources=src + -Dsonar.tests=tests + -Dsonar.javascript.lcov.reportPaths=coverage/lcov.info + -Dsonar.projectVersion=1.0 + -Dsonar.language=ts + -Dsonar.verbose=true From 6128a5802018c9ccb245639a9a7dc2517d35c34d Mon Sep 17 00:00:00 2001 From: K-KY Date: Fri, 17 Jan 2025 13:02:32 +0900 Subject: [PATCH 2/7] Update .eslintrc.json --- .eslintrc.json | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/.eslintrc.json b/.eslintrc.json index 4a823c9..50789f0 100644 --- a/.eslintrc.json +++ b/.eslintrc.json @@ -46,5 +46,15 @@ "react-hooks/rules-of-hooks": "error", "react-hooks/exhaustive-deps": "warn", "@typescript-eslint/no-require-imports": "off" + "@typescript-eslint/no-unused-vars": [ + "warn", + { + "vars": "all", // "all"은 모든 변수 검사 + "args": "after-used", // 사용되지 않는 함수 인수 허용 + "ignoreRestSiblings": true, // 객체 디스트럭처링의 나머지 속성 무시 + "varsIgnorePattern": "^_" // 이름이 "_"로 시작하는 변수 무시 + } + ] + } } From 428d2030bb5d25680a03e4b941d487f409f0d272 Mon Sep 17 00:00:00 2001 From: K-KY Date: Fri, 17 Jan 2025 13:25:01 +0900 Subject: [PATCH 3/7] Update sonarqube.yml --- .github/workflows/sonarqube.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/sonarqube.yml b/.github/workflows/sonarqube.yml index 75cdbb1..2d1c775 100644 --- a/.github/workflows/sonarqube.yml +++ b/.github/workflows/sonarqube.yml @@ -29,9 +29,9 @@ jobs: - name: Install dependencies run: npm install - # 4. 빌드 (필요한 경우) - - name: Build the project - run: npm run build + # # 4. 빌드 (필요한 경우) + # - name: Build the project + # run: npm run build # 5. SonarQube 분석 실행 - name: Analyze with SonarQube From 5bf9477f86dc90e98db70fde7568adf0dfd063d8 Mon Sep 17 00:00:00 2001 From: K-KY Date: Fri, 17 Jan 2025 13:26:37 +0900 Subject: [PATCH 4/7] Update .eslintrc.json --- .eslintrc.json | 8 -------- 1 file changed, 8 deletions(-) diff --git a/.eslintrc.json b/.eslintrc.json index 50789f0..a4cabfd 100644 --- a/.eslintrc.json +++ b/.eslintrc.json @@ -47,14 +47,6 @@ "react-hooks/exhaustive-deps": "warn", "@typescript-eslint/no-require-imports": "off" "@typescript-eslint/no-unused-vars": [ - "warn", - { - "vars": "all", // "all"은 모든 변수 검사 - "args": "after-used", // 사용되지 않는 함수 인수 허용 - "ignoreRestSiblings": true, // 객체 디스트럭처링의 나머지 속성 무시 - "varsIgnorePattern": "^_" // 이름이 "_"로 시작하는 변수 무시 - } - ] } } From 6a573a53f3323144eab5d93453a2a5e142d20a4f Mon Sep 17 00:00:00 2001 From: K-KY Date: Fri, 17 Jan 2025 14:24:27 +0900 Subject: [PATCH 5/7] Update sonarqube.yml --- .github/workflows/sonarqube.yml | 10 ---------- 1 file changed, 10 deletions(-) diff --git a/.github/workflows/sonarqube.yml b/.github/workflows/sonarqube.yml index 2d1c775..2f56555 100644 --- a/.github/workflows/sonarqube.yml +++ b/.github/workflows/sonarqube.yml @@ -19,16 +19,6 @@ jobs: - name: Checkout code uses: actions/checkout@v3 - # 2. Node.js 설치 - - name: Setup Node.js - uses: actions/setup-node@v3 - with: - node-version: 18 - - # 3. 의존성 설치 - - name: Install dependencies - run: npm install - # # 4. 빌드 (필요한 경우) # - name: Build the project # run: npm run build From 22e04c46eefc4b84d13f74d071e1f62768360097 Mon Sep 17 00:00:00 2001 From: K-KY Date: Fri, 17 Jan 2025 14:43:33 +0900 Subject: [PATCH 6/7] Update sonarqube.yml --- .github/workflows/sonarqube.yml | 32 +++++++++++++++++++++----------- 1 file changed, 21 insertions(+), 11 deletions(-) diff --git a/.github/workflows/sonarqube.yml b/.github/workflows/sonarqube.yml index 2f56555..50720c1 100644 --- a/.github/workflows/sonarqube.yml +++ b/.github/workflows/sonarqube.yml @@ -1,17 +1,17 @@ -name: SonarQube analysis +name: SonarQube Analysis on: push: - branches: [ "main", "dev" ] + branches: ["main", "dev"] pull_request: - branches: [ "main", "dev" ] + branches: ["main", "dev"] workflow_dispatch: permissions: - pull-requests: read # allows SonarQube to decorate PRs with analysis results + pull-requests: read # Allows SonarQube to decorate PRs with analysis results jobs: - Analysis: + analysis: runs-on: ubuntu-latest steps: @@ -19,22 +19,32 @@ jobs: - name: Checkout code uses: actions/checkout@v3 - # # 4. 빌드 (필요한 경우) - # - name: Build the project - # run: npm run build + # 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 토큰 + SONAR_TOKEN: ${{ secrets.GCP_SONAR_USER_TOKEN }} # SonarQube token SONAR_HOST_URL: ${{ secrets.GCP_SONAR_URL }} # SonarQube URL with: args: | - -Dsonar.projectKey=your-project-key + -Dsonar.projectKey=your-actual-project-key # 실제 프로젝트 키로 변경 -Dsonar.sources=src - -Dsonar.tests=tests + -Dsonar.tests=src/tests # 'tests' 디렉터리 위치를 확인하고 수정 -Dsonar.javascript.lcov.reportPaths=coverage/lcov.info -Dsonar.projectVersion=1.0 -Dsonar.language=ts From 6ffb60dcbaa7d8ecefde64475b39b92a6018bcb6 Mon Sep 17 00:00:00 2001 From: K-KY Date: Fri, 17 Jan 2025 14:45:44 +0900 Subject: [PATCH 7/7] Update sonarqube.yml --- .github/workflows/sonarqube.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/sonarqube.yml b/.github/workflows/sonarqube.yml index 50720c1..7b5e123 100644 --- a/.github/workflows/sonarqube.yml +++ b/.github/workflows/sonarqube.yml @@ -42,7 +42,7 @@ jobs: SONAR_HOST_URL: ${{ secrets.GCP_SONAR_URL }} # SonarQube URL with: args: | - -Dsonar.projectKey=your-actual-project-key # 실제 프로젝트 키로 변경 + -Dsonar.projectKey=bns # 실제 프로젝트 키로 변경 -Dsonar.sources=src -Dsonar.tests=src/tests # 'tests' 디렉터리 위치를 확인하고 수정 -Dsonar.javascript.lcov.reportPaths=coverage/lcov.info