From c2c7574b61f8f7348d1357ff8dbd965e5d07c856 Mon Sep 17 00:00:00 2001 From: zakie Date: Fri, 28 Nov 2025 18:39:02 +0900 Subject: [PATCH 01/49] =?UTF-8?q?refactor:=20=EC=84=B1=EA=B3=B5=20?= =?UTF-8?q?=EC=8B=9C=EC=97=94=20status=20code=EC=99=80=20body=EB=A7=8C=20?= =?UTF-8?q?=EC=9E=88=EC=9C=BC=EB=A9=B4=20=EB=90=98=EB=AF=80=EB=A1=9C,=20?= =?UTF-8?q?=EA=B3=B5=ED=86=B5=20=EC=9D=91=EB=8B=B5=20=EA=B5=AC=EC=A1=B0=20?= =?UTF-8?q?=EC=82=AD=EC=A0=9C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- morutine-api/src/common/mod.rs | 1 - .../src/common/response/api_response.rs | 40 ------------------- morutine-api/src/common/response/mod.rs | 1 - 3 files changed, 42 deletions(-) delete mode 100644 morutine-api/src/common/response/api_response.rs delete mode 100644 morutine-api/src/common/response/mod.rs diff --git a/morutine-api/src/common/mod.rs b/morutine-api/src/common/mod.rs index 52897d3..a91e735 100644 --- a/morutine-api/src/common/mod.rs +++ b/morutine-api/src/common/mod.rs @@ -1,2 +1 @@ pub mod error; -pub mod response; diff --git a/morutine-api/src/common/response/api_response.rs b/morutine-api/src/common/response/api_response.rs deleted file mode 100644 index 8c11d15..0000000 --- a/morutine-api/src/common/response/api_response.rs +++ /dev/null @@ -1,40 +0,0 @@ -use axum::{Json, http::StatusCode, response::IntoResponse}; -use common::constant::status::*; -use serde::Serialize; - -#[derive(Debug, Serialize)] -pub struct ApiResponse { - pub status: u16, - pub code: &'static str, - pub message: Option<&'static str>, - pub data: Option, -} - -impl IntoResponse for ApiResponse { - fn into_response(self) -> axum::response::Response { - let status = StatusCode::from_u16(self.status).unwrap_or(StatusCode::OK); - let body = Json(self); - - (status, body).into_response() - } -} - -impl ApiResponse { - pub fn success(data: T) -> Self { - ApiResponse { - status: OK, - code: "OK", - message: None, - data: Some(data), - } - } - - pub fn no_content() -> Self { - ApiResponse { - status: NO_CONTENT, - code: "NO_CONTENT", - message: None, - data: None, - } - } -} diff --git a/morutine-api/src/common/response/mod.rs b/morutine-api/src/common/response/mod.rs deleted file mode 100644 index 4f99ff6..0000000 --- a/morutine-api/src/common/response/mod.rs +++ /dev/null @@ -1 +0,0 @@ -pub mod api_response; From d2b61e9b8e383479ef41e3dcf82f23c21f83581f Mon Sep 17 00:00:00 2001 From: zakie Date: Fri, 28 Nov 2025 18:42:06 +0900 Subject: [PATCH 02/49] =?UTF-8?q?refactor:=20=EC=97=90=EB=9F=AC=20response?= =?UTF-8?q?=20=EB=B3=80=ED=99=98=EC=97=90=EC=84=9C=20body=20=EC=A0=9C?= =?UTF-8?q?=EA=B1=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- morutine-api/src/common/error/error_into_response.rs | 3 --- 1 file changed, 3 deletions(-) diff --git a/morutine-api/src/common/error/error_into_response.rs b/morutine-api/src/common/error/error_into_response.rs index 70d3d94..410fd31 100644 --- a/morutine-api/src/common/error/error_into_response.rs +++ b/morutine-api/src/common/error/error_into_response.rs @@ -18,7 +18,6 @@ impl IntoResponse for AppError { let body = Json(json!({ "code": reason.code, "message": reason.message, - "data": {} })); (StatusCode::from_u16(reason.status).unwrap(), body).into_response() @@ -30,9 +29,7 @@ impl IntoResponse for DatabaseApiError { fn into_response(self) -> Response { let app_error: AppError = match self.0 { DatabaseErrorCode::UniqueViolation(_) => AppError::new(CommonErrorCode::Conflict), - DatabaseErrorCode::NotFound => AppError::new(CommonErrorCode::NotFound), - _ => AppError::new(CommonErrorCode::InternalServerError), }; From b0576bae3b6c72464b9f472d76f27cc5e3d98af4 Mon Sep 17 00:00:00 2001 From: zakie Date: Fri, 28 Nov 2025 19:23:42 +0900 Subject: [PATCH 03/49] =?UTF-8?q?refactor:=20=EA=B8=B0=EC=A1=B4=20?= =?UTF-8?q?=ED=97=AC=EC=8A=A4=20=EC=B2=B4=ED=81=AC=20=EC=9D=91=EB=8B=B5=20?= =?UTF-8?q?=EA=B5=AC=EC=A1=B0=20=EB=B3=80=ED=99=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- morutine-api/src/domain/system/handlers.rs | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/morutine-api/src/domain/system/handlers.rs b/morutine-api/src/domain/system/handlers.rs index 5152c1d..3bf1670 100644 --- a/morutine-api/src/domain/system/handlers.rs +++ b/morutine-api/src/domain/system/handlers.rs @@ -1,6 +1,7 @@ -use crate::common::response::api_response::ApiResponse; use axum::response::IntoResponse; +use axum::Json; +use serde_json::json; pub async fn health_check() -> impl IntoResponse { - ApiResponse::success("OK") + Json(json!({"status": "OK"})) } From cba7ac3889f463d5a18946d0f9cec3847a8d8f61 Mon Sep 17 00:00:00 2001 From: zakie Date: Fri, 28 Nov 2025 19:24:15 +0900 Subject: [PATCH 04/49] =?UTF-8?q?fix:=20cargo=20fmt=20=EC=A0=81=EC=9A=A9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- morutine-api/src/domain/system/handlers.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/morutine-api/src/domain/system/handlers.rs b/morutine-api/src/domain/system/handlers.rs index 3bf1670..6a8bb4a 100644 --- a/morutine-api/src/domain/system/handlers.rs +++ b/morutine-api/src/domain/system/handlers.rs @@ -1,5 +1,5 @@ -use axum::response::IntoResponse; use axum::Json; +use axum::response::IntoResponse; use serde_json::json; pub async fn health_check() -> impl IntoResponse { From cb8d340ed5cf713d5d0072d40dd8f3ac0633326a Mon Sep 17 00:00:00 2001 From: zakie Date: Fri, 28 Nov 2025 19:34:36 +0900 Subject: [PATCH 05/49] =?UTF-8?q?chore:=20sonarcloud=20=EC=9E=AC=EC=A0=81?= =?UTF-8?q?=EC=9A=A9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/sonarcloud.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/sonarcloud.yml b/.github/workflows/sonarcloud.yml index adf21d1..973139b 100644 --- a/.github/workflows/sonarcloud.yml +++ b/.github/workflows/sonarcloud.yml @@ -47,7 +47,7 @@ jobs: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} with: args: > - -Dsonar.projectKey=morutine_backend + -Dsonar.projectKey=morutine_backend -Dsonar.organization=morutine -Dsonar.projectBaseDir=. -Dsonar.coverageReportPaths=lcov.info From 7e21055b3e6f0fa955a9211be9420623fcf60634 Mon Sep 17 00:00:00 2001 From: zakie Date: Fri, 28 Nov 2025 19:38:05 +0900 Subject: [PATCH 06/49] =?UTF-8?q?chore:=20sonarcloud=20=ED=94=84=EB=A1=9C?= =?UTF-8?q?=EC=A0=9D=ED=8A=B8=ED=82=A4=20=EC=9E=AC=EC=84=A4=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/sonarcloud.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/sonarcloud.yml b/.github/workflows/sonarcloud.yml index 973139b..bca327d 100644 --- a/.github/workflows/sonarcloud.yml +++ b/.github/workflows/sonarcloud.yml @@ -47,7 +47,7 @@ jobs: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} with: args: > - -Dsonar.projectKey=morutine_backend + -Dsonar.projectKey=MORUTINE_backend -Dsonar.organization=morutine -Dsonar.projectBaseDir=. -Dsonar.coverageReportPaths=lcov.info From a4fc55b80015a93452de4ad098fffc1d99ee7063 Mon Sep 17 00:00:00 2001 From: zakie Date: Fri, 28 Nov 2025 19:45:06 +0900 Subject: [PATCH 07/49] =?UTF-8?q?chore:=20sonarcloud=20=EC=BB=A4=EB=B2=84?= =?UTF-8?q?=EB=A6=AC=EC=A7=80=20=EB=A6=AC=ED=8F=AC=ED=8A=B8=20=ED=8F=AC?= =?UTF-8?q?=EB=A7=B7=20=EB=B3=80=EA=B2=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/sonarcloud.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/sonarcloud.yml b/.github/workflows/sonarcloud.yml index bca327d..3ab7217 100644 --- a/.github/workflows/sonarcloud.yml +++ b/.github/workflows/sonarcloud.yml @@ -38,7 +38,7 @@ jobs: -t lcov \ --branch \ --ignore-not-existing \ - -o lcov.info + -o coverage.xml - name: SonarCloud Scan uses: SonarSource/sonarcloud-github-action@v2 @@ -50,4 +50,4 @@ jobs: -Dsonar.projectKey=MORUTINE_backend -Dsonar.organization=morutine -Dsonar.projectBaseDir=. - -Dsonar.coverageReportPaths=lcov.info + -Dsonar.coverageReportPaths=coverage.xml From c2612e8ef489c68d7b81227789bb62de790824e3 Mon Sep 17 00:00:00 2001 From: zakie Date: Fri, 28 Nov 2025 19:56:24 +0900 Subject: [PATCH 08/49] =?UTF-8?q?chore:=20sonarcloud=20=EC=BB=A4=EC=A0=80?= =?UTF-8?q?=EB=A6=AC=EC=A7=80=20=EA=B4=80=EB=A0=A8=20=EC=BD=94=EB=93=9C=20?= =?UTF-8?q?=EB=B3=80=EA=B2=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/sonarcloud.yml | 26 +++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/.github/workflows/sonarcloud.yml b/.github/workflows/sonarcloud.yml index 3ab7217..4b8a106 100644 --- a/.github/workflows/sonarcloud.yml +++ b/.github/workflows/sonarcloud.yml @@ -25,20 +25,20 @@ jobs: - name: Install grcov run: cargo install grcov - - name: Generate coverage + - name: Run tests with coverage instrumentation run: | - export CARGO_INCREMENTAL=0 - export RUSTFLAGS="-Cinstrument-coverage" - export LLVM_PROFILE_FILE="coverage-%p-%m.profraw" + CARGO_INCREMENTAL=0 \ + RUSTFLAGS="-Cinstrument-coverage" \ + LLVM_PROFILE_FILE="coverage-%p-%m.profraw" \ + cargo test --all --verbose - cargo test - - grcov . --binary-path ./target/debug/ \ - -s . \ - -t lcov \ - --branch \ - --ignore-not-existing \ - -o coverage.xml + - name: Generate coverage report (lcov) + run: | + grcov . \ + --binary-path ./target/debug/ \ + -s . -t lcov \ + --branch --ignore-not-existing \ + -o coverage.lcov - name: SonarCloud Scan uses: SonarSource/sonarcloud-github-action@v2 @@ -50,4 +50,4 @@ jobs: -Dsonar.projectKey=MORUTINE_backend -Dsonar.organization=morutine -Dsonar.projectBaseDir=. - -Dsonar.coverageReportPaths=coverage.xml + -Dsonar.coverageReportPaths=coverage.lcov From 43f6b52b2d240aa5caddac98c1a8305a2eed5107 Mon Sep 17 00:00:00 2001 From: zakie Date: Fri, 28 Nov 2025 22:15:03 +0900 Subject: [PATCH 09/49] =?UTF-8?q?chore:=20sonarcloud=20=ED=99=98=EA=B2=BD?= =?UTF-8?q?=EB=B3=80=EC=88=98=20=EB=93=B1=EB=A1=9D,=20xml=EB=A1=9C=20?= =?UTF-8?q?=EB=B3=80=EA=B2=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/sonarcloud.yml | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/.github/workflows/sonarcloud.yml b/.github/workflows/sonarcloud.yml index 4b8a106..e805e6f 100644 --- a/.github/workflows/sonarcloud.yml +++ b/.github/workflows/sonarcloud.yml @@ -32,13 +32,16 @@ jobs: LLVM_PROFILE_FILE="coverage-%p-%m.profraw" \ cargo test --all --verbose - - name: Generate coverage report (lcov) + - name: Generate coverage report (cobertura xml) run: | grcov . \ --binary-path ./target/debug/ \ - -s . -t lcov \ + -s . -t cobertura \ --branch --ignore-not-existing \ - -o coverage.lcov + -o coverage.xml + + - name: Set up PATH for SonarCloud + run: echo "$HOME/.cargo/bin" >> $GITHUB_PATH - name: SonarCloud Scan uses: SonarSource/sonarcloud-github-action@v2 @@ -46,8 +49,8 @@ jobs: SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} with: - args: > + args: > -Dsonar.projectKey=MORUTINE_backend -Dsonar.organization=morutine -Dsonar.projectBaseDir=. - -Dsonar.coverageReportPaths=coverage.lcov + -Dsonar.coverageReportPaths=coverage.xml \ No newline at end of file From 6c3a6740ecd775c165cdf610e8fb1c924db0ad34 Mon Sep 17 00:00:00 2001 From: zakie Date: Fri, 28 Nov 2025 22:21:08 +0900 Subject: [PATCH 10/49] =?UTF-8?q?chore:=20sonarcloud=20scan=20=EC=98=A4?= =?UTF-8?q?=EB=A5=98=20=EA=B3=A0=EC=B9=98=EA=B8=B0=20=EC=8B=9C=EB=8F=84=20?= =?UTF-8?q?1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/sonarcloud.yml | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/.github/workflows/sonarcloud.yml b/.github/workflows/sonarcloud.yml index e805e6f..0b77610 100644 --- a/.github/workflows/sonarcloud.yml +++ b/.github/workflows/sonarcloud.yml @@ -20,7 +20,8 @@ jobs: - name: Install Rust toolchain uses: dtolnay/rust-toolchain@stable with: - components: clippy + # grcov 실행에 필요한 llvm-tools-preview 컴포넌트 추가 + components: clippy, llvm-tools-preview - name: Install grcov run: cargo install grcov @@ -32,14 +33,16 @@ jobs: LLVM_PROFILE_FILE="coverage-%p-%m.profraw" \ cargo test --all --verbose - - name: Generate coverage report (cobertura xml) + - name: Generate coverage report (cobertura xml 1.0) run: | grcov . \ --binary-path ./target/debug/ \ - -s . -t cobertura \ + # SonarCloud 파서 호환성 맞춰야해서 Cobertura 1.0 버전 지정 + -s . -t cobertura --llvm --cobertura-version 1.0 \ --branch --ignore-not-existing \ -o coverage.xml + # SonarCloud Scan 컨테이너가 cargo를 찾게 PATH 설정 - name: Set up PATH for SonarCloud run: echo "$HOME/.cargo/bin" >> $GITHUB_PATH @@ -53,4 +56,4 @@ jobs: -Dsonar.projectKey=MORUTINE_backend -Dsonar.organization=morutine -Dsonar.projectBaseDir=. - -Dsonar.coverageReportPaths=coverage.xml \ No newline at end of file + -Dsonar.coverageReportPaths=coverage.xml # Cobertura XML 파일 경로 지정 \ No newline at end of file From ea6894872e13176008bc12f9fa5dd842d129c81e Mon Sep 17 00:00:00 2001 From: zakie Date: Fri, 28 Nov 2025 22:29:22 +0900 Subject: [PATCH 11/49] =?UTF-8?q?chore:=20sonarcloud=20scan=20=EC=98=A4?= =?UTF-8?q?=EB=A5=98=20=EA=B3=A0=EC=B9=98=EA=B8=B0=20=EC=8B=9C=EB=8F=84=20?= =?UTF-8?q?2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/sonarcloud.yml | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/.github/workflows/sonarcloud.yml b/.github/workflows/sonarcloud.yml index 0b77610..d76cea6 100644 --- a/.github/workflows/sonarcloud.yml +++ b/.github/workflows/sonarcloud.yml @@ -10,7 +10,7 @@ on: jobs: sonar: - runs-on: ubuntu-latest + runs-on: ubuntu-22.04 steps: - uses: actions/checkout@v4 @@ -20,7 +20,7 @@ jobs: - name: Install Rust toolchain uses: dtolnay/rust-toolchain@stable with: - # grcov 실행에 필요한 llvm-tools-preview 컴포넌트 추가 + # llvm-tools-preview 컴포넌트 설치 components: clippy, llvm-tools-preview - name: Install grcov @@ -37,9 +37,10 @@ jobs: run: | grcov . \ --binary-path ./target/debug/ \ - # SonarCloud 파서 호환성 맞춰야해서 Cobertura 1.0 버전 지정 + # SonarCloud 파서 호환성 (이전 오류 해결) -s . -t cobertura --llvm --cobertura-version 1.0 \ --branch --ignore-not-existing \ + --jobs 1 \ # 병렬 처리 제한으로 메모리 사용량 최소화 -o coverage.xml # SonarCloud Scan 컨테이너가 cargo를 찾게 PATH 설정 @@ -56,4 +57,4 @@ jobs: -Dsonar.projectKey=MORUTINE_backend -Dsonar.organization=morutine -Dsonar.projectBaseDir=. - -Dsonar.coverageReportPaths=coverage.xml # Cobertura XML 파일 경로 지정 \ No newline at end of file + -Dsonar.coverageReportPaths=coverage.xml \ No newline at end of file From d6358f17050058a9b260db2b8a4e440a848051da Mon Sep 17 00:00:00 2001 From: zakie Date: Fri, 28 Nov 2025 22:38:53 +0900 Subject: [PATCH 12/49] =?UTF-8?q?chore:=20sonarcloud=20scan=20=EC=98=A4?= =?UTF-8?q?=EB=A5=98=20=EA=B3=A0=EC=B9=98=EA=B8=B0=20=EC=8B=9C=EB=8F=84=20?= =?UTF-8?q?3=20(=EB=A9=94=EB=AA=A8=EB=A6=AC=20=EB=AC=B8=EC=A0=9C)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/sonarcloud.yml | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/.github/workflows/sonarcloud.yml b/.github/workflows/sonarcloud.yml index d76cea6..db9ba89 100644 --- a/.github/workflows/sonarcloud.yml +++ b/.github/workflows/sonarcloud.yml @@ -35,10 +35,12 @@ jobs: - name: Generate coverage report (cobertura xml 1.0) run: | + GRCOV_SOURCES="morutine-api/src morutine-common/src morutine-domain/src morutine-infra/src" + grcov . \ --binary-path ./target/debug/ \ - # SonarCloud 파서 호환성 (이전 오류 해결) - -s . -t cobertura --llvm --cobertura-version 1.0 \ + -s ${GRCOV_SOURCES} \ + -t cobertura --llvm --cobertura-version 1.0 \ --branch --ignore-not-existing \ --jobs 1 \ # 병렬 처리 제한으로 메모리 사용량 최소화 -o coverage.xml From 17ebdeace844058c78baf5ab81b3f051b4540c5d Mon Sep 17 00:00:00 2001 From: zakie Date: Fri, 28 Nov 2025 22:43:51 +0900 Subject: [PATCH 13/49] =?UTF-8?q?chore:=20sonarcloud=20scan=20=EC=98=A4?= =?UTF-8?q?=EB=A5=98=20=EA=B3=A0=EC=B9=98=EA=B8=B0=20=EC=8B=9C=EB=8F=84=20?= =?UTF-8?q?4=20(grcov=20=EC=97=90=EB=9F=AC)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/sonarcloud.yml | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/.github/workflows/sonarcloud.yml b/.github/workflows/sonarcloud.yml index db9ba89..2c6e94e 100644 --- a/.github/workflows/sonarcloud.yml +++ b/.github/workflows/sonarcloud.yml @@ -10,6 +10,7 @@ on: jobs: sonar: + # 무료 러너 중 안정성이 높은 ubuntu-22.04로 변경 (권장) runs-on: ubuntu-22.04 steps: @@ -20,11 +21,12 @@ jobs: - name: Install Rust toolchain uses: dtolnay/rust-toolchain@stable with: - # llvm-tools-preview 컴포넌트 설치 + # grcov에 필요한 llvm-tools-preview 컴포넌트 설치 components: clippy, llvm-tools-preview - - name: Install grcov - run: cargo install grcov + - name: Install grcov (with force update) + # 💡 grcov 구문 오류 해결을 위해 최신 버전을 강제 설치합니다. + run: cargo install grcov --force - name: Run tests with coverage instrumentation run: | @@ -33,16 +35,18 @@ jobs: LLVM_PROFILE_FILE="coverage-%p-%m.profraw" \ cargo test --all --verbose - - name: Generate coverage report (cobertura xml 1.0) + - name: Generate coverage report (cobertura xml) run: | + # 💡 소스 코드 분석 범위를 프로젝트 크레이트로 제한하여 메모리 부족 문제를 해결합니다. GRCOV_SOURCES="morutine-api/src morutine-common/src morutine-domain/src morutine-infra/src" grcov . \ --binary-path ./target/debug/ \ -s ${GRCOV_SOURCES} \ - -t cobertura --llvm --cobertura-version 1.0 \ + # 💡 이전 오류를 발생시킨 --cobertura-version 옵션을 제거합니다. + -t cobertura --llvm \ --branch --ignore-not-existing \ - --jobs 1 \ # 병렬 처리 제한으로 메모리 사용량 최소화 + --jobs 1 \ # 메모리 사용량 최소화를 위해 병렬 처리 제한 -o coverage.xml # SonarCloud Scan 컨테이너가 cargo를 찾게 PATH 설정 From c27a0278c17e3f912719abf7b764b29b10e68978 Mon Sep 17 00:00:00 2001 From: zakie Date: Fri, 28 Nov 2025 23:01:01 +0900 Subject: [PATCH 14/49] =?UTF-8?q?chore:=20sonarcloud=20=EC=BB=A4=EB=B2=84?= =?UTF-8?q?=EB=A6=AC=EC=A7=80=20=EB=A6=AC=ED=8F=AC=ED=8A=B8=20=EC=97=90?= =?UTF-8?q?=EB=9F=AC=20(=EB=8B=A8=EC=88=9C=ED=99=94)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/sonarcloud.yml | 24 ++++++------------------ 1 file changed, 6 insertions(+), 18 deletions(-) diff --git a/.github/workflows/sonarcloud.yml b/.github/workflows/sonarcloud.yml index 2c6e94e..ff14e06 100644 --- a/.github/workflows/sonarcloud.yml +++ b/.github/workflows/sonarcloud.yml @@ -1,16 +1,9 @@ name: Sonar Coverage on: - push: - branches: - - develop - pull_request: - branches: - - develop - +# ... (생략) jobs: sonar: - # 무료 러너 중 안정성이 높은 ubuntu-22.04로 변경 (권장) runs-on: ubuntu-22.04 steps: @@ -21,11 +14,9 @@ jobs: - name: Install Rust toolchain uses: dtolnay/rust-toolchain@stable with: - # grcov에 필요한 llvm-tools-preview 컴포넌트 설치 components: clippy, llvm-tools-preview - - name: Install grcov (with force update) - # 💡 grcov 구문 오류 해결을 위해 최신 버전을 강제 설치합니다. + - name: Install grcov run: cargo install grcov --force - name: Run tests with coverage instrumentation @@ -33,23 +24,20 @@ jobs: CARGO_INCREMENTAL=0 \ RUSTFLAGS="-Cinstrument-coverage" \ LLVM_PROFILE_FILE="coverage-%p-%m.profraw" \ - cargo test --all --verbose + cargo test --all --verbose # 4천 줄이므로 --all을 다시 시도합니다. - name: Generate coverage report (cobertura xml) run: | - # 💡 소스 코드 분석 범위를 프로젝트 크레이트로 제한하여 메모리 부족 문제를 해결합니다. GRCOV_SOURCES="morutine-api/src morutine-common/src morutine-domain/src morutine-infra/src" + # 💡 최종 수정: 불필요한 --binary-path, --llvm 옵션 모두 제거 grcov . \ - --binary-path ./target/debug/ \ -s ${GRCOV_SOURCES} \ - # 💡 이전 오류를 발생시킨 --cobertura-version 옵션을 제거합니다. - -t cobertura --llvm \ + -t cobertura \ --branch --ignore-not-existing \ - --jobs 1 \ # 메모리 사용량 최소화를 위해 병렬 처리 제한 + --jobs 1 \ -o coverage.xml - # SonarCloud Scan 컨테이너가 cargo를 찾게 PATH 설정 - name: Set up PATH for SonarCloud run: echo "$HOME/.cargo/bin" >> $GITHUB_PATH From 0ea99ad91bec5341d918ed01fd91092631bab5f3 Mon Sep 17 00:00:00 2001 From: zakie Date: Fri, 28 Nov 2025 23:03:27 +0900 Subject: [PATCH 15/49] =?UTF-8?q?chore:=20sonarcloud=20=EC=BB=A4=EB=B2=84?= =?UTF-8?q?=EB=A6=AC=EC=A7=80=20=EB=A6=AC=ED=8F=AC=ED=8A=B8=20=EC=97=90?= =?UTF-8?q?=EB=9F=AC=20(=EB=8B=A8=EC=88=9C=ED=99=94)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/sonarcloud.yml | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/.github/workflows/sonarcloud.yml b/.github/workflows/sonarcloud.yml index ff14e06..060683f 100644 --- a/.github/workflows/sonarcloud.yml +++ b/.github/workflows/sonarcloud.yml @@ -1,7 +1,13 @@ name: Sonar Coverage on: -# ... (생략) + push: + branches: + - develop + pull_request: + branches: + - develop + jobs: sonar: runs-on: ubuntu-22.04 @@ -24,7 +30,7 @@ jobs: CARGO_INCREMENTAL=0 \ RUSTFLAGS="-Cinstrument-coverage" \ LLVM_PROFILE_FILE="coverage-%p-%m.profraw" \ - cargo test --all --verbose # 4천 줄이므로 --all을 다시 시도합니다. + cargo test --all --verbose - name: Generate coverage report (cobertura xml) run: | From e82ff8ea4d050d77c15c274feb5ed731f4e9b30b Mon Sep 17 00:00:00 2001 From: zakie Date: Fri, 28 Nov 2025 23:09:40 +0900 Subject: [PATCH 16/49] =?UTF-8?q?chore:=20sonarcloud=20=EC=BB=A4=EB=B2=84?= =?UTF-8?q?=EB=A6=AC=EC=A7=80=20=EB=A6=AC=ED=8F=AC=ED=8A=B8=20=EC=97=90?= =?UTF-8?q?=EB=9F=AC=20=ED=95=B4=EA=B2=B0=20=EC=8B=9C=EB=8F=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/sonarcloud.yml | 2 -- 1 file changed, 2 deletions(-) diff --git a/.github/workflows/sonarcloud.yml b/.github/workflows/sonarcloud.yml index 060683f..92803f7 100644 --- a/.github/workflows/sonarcloud.yml +++ b/.github/workflows/sonarcloud.yml @@ -36,12 +36,10 @@ jobs: run: | GRCOV_SOURCES="morutine-api/src morutine-common/src morutine-domain/src morutine-infra/src" - # 💡 최종 수정: 불필요한 --binary-path, --llvm 옵션 모두 제거 grcov . \ -s ${GRCOV_SOURCES} \ -t cobertura \ --branch --ignore-not-existing \ - --jobs 1 \ -o coverage.xml - name: Set up PATH for SonarCloud From 31d1d3d8fc6d83879dc47c864222d0744c7f9279 Mon Sep 17 00:00:00 2001 From: zakie Date: Fri, 28 Nov 2025 23:15:29 +0900 Subject: [PATCH 17/49] =?UTF-8?q?chore:=20sonarcloud=20=EC=BB=A4=EB=B2=84?= =?UTF-8?q?=EB=A6=AC=EC=A7=80=20=EB=A6=AC=ED=8F=AC=ED=8A=B8=20=EC=97=90?= =?UTF-8?q?=EB=9F=AC=20=ED=95=B4=EA=B2=B0=20=EC=8B=9C=EB=8F=84=202?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/sonarcloud.yml | 19 +++++++++++++++---- 1 file changed, 15 insertions(+), 4 deletions(-) diff --git a/.github/workflows/sonarcloud.yml b/.github/workflows/sonarcloud.yml index 92803f7..cd2f09f 100644 --- a/.github/workflows/sonarcloud.yml +++ b/.github/workflows/sonarcloud.yml @@ -10,38 +10,47 @@ on: jobs: sonar: + # 안정적인 최신 무료 러너 환경 사용 runs-on: ubuntu-22.04 steps: - - uses: actions/checkout@v4 + - name: Checkout Code + uses: actions/checkout@v4 with: fetch-depth: 0 - - name: Install Rust toolchain + - name: Install Rust Toolchain & Components uses: dtolnay/rust-toolchain@stable with: + # llvm-profdata 누락 오류 해결을 위한 필수 컴포넌트 설치 components: clippy, llvm-tools-preview - name: Install grcov + # grcov 옵션 인식 오류 방지를 위해 최신 버전 강제 설치 run: cargo install grcov --force - - name: Run tests with coverage instrumentation + - name: Run Tests with Coverage Instrumentation run: | CARGO_INCREMENTAL=0 \ RUSTFLAGS="-Cinstrument-coverage" \ LLVM_PROFILE_FILE="coverage-%p-%m.profraw" \ cargo test --all --verbose - - name: Generate coverage report (cobertura xml) + - name: Generate Coverage Report (Cobertura XML) run: | + # 💡 소스 경로 목록 정의: 불필요한 의존성 코드 분석 방지 GRCOV_SOURCES="morutine-api/src morutine-common/src morutine-domain/src morutine-infra/src" grcov . \ + --binary-path ./target/debug/ \ -s ${GRCOV_SOURCES} \ -t cobertura \ --branch --ignore-not-existing \ -o coverage.xml + # --- SonarCloud Scan 환경 설정 --- + + # 💡 Rust/Cargo PATH 오류 해결: Cargo 경로를 환경 변수에 추가 (Clippy Sensor 오류 방지) - name: Set up PATH for SonarCloud run: echo "$HOME/.cargo/bin" >> $GITHUB_PATH @@ -50,6 +59,8 @@ jobs: env: SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + # 💡 SonarCloud Docker 컨테이너에 Cargo 환경 PATH를 직접 주입 + PATH: ${{ env.PATH }}:/github/home/.cargo/bin with: args: > -Dsonar.projectKey=MORUTINE_backend From f8275bff43ab9aea54441a069dd53ff4e46c3377 Mon Sep 17 00:00:00 2001 From: zakie Date: Fri, 28 Nov 2025 23:23:52 +0900 Subject: [PATCH 18/49] =?UTF-8?q?chore:=20sonarcloud=20=EC=BB=A4=EB=B2=84?= =?UTF-8?q?=EB=A6=AC=EC=A7=80=20=EB=A6=AC=ED=8F=AC=ED=8A=B8=20=EC=97=90?= =?UTF-8?q?=EB=9F=AC=20=ED=95=B4=EA=B2=B0=20=EC=8B=9C=EB=8F=84=203?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/sonarcloud.yml | 15 +++------------ 1 file changed, 3 insertions(+), 12 deletions(-) diff --git a/.github/workflows/sonarcloud.yml b/.github/workflows/sonarcloud.yml index cd2f09f..37a87a3 100644 --- a/.github/workflows/sonarcloud.yml +++ b/.github/workflows/sonarcloud.yml @@ -10,23 +10,19 @@ on: jobs: sonar: - # 안정적인 최신 무료 러너 환경 사용 runs-on: ubuntu-22.04 steps: - - name: Checkout Code - uses: actions/checkout@v4 + - uses: actions/checkout@v4 with: fetch-depth: 0 - name: Install Rust Toolchain & Components uses: dtolnay/rust-toolchain@stable with: - # llvm-profdata 누락 오류 해결을 위한 필수 컴포넌트 설치 components: clippy, llvm-tools-preview - name: Install grcov - # grcov 옵션 인식 오류 방지를 위해 최신 버전 강제 설치 run: cargo install grcov --force - name: Run Tests with Coverage Instrumentation @@ -38,7 +34,6 @@ jobs: - name: Generate Coverage Report (Cobertura XML) run: | - # 💡 소스 경로 목록 정의: 불필요한 의존성 코드 분석 방지 GRCOV_SOURCES="morutine-api/src morutine-common/src morutine-domain/src morutine-infra/src" grcov . \ @@ -48,10 +43,7 @@ jobs: --branch --ignore-not-existing \ -o coverage.xml - # --- SonarCloud Scan 환경 설정 --- - - # 💡 Rust/Cargo PATH 오류 해결: Cargo 경로를 환경 변수에 추가 (Clippy Sensor 오류 방지) - - name: Set up PATH for SonarCloud + - name: Set up Runner PATH run: echo "$HOME/.cargo/bin" >> $GITHUB_PATH - name: SonarCloud Scan @@ -59,8 +51,7 @@ jobs: env: SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - # 💡 SonarCloud Docker 컨테이너에 Cargo 환경 PATH를 직접 주입 - PATH: ${{ env.PATH }}:/github/home/.cargo/bin + SONAR_SCANNER_OPTS: "-Dsonar.cfamily.clippy.path=/github/home/.cargo/bin" with: args: > -Dsonar.projectKey=MORUTINE_backend From 0bc5ad08ef8b350c98881dc4408cd1648fb467d6 Mon Sep 17 00:00:00 2001 From: zakie Date: Fri, 28 Nov 2025 23:30:20 +0900 Subject: [PATCH 19/49] =?UTF-8?q?chore:=20sonarcloud=20=EC=BB=A4=EB=B2=84?= =?UTF-8?q?=EB=A6=AC=EC=A7=80=20=EB=A6=AC=ED=8F=AC=ED=8A=B8=20=EC=97=90?= =?UTF-8?q?=EB=9F=AC=20=ED=95=B4=EA=B2=B0=20=EC=8B=9C=EB=8F=84=204?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/sonarcloud.yml | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/.github/workflows/sonarcloud.yml b/.github/workflows/sonarcloud.yml index 37a87a3..a015a97 100644 --- a/.github/workflows/sonarcloud.yml +++ b/.github/workflows/sonarcloud.yml @@ -17,6 +17,11 @@ jobs: with: fetch-depth: 0 + - name: Install Python (for XML fix) + uses: actions/setup-python@v5 + with: + python-version: '3.x' + - name: Install Rust Toolchain & Components uses: dtolnay/rust-toolchain@stable with: @@ -43,6 +48,10 @@ jobs: --branch --ignore-not-existing \ -o coverage.xml + - name: Fix Cobertura Version for SonarCloud + run: | + sed -i 's/version="1.9"/version="1.0"/g' coverage.xml + - name: Set up Runner PATH run: echo "$HOME/.cargo/bin" >> $GITHUB_PATH From 1a05fc683c393fcd493008027a9ecd5d5226c1d3 Mon Sep 17 00:00:00 2001 From: zakie Date: Fri, 28 Nov 2025 23:40:03 +0900 Subject: [PATCH 20/49] =?UTF-8?q?chore:=20sonarcloud=20=EC=BB=A4=EB=B2=84?= =?UTF-8?q?=EB=A6=AC=EC=A7=80=20=EB=A6=AC=ED=8F=AC=ED=8A=B8=20=EC=97=90?= =?UTF-8?q?=EB=9F=AC=20=ED=95=B4=EA=B2=B0=20=EC=8B=9C=EB=8F=84=205?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/sonarcloud.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/sonarcloud.yml b/.github/workflows/sonarcloud.yml index a015a97..125f5d1 100644 --- a/.github/workflows/sonarcloud.yml +++ b/.github/workflows/sonarcloud.yml @@ -50,7 +50,8 @@ jobs: - name: Fix Cobertura Version for SonarCloud run: | - sed -i 's/version="1.9"/version="1.0"/g' coverage.xml + sed -i 's/version="1\.9"/version="1\.0"/g' coverage.xml + sed -i 's/version="1\.0"/version="1"/g' coverage.xml - name: Set up Runner PATH run: echo "$HOME/.cargo/bin" >> $GITHUB_PATH From 1bba3d54e533268802f991b1b25ed2322217c145 Mon Sep 17 00:00:00 2001 From: zakie Date: Fri, 28 Nov 2025 23:45:33 +0900 Subject: [PATCH 21/49] =?UTF-8?q?chore:=20sonarcloud=20=EC=BB=A4=EB=B2=84?= =?UTF-8?q?=EB=A6=AC=EC=A7=80=20=EB=A6=AC=ED=8F=AC=ED=8A=B8=20=EC=97=90?= =?UTF-8?q?=EB=9F=AC=20=ED=95=B4=EA=B2=B0=20=EC=8B=9C=EB=8F=84=206?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/sonarcloud.yml | 5 ----- 1 file changed, 5 deletions(-) diff --git a/.github/workflows/sonarcloud.yml b/.github/workflows/sonarcloud.yml index 125f5d1..08578fa 100644 --- a/.github/workflows/sonarcloud.yml +++ b/.github/workflows/sonarcloud.yml @@ -17,11 +17,6 @@ jobs: with: fetch-depth: 0 - - name: Install Python (for XML fix) - uses: actions/setup-python@v5 - with: - python-version: '3.x' - - name: Install Rust Toolchain & Components uses: dtolnay/rust-toolchain@stable with: From 45c62a8ea1e786dacfd825f7c31b1b524ffcd6d4 Mon Sep 17 00:00:00 2001 From: zakie Date: Fri, 28 Nov 2025 23:50:10 +0900 Subject: [PATCH 22/49] =?UTF-8?q?chore:=20sonarcloud=20=EC=BB=A4=EB=B2=84?= =?UTF-8?q?=EB=A6=AC=EC=A7=80=20=EB=A6=AC=ED=8F=AC=ED=8A=B8=20=EC=97=90?= =?UTF-8?q?=EB=9F=AC=20=ED=95=B4=EA=B2=B0=20=EC=8B=9C=EB=8F=84=207?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/sonarcloud.yml | 16 +++++++--------- 1 file changed, 7 insertions(+), 9 deletions(-) diff --git a/.github/workflows/sonarcloud.yml b/.github/workflows/sonarcloud.yml index 08578fa..60802c4 100644 --- a/.github/workflows/sonarcloud.yml +++ b/.github/workflows/sonarcloud.yml @@ -1,12 +1,7 @@ name: Sonar Coverage on: - push: - branches: - - develop - pull_request: - branches: - - develop +# ... (생략) jobs: sonar: @@ -25,16 +20,18 @@ jobs: - name: Install grcov run: cargo install grcov --force - - name: Run Tests with Coverage Instrumentation + - name: Run Tests with Coverage Instrumentation (Limited Scope) run: | CARGO_INCREMENTAL=0 \ RUSTFLAGS="-Cinstrument-coverage" \ LLVM_PROFILE_FILE="coverage-%p-%m.profraw" \ - cargo test --all --verbose + # 💡 리포트 크기 20MB 초과 문제를 해결하기 위해 가장 큰 크레이트 하나만 테스트 + cargo test -p morutine-api --verbose - name: Generate Coverage Report (Cobertura XML) run: | - GRCOV_SOURCES="morutine-api/src morutine-common/src morutine-domain/src morutine-infra/src" + # 💡 테스트를 morutine-api로 제한했으므로, 소스 경로도 morutine-api만 지정 + GRCOV_SOURCES="morutine-api/src" grcov . \ --binary-path ./target/debug/ \ @@ -45,6 +42,7 @@ jobs: - name: Fix Cobertura Version for SonarCloud run: | + # 💡 가장 안전한 방법으로 최종 버전 1을 만들기 위해 1.9, 1.0 치환 모두 실행 sed -i 's/version="1\.9"/version="1\.0"/g' coverage.xml sed -i 's/version="1\.0"/version="1"/g' coverage.xml From 49a31ffceef153d2b9d547e42d28fc97086a8b79 Mon Sep 17 00:00:00 2001 From: zakie Date: Fri, 28 Nov 2025 23:56:14 +0900 Subject: [PATCH 23/49] =?UTF-8?q?chore:=20sonarcloud=20=EC=BB=A4=EB=B2=84?= =?UTF-8?q?=EB=A6=AC=EC=A7=80=20=EB=A6=AC=ED=8F=AC=ED=8A=B8=20=EC=97=90?= =?UTF-8?q?=EB=9F=AC=20=ED=95=B4=EA=B2=B0=20=EC=8B=9C=EB=8F=84=208?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/sonarcloud.yml | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/.github/workflows/sonarcloud.yml b/.github/workflows/sonarcloud.yml index 60802c4..81e4164 100644 --- a/.github/workflows/sonarcloud.yml +++ b/.github/workflows/sonarcloud.yml @@ -1,7 +1,12 @@ name: Sonar Coverage on: -# ... (생략) + push: + branches: + - develop + pull_request: + branches: + - develop jobs: sonar: @@ -20,17 +25,15 @@ jobs: - name: Install grcov run: cargo install grcov --force - - name: Run Tests with Coverage Instrumentation (Limited Scope) + - name: Run Tests with Coverage Instrumentation run: | CARGO_INCREMENTAL=0 \ RUSTFLAGS="-Cinstrument-coverage" \ LLVM_PROFILE_FILE="coverage-%p-%m.profraw" \ - # 💡 리포트 크기 20MB 초과 문제를 해결하기 위해 가장 큰 크레이트 하나만 테스트 cargo test -p morutine-api --verbose - name: Generate Coverage Report (Cobertura XML) run: | - # 💡 테스트를 morutine-api로 제한했으므로, 소스 경로도 morutine-api만 지정 GRCOV_SOURCES="morutine-api/src" grcov . \ @@ -42,7 +45,6 @@ jobs: - name: Fix Cobertura Version for SonarCloud run: | - # 💡 가장 안전한 방법으로 최종 버전 1을 만들기 위해 1.9, 1.0 치환 모두 실행 sed -i 's/version="1\.9"/version="1\.0"/g' coverage.xml sed -i 's/version="1\.0"/version="1"/g' coverage.xml From ffcab4cf0d3bd6d3a47c30ea01259d5e85769034 Mon Sep 17 00:00:00 2001 From: zakie Date: Sat, 29 Nov 2025 00:07:37 +0900 Subject: [PATCH 24/49] =?UTF-8?q?chore:=20sonarcloud=20=EC=BB=A4=EB=B2=84?= =?UTF-8?q?=EB=A6=AC=EC=A7=80=20=EB=A6=AC=ED=8F=AC=ED=8A=B8=20=EC=97=90?= =?UTF-8?q?=EB=9F=AC=20=ED=95=B4=EA=B2=B0=20=EC=8B=9C=EB=8F=84=209?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/sonarcloud.yml | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/.github/workflows/sonarcloud.yml b/.github/workflows/sonarcloud.yml index 81e4164..9bbfe93 100644 --- a/.github/workflows/sonarcloud.yml +++ b/.github/workflows/sonarcloud.yml @@ -30,11 +30,13 @@ jobs: CARGO_INCREMENTAL=0 \ RUSTFLAGS="-Cinstrument-coverage" \ LLVM_PROFILE_FILE="coverage-%p-%m.profraw" \ - cargo test -p morutine-api --verbose + # 모든 크레이트의 테스트 실행 + cargo test --all --verbose - name: Generate Coverage Report (Cobertura XML) run: | - GRCOV_SOURCES="morutine-api/src" + # 💡 모든 크레이트의 소스 경로를 명시적으로 지정 + GRCOV_SOURCES="morutine-api/src morutine-common/src morutine-domain/src morutine-infra/src" grcov . \ --binary-path ./target/debug/ \ @@ -45,6 +47,7 @@ jobs: - name: Fix Cobertura Version for SonarCloud run: | + # 1.9/1.0 버전 충돌 해결 sed -i 's/version="1\.9"/version="1\.0"/g' coverage.xml sed -i 's/version="1\.0"/version="1"/g' coverage.xml From 3bb9af7dc1b5d3de4335341bbca8b1a762d483bb Mon Sep 17 00:00:00 2001 From: zakie Date: Sat, 29 Nov 2025 00:15:10 +0900 Subject: [PATCH 25/49] =?UTF-8?q?chore:=20sonarcloud=20=EC=BB=A4=EB=B2=84?= =?UTF-8?q?=EB=A6=AC=EC=A7=80=20=EB=A6=AC=ED=8F=AC=ED=8A=B8=20=EC=97=90?= =?UTF-8?q?=EB=9F=AC=20=ED=95=B4=EA=B2=B0=20=EC=8B=9C=EB=8F=84=2010?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/sonarcloud.yml | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/.github/workflows/sonarcloud.yml b/.github/workflows/sonarcloud.yml index 9bbfe93..ed64634 100644 --- a/.github/workflows/sonarcloud.yml +++ b/.github/workflows/sonarcloud.yml @@ -29,16 +29,20 @@ jobs: run: | CARGO_INCREMENTAL=0 \ RUSTFLAGS="-Cinstrument-coverage" \ - LLVM_PROFILE_FILE="coverage-%p-%m.profraw" \ - # 모든 크레이트의 테스트 실행 + # profraw 파일을 저장할 디렉토리 생성 + mkdir -p coverage + # profraw 파일의 저장 경로를 명시하여 grcov가 찾을 수 있도록 함 + LLVM_PROFILE_FILE="coverage/coverage-%p-%m.profraw" \ + # 모든 크레이트 테스트 실행 (패키지 이름 오류 방지) cargo test --all --verbose - name: Generate Coverage Report (Cobertura XML) run: | - # 💡 모든 크레이트의 소스 경로를 명시적으로 지정 + # 모든 크레이트의 소스 경로를 명시적으로 지정 (리포트 크기 제어) GRCOV_SOURCES="morutine-api/src morutine-common/src morutine-domain/src morutine-infra/src" - grcov . \ + # grcov에게 profraw 파일이 있는 디렉토리(./coverage/)를 명시적으로 전달 + grcov ./coverage/ \ --binary-path ./target/debug/ \ -s ${GRCOV_SOURCES} \ -t cobertura \ @@ -47,7 +51,7 @@ jobs: - name: Fix Cobertura Version for SonarCloud run: | - # 1.9/1.0 버전 충돌 해결 + # Cobertura XML 버전 충돌 수정 (SonarCloud 호환성 확보) sed -i 's/version="1\.9"/version="1\.0"/g' coverage.xml sed -i 's/version="1\.0"/version="1"/g' coverage.xml @@ -59,6 +63,7 @@ jobs: env: SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + # Clippy 경로 문제 해결 SONAR_SCANNER_OPTS: "-Dsonar.cfamily.clippy.path=/github/home/.cargo/bin" with: args: > From dfe1dd0849a22c7e65bdbd752de63689cee3d1af Mon Sep 17 00:00:00 2001 From: zakie Date: Sat, 29 Nov 2025 00:20:54 +0900 Subject: [PATCH 26/49] =?UTF-8?q?chore:=20sonarcloud=20=EC=BB=A4=EB=B2=84?= =?UTF-8?q?=EB=A6=AC=EC=A7=80=20=EB=A6=AC=ED=8F=AC=ED=8A=B8=20=EC=97=90?= =?UTF-8?q?=EB=9F=AC=20=ED=95=B4=EA=B2=B0=20=EC=8B=9C=EB=8F=84=2011?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/sonarcloud.yml | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/.github/workflows/sonarcloud.yml b/.github/workflows/sonarcloud.yml index ed64634..75b5632 100644 --- a/.github/workflows/sonarcloud.yml +++ b/.github/workflows/sonarcloud.yml @@ -29,20 +29,20 @@ jobs: run: | CARGO_INCREMENTAL=0 \ RUSTFLAGS="-Cinstrument-coverage" \ - # profraw 파일을 저장할 디렉토리 생성 + # .profraw 파일을 저장할 디렉토리 생성 mkdir -p coverage - # profraw 파일의 저장 경로를 명시하여 grcov가 찾을 수 있도록 함 + # profraw 파일을 명시적 디렉토리(coverage/)에 생성하도록 지정 LLVM_PROFILE_FILE="coverage/coverage-%p-%m.profraw" \ - # 모든 크레이트 테스트 실행 (패키지 이름 오류 방지) cargo test --all --verbose - name: Generate Coverage Report (Cobertura XML) run: | - # 모든 크레이트의 소스 경로를 명시적으로 지정 (리포트 크기 제어) GRCOV_SOURCES="morutine-api/src morutine-common/src morutine-domain/src morutine-infra/src" - # grcov에게 profraw 파일이 있는 디렉토리(./coverage/)를 명시적으로 전달 - grcov ./coverage/ \ + # 💡 최종 안정화: find 명령어로 모든 .profraw 파일을 찾은 후 grcov에 목록으로 전달하여 "No input files found" Panic 해결 + PROFRAW_FILES=$(find ./coverage -name "*.profraw") + + grcov ${PROFRAW_FILES} \ --binary-path ./target/debug/ \ -s ${GRCOV_SOURCES} \ -t cobertura \ @@ -51,7 +51,7 @@ jobs: - name: Fix Cobertura Version for SonarCloud run: | - # Cobertura XML 버전 충돌 수정 (SonarCloud 호환성 확보) + # Cobertura XML 버전 충돌 수정 (1.9 -> 1.0 -> 1) sed -i 's/version="1\.9"/version="1\.0"/g' coverage.xml sed -i 's/version="1\.0"/version="1"/g' coverage.xml @@ -63,7 +63,6 @@ jobs: env: SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - # Clippy 경로 문제 해결 SONAR_SCANNER_OPTS: "-Dsonar.cfamily.clippy.path=/github/home/.cargo/bin" with: args: > From 9fb2e28243f34ad5d2c0d6b6a6e4f0201816d492 Mon Sep 17 00:00:00 2001 From: zakie Date: Sat, 29 Nov 2025 02:43:08 +0900 Subject: [PATCH 27/49] =?UTF-8?q?chore:=20sonarcloud=20=EC=BB=A4=EB=B2=84?= =?UTF-8?q?=EB=A6=AC=EC=A7=80=20=EB=A6=AC=ED=8F=AC=ED=8A=B8=20=EC=97=90?= =?UTF-8?q?=EB=9F=AC=20=ED=95=B4=EA=B2=B0=20=EC=8B=9C=EB=8F=84=2012?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/sonarcloud.yml | 42 +++++++++++++------------------- 1 file changed, 17 insertions(+), 25 deletions(-) diff --git a/.github/workflows/sonarcloud.yml b/.github/workflows/sonarcloud.yml index 75b5632..9a0d4f8 100644 --- a/.github/workflows/sonarcloud.yml +++ b/.github/workflows/sonarcloud.yml @@ -25,48 +25,40 @@ jobs: - name: Install grcov run: cargo install grcov --force + - name: Create coverage directory + run: mkdir -p coverage + - name: Run Tests with Coverage Instrumentation - run: | - CARGO_INCREMENTAL=0 \ - RUSTFLAGS="-Cinstrument-coverage" \ - # .profraw 파일을 저장할 디렉토리 생성 - mkdir -p coverage - # profraw 파일을 명시적 디렉토리(coverage/)에 생성하도록 지정 - LLVM_PROFILE_FILE="coverage/coverage-%p-%m.profraw" \ - cargo test --all --verbose + env: + CARGO_INCREMENTAL: 0 + RUSTFLAGS: "-Cinstrument-coverage" + LLVM_PROFILE_FILE: "coverage/coverage-%p-%m.profraw" + run: cargo test --all --verbose - name: Generate Coverage Report (Cobertura XML) run: | - GRCOV_SOURCES="morutine-api/src morutine-common/src morutine-domain/src morutine-infra/src" - - # 💡 최종 안정화: find 명령어로 모든 .profraw 파일을 찾은 후 grcov에 목록으로 전달하여 "No input files found" Panic 해결 - PROFRAW_FILES=$(find ./coverage -name "*.profraw") - - grcov ${PROFRAW_FILES} \ - --binary-path ./target/debug/ \ - -s ${GRCOV_SOURCES} \ + grcov ./coverage \ + --binary-path ./target/debug/deps/ \ + -s . \ -t cobertura \ - --branch --ignore-not-existing \ + --branch \ + --ignore-not-existing \ + --ignore "/*" \ + --ignore "*/tests/*" \ + --ignore "*/examples/*" \ -o coverage.xml - name: Fix Cobertura Version for SonarCloud run: | - # Cobertura XML 버전 충돌 수정 (1.9 -> 1.0 -> 1) - sed -i 's/version="1\.9"/version="1\.0"/g' coverage.xml - sed -i 's/version="1\.0"/version="1"/g' coverage.xml - - - name: Set up Runner PATH - run: echo "$HOME/.cargo/bin" >> $GITHUB_PATH + sed -i 's/version="[0-9.]*"/version="1"/g' coverage.xml - name: SonarCloud Scan uses: SonarSource/sonarcloud-github-action@v2 env: SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - SONAR_SCANNER_OPTS: "-Dsonar.cfamily.clippy.path=/github/home/.cargo/bin" with: args: > -Dsonar.projectKey=MORUTINE_backend -Dsonar.organization=morutine - -Dsonar.projectBaseDir=. -Dsonar.coverageReportPaths=coverage.xml \ No newline at end of file From bda52a79c043fb78997b1102cdbd7621277ca22a Mon Sep 17 00:00:00 2001 From: zakie Date: Sat, 29 Nov 2025 02:51:00 +0900 Subject: [PATCH 28/49] =?UTF-8?q?chore:=20sonarcloud=20=EC=BB=A4=EB=B2=84?= =?UTF-8?q?=EB=A6=AC=EC=A7=80=20=EB=A6=AC=ED=8F=AC=ED=8A=B8=20=EC=97=90?= =?UTF-8?q?=EB=9F=AC=20=ED=95=B4=EA=B2=B0=20=EC=8B=9C=EB=8F=84=2013?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/sonarcloud.yml | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/.github/workflows/sonarcloud.yml b/.github/workflows/sonarcloud.yml index 9a0d4f8..0dadc54 100644 --- a/.github/workflows/sonarcloud.yml +++ b/.github/workflows/sonarcloud.yml @@ -48,9 +48,13 @@ jobs: --ignore "*/examples/*" \ -o coverage.xml - - name: Fix Cobertura Version for SonarCloud + - name: Fix Cobertura XML format run: | - sed -i 's/version="[0-9.]*"/version="1"/g' coverage.xml + sed -i 's///' coverage.xml + sed -i 's/version="[0-9.]*"/version="4.0"/g' coverage.xml + + - name: Delete profraw files before SonarCloud scan + run: rm -rf ./coverage/*.profraw - name: SonarCloud Scan uses: SonarSource/sonarcloud-github-action@v2 From 1413615160e1542d13bab7dbe4c05dc9b770d99b Mon Sep 17 00:00:00 2001 From: zakie Date: Sat, 29 Nov 2025 02:59:27 +0900 Subject: [PATCH 29/49] =?UTF-8?q?chore:=20sonarcloud=20=EC=BB=A4=EB=B2=84?= =?UTF-8?q?=EB=A6=AC=EC=A7=80=20=EB=A6=AC=ED=8F=AC=ED=8A=B8=20=EC=97=90?= =?UTF-8?q?=EB=9F=AC=20=ED=95=B4=EA=B2=B0=20=EC=8B=9C=EB=8F=84=2014=20-=20?= =?UTF-8?q?xml=20=ED=99=95=EC=9D=B8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/sonarcloud.yml | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/.github/workflows/sonarcloud.yml b/.github/workflows/sonarcloud.yml index 0dadc54..80a7fd5 100644 --- a/.github/workflows/sonarcloud.yml +++ b/.github/workflows/sonarcloud.yml @@ -53,8 +53,18 @@ jobs: sed -i 's///' coverage.xml sed -i 's/version="[0-9.]*"/version="4.0"/g' coverage.xml - - name: Delete profraw files before SonarCloud scan - run: rm -rf ./coverage/*.profraw + - name: Verify coverage.xml exists and show content + run: | + if [ -f coverage.xml ]; then + echo "coverage.xml found" + head -20 coverage.xml + else + echo "ERROR: coverage.xml not found!" + exit 1 + fi + + - name: Delete all profraw files before SonarCloud scan + run: find . -name "*.profraw" -type f -delete - name: SonarCloud Scan uses: SonarSource/sonarcloud-github-action@v2 From 3aaca29bc333f75902e126fa686117ffcced2659 Mon Sep 17 00:00:00 2001 From: zakie Date: Sat, 29 Nov 2025 03:10:56 +0900 Subject: [PATCH 30/49] =?UTF-8?q?chore:=20sonarcloud=20=EC=BB=A4=EB=B2=84?= =?UTF-8?q?=EB=A6=AC=EC=A7=80=20=EB=A6=AC=ED=8F=AC=ED=8A=B8=20=EC=97=90?= =?UTF-8?q?=EB=9F=AC=20=ED=95=B4=EA=B2=B0=20=EC=8B=9C=EB=8F=84=2015=20-=20?= =?UTF-8?q?xml=20=ED=8F=AC=EB=A7=B7=20=EB=B3=80=EA=B2=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/sonarcloud.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/sonarcloud.yml b/.github/workflows/sonarcloud.yml index 80a7fd5..c7063f9 100644 --- a/.github/workflows/sonarcloud.yml +++ b/.github/workflows/sonarcloud.yml @@ -50,7 +50,7 @@ jobs: - name: Fix Cobertura XML format run: | - sed -i 's///' coverage.xml + sed -i '/<\!DOCTYPE/d' coverage.xml sed -i 's/version="[0-9.]*"/version="4.0"/g' coverage.xml - name: Verify coverage.xml exists and show content From f4c47f5a0b9254782a73ddacacdf1dd0645d653b Mon Sep 17 00:00:00 2001 From: zakie Date: Sat, 29 Nov 2025 03:16:23 +0900 Subject: [PATCH 31/49] =?UTF-8?q?chore:=20sonarcloud=20=EC=BB=A4=EB=B2=84?= =?UTF-8?q?=EB=A6=AC=EC=A7=80=20=EB=A6=AC=ED=8F=AC=ED=8A=B8=20=EC=97=90?= =?UTF-8?q?=EB=9F=AC=20=ED=95=B4=EA=B2=B0=20=EC=8B=9C=EB=8F=84=2016=20-=20?= =?UTF-8?q?xml=20=ED=8F=AC=EB=A7=B7=20=EB=B3=80=EA=B2=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/sonarcloud.yml | 30 +++++++++++++++++++++++++++--- 1 file changed, 27 insertions(+), 3 deletions(-) diff --git a/.github/workflows/sonarcloud.yml b/.github/workflows/sonarcloud.yml index c7063f9..e53ab35 100644 --- a/.github/workflows/sonarcloud.yml +++ b/.github/workflows/sonarcloud.yml @@ -50,19 +50,43 @@ jobs: - name: Fix Cobertura XML format run: | + # DOCTYPE 제거 sed -i '/<\!DOCTYPE/d' coverage.xml + # XML 버전을 4.0으로 고정 sed -i 's/version="[0-9.]*"/version="4.0"/g' coverage.xml + # XML 선언과 루트 태그 사이에 줄바꿈이 없는 경우 수정 + sed -i 's/\?>[ ]*\n coverage_fixed.xml || { + echo "XML validation failed, trying to fix..." + # XML이 유효하지 않은 경우 강제로 수정 + cat coverage.xml | grep -v ' coverage_fixed.xml + } + mv coverage_fixed.xml coverage.xml + + echo "=== Final coverage.xml (first 30 lines) ===" + head -30 coverage.xml + - name: Delete all profraw files before SonarCloud scan run: find . -name "*.profraw" -type f -delete From 35286600dbc05bb503fdc9bf476c130250034a97 Mon Sep 17 00:00:00 2001 From: zakie Date: Sat, 29 Nov 2025 03:22:36 +0900 Subject: [PATCH 32/49] =?UTF-8?q?chore:=20sonarcloud=20=EC=BB=A4=EB=B2=84?= =?UTF-8?q?=EB=A6=AC=EC=A7=80=20=EB=A6=AC=ED=8F=AC=ED=8A=B8=20=EC=97=90?= =?UTF-8?q?=EB=9F=AC=20=ED=95=B4=EA=B2=B0=20=EC=8B=9C=EB=8F=84=2017=20-=20?= =?UTF-8?q?xml=20=ED=8F=AC=EB=A7=B7=20=EB=B3=80=EA=B2=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/sonarcloud.yml | 62 ++++++++++++++++---------------- 1 file changed, 31 insertions(+), 31 deletions(-) diff --git a/.github/workflows/sonarcloud.yml b/.github/workflows/sonarcloud.yml index e53ab35..9c7218d 100644 --- a/.github/workflows/sonarcloud.yml +++ b/.github/workflows/sonarcloud.yml @@ -35,8 +35,15 @@ jobs: LLVM_PROFILE_FILE: "coverage/coverage-%p-%m.profraw" run: cargo test --all --verbose + - name: Check profraw files + run: | + echo "=== Checking profraw files ===" + ls -lah coverage/ + find ./coverage -name "*.profraw" -type f + - name: Generate Coverage Report (Cobertura XML) run: | + echo "=== Running grcov ===" grcov ./coverage \ --binary-path ./target/debug/deps/ \ -s . \ @@ -47,6 +54,28 @@ jobs: --ignore "*/tests/*" \ --ignore "*/examples/*" \ -o coverage.xml + + echo "=== grcov completed ===" + ls -lah coverage.xml + + - name: Verify coverage.xml was generated + run: | + if [ ! -f coverage.xml ]; then + echo "ERROR: coverage.xml was not created by grcov!" + exit 1 + fi + + FILE_SIZE=$(stat -c%s coverage.xml) + echo "coverage.xml size: $FILE_SIZE bytes" + + if [ $FILE_SIZE -eq 0 ]; then + echo "ERROR: coverage.xml is empty!" + echo "Checking for errors in grcov execution..." + exit 1 + fi + + echo "=== First 30 lines of coverage.xml ===" + head -30 coverage.xml - name: Fix Cobertura XML format run: | @@ -54,38 +83,9 @@ jobs: sed -i '/<\!DOCTYPE/d' coverage.xml # XML 버전을 4.0으로 고정 sed -i 's/version="[0-9.]*"/version="4.0"/g' coverage.xml - # XML 선언과 루트 태그 사이에 줄바꿈이 없는 경우 수정 - sed -i 's/\?>[ ]*\n coverage_fixed.xml || { - echo "XML validation failed, trying to fix..." - # XML이 유효하지 않은 경우 강제로 수정 - cat coverage.xml | grep -v ' coverage_fixed.xml - } - mv coverage_fixed.xml coverage.xml - echo "=== Final coverage.xml (first 30 lines) ===" - head -30 coverage.xml + echo "=== After fixing (first 20 lines) ===" + head -20 coverage.xml - name: Delete all profraw files before SonarCloud scan run: find . -name "*.profraw" -type f -delete From 1e71333e140528cb0460ea770db13a7899d1ff1e Mon Sep 17 00:00:00 2001 From: zakie Date: Sat, 29 Nov 2025 03:27:17 +0900 Subject: [PATCH 33/49] =?UTF-8?q?chore:=20sonarcloud=20=EC=BB=A4=EB=B2=84?= =?UTF-8?q?=EB=A6=AC=EC=A7=80=20=EB=A6=AC=ED=8F=AC=ED=8A=B8=20=EC=97=90?= =?UTF-8?q?=EB=9F=AC=20=ED=95=B4=EA=B2=B0=20=EC=8B=9C=EB=8F=84=2018=20-=20?= =?UTF-8?q?xml=20=EB=B2=84=EC=A0=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/sonarcloud.yml | 38 ++------------------------------ 1 file changed, 2 insertions(+), 36 deletions(-) diff --git a/.github/workflows/sonarcloud.yml b/.github/workflows/sonarcloud.yml index 9c7218d..1a96ef9 100644 --- a/.github/workflows/sonarcloud.yml +++ b/.github/workflows/sonarcloud.yml @@ -35,15 +35,8 @@ jobs: LLVM_PROFILE_FILE: "coverage/coverage-%p-%m.profraw" run: cargo test --all --verbose - - name: Check profraw files - run: | - echo "=== Checking profraw files ===" - ls -lah coverage/ - find ./coverage -name "*.profraw" -type f - - name: Generate Coverage Report (Cobertura XML) run: | - echo "=== Running grcov ===" grcov ./coverage \ --binary-path ./target/debug/deps/ \ -s . \ @@ -54,38 +47,11 @@ jobs: --ignore "*/tests/*" \ --ignore "*/examples/*" \ -o coverage.xml - - echo "=== grcov completed ===" - ls -lah coverage.xml - - - name: Verify coverage.xml was generated - run: | - if [ ! -f coverage.xml ]; then - echo "ERROR: coverage.xml was not created by grcov!" - exit 1 - fi - - FILE_SIZE=$(stat -c%s coverage.xml) - echo "coverage.xml size: $FILE_SIZE bytes" - - if [ $FILE_SIZE -eq 0 ]; then - echo "ERROR: coverage.xml is empty!" - echo "Checking for errors in grcov execution..." - exit 1 - fi - - echo "=== First 30 lines of coverage.xml ===" - head -30 coverage.xml - name: Fix Cobertura XML format run: | - # DOCTYPE 제거 - sed -i '/<\!DOCTYPE/d' coverage.xml - # XML 버전을 4.0으로 고정 - sed -i 's/version="[0-9.]*"/version="4.0"/g' coverage.xml - - echo "=== After fixing (first 20 lines) ===" - head -20 coverage.xml + # DOCTYPE만 제거 (XML 버전은 건드리지 않음!) + sed -i 's///' coverage.xml - name: Delete all profraw files before SonarCloud scan run: find . -name "*.profraw" -type f -delete From a35f6dfc14e4c041bb0636e2d27381f098271a60 Mon Sep 17 00:00:00 2001 From: zakie Date: Sat, 29 Nov 2025 03:32:39 +0900 Subject: [PATCH 34/49] =?UTF-8?q?chore:=20sonarcloud=20=EC=BB=A4=EB=B2=84?= =?UTF-8?q?=EB=A6=AC=EC=A7=80=20=EB=A6=AC=ED=8F=AC=ED=8A=B8=20=EC=97=90?= =?UTF-8?q?=EB=9F=AC=20=ED=95=B4=EA=B2=B0=20=EC=8B=9C=EB=8F=84=2019=20-=20?= =?UTF-8?q?xml=20=EB=B2=84=EC=A0=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/sonarcloud.yml | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/.github/workflows/sonarcloud.yml b/.github/workflows/sonarcloud.yml index 1a96ef9..9f1c9a4 100644 --- a/.github/workflows/sonarcloud.yml +++ b/.github/workflows/sonarcloud.yml @@ -50,8 +50,10 @@ jobs: - name: Fix Cobertura XML format run: | - # DOCTYPE만 제거 (XML 버전은 건드리지 않음!) + # DOCTYPE 제거 sed -i 's///' coverage.xml + # version="1.9"를 version="1.0"으로 변경 + sed -i 's/version="1\.9"/version="1.0"/' coverage.xml - name: Delete all profraw files before SonarCloud scan run: find . -name "*.profraw" -type f -delete From dd92e47c3caa24251189e4dde9b31cf30fa2dc28 Mon Sep 17 00:00:00 2001 From: zakie Date: Sat, 29 Nov 2025 03:37:04 +0900 Subject: [PATCH 35/49] =?UTF-8?q?chore:=20sonarcloud=20=EC=BB=A4=EB=B2=84?= =?UTF-8?q?=EB=A6=AC=EC=A7=80=20=EB=A6=AC=ED=8F=AC=ED=8A=B8=20=EC=97=90?= =?UTF-8?q?=EB=9F=AC=20=ED=95=B4=EA=B2=B0=20=EC=8B=9C=EB=8F=84=2020=20-=20?= =?UTF-8?q?xml=20=EB=B2=84=EC=A0=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/sonarcloud.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/sonarcloud.yml b/.github/workflows/sonarcloud.yml index 9f1c9a4..7cb81cb 100644 --- a/.github/workflows/sonarcloud.yml +++ b/.github/workflows/sonarcloud.yml @@ -52,8 +52,8 @@ jobs: run: | # DOCTYPE 제거 sed -i 's///' coverage.xml - # version="1.9"를 version="1.0"으로 변경 - sed -i 's/version="1\.9"/version="1.0"/' coverage.xml + # coverage 태그의 version 속성을 "1"로 변경 + sed -i 's/ Date: Sat, 29 Nov 2025 03:40:54 +0900 Subject: [PATCH 36/49] =?UTF-8?q?chore:=20sonarcloud=20=EC=BB=A4=EB=B2=84?= =?UTF-8?q?=EB=A6=AC=EC=A7=80=20=EB=A6=AC=ED=8F=AC=ED=8A=B8=20=EC=97=90?= =?UTF-8?q?=EB=9F=AC=20=ED=95=B4=EA=B2=B0=20=EC=8B=9C=EB=8F=84=2021=20-=20?= =?UTF-8?q?xml=20=EB=B2=84=EC=A0=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/sonarcloud.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/sonarcloud.yml b/.github/workflows/sonarcloud.yml index 7cb81cb..b72655e 100644 --- a/.github/workflows/sonarcloud.yml +++ b/.github/workflows/sonarcloud.yml @@ -52,8 +52,8 @@ jobs: run: | # DOCTYPE 제거 sed -i 's///' coverage.xml - # coverage 태그의 version 속성을 "1"로 변경 - sed -i 's/ Date: Sat, 29 Nov 2025 03:47:02 +0900 Subject: [PATCH 37/49] =?UTF-8?q?chore:=20sonarcloud=20=EC=BB=A4=EB=B2=84?= =?UTF-8?q?=EB=A6=AC=EC=A7=80=20=EB=A6=AC=ED=8F=AC=ED=8A=B8=20=EC=97=90?= =?UTF-8?q?=EB=9F=AC=20=ED=95=B4=EA=B2=B0=20=EC=8B=9C=EB=8F=84=2022=20-=20?= =?UTF-8?q?xml=ED=8C=8C=EC=9D=BC=20=EB=82=B4=20=ED=83=9C=EA=B7=B8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/sonarcloud.yml | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/.github/workflows/sonarcloud.yml b/.github/workflows/sonarcloud.yml index b72655e..0e47aeb 100644 --- a/.github/workflows/sonarcloud.yml +++ b/.github/workflows/sonarcloud.yml @@ -50,19 +50,27 @@ jobs: - name: Fix Cobertura XML format run: | - # DOCTYPE 제거 + # 1. DOCTYPE 제거 (이전 오류 해결) sed -i 's///' coverage.xml - # version 속성 값만 변경 (속성 이름은 유지) + # 💡 2. 태그 제거 (최종 오류 해결) + sed -i '//,/\/sources>/d' coverage.xml + # 3. version 속성 값 변경 (1.9 -> 1 치환) sed -i 's/version="1\.9"/version="1"/' coverage.xml - name: Delete all profraw files before SonarCloud scan run: find . -name "*.profraw" -type f -delete + # 💡 Clippy/Cargo PATH 복구: 이전 워크플로우에서 누락되었던 필수 스텝 + - name: Set up Runner PATH (for SonarCloud) + run: echo "$HOME/.cargo/bin" >> $GITHUB_PATH + - name: SonarCloud Scan uses: SonarSource/sonarcloud-github-action@v2 env: SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + # Clippy/Cargo PATH 문제 해결을 위해 SonarScanner에게 PATH를 전달 + PATH: ${{ env.PATH }}:${{ steps.install_rust.outputs.toolchain_path }}/bin with: args: > -Dsonar.projectKey=MORUTINE_backend From 2dfc19cf99b794c07997e40c22c6687ef3df0259 Mon Sep 17 00:00:00 2001 From: zakie Date: Sat, 29 Nov 2025 03:54:18 +0900 Subject: [PATCH 38/49] =?UTF-8?q?chore:=20sonarcloud=20=EC=BB=A4=EB=B2=84?= =?UTF-8?q?=EB=A6=AC=EC=A7=80=20=EB=A6=AC=ED=8F=AC=ED=8A=B8=20=EC=97=90?= =?UTF-8?q?=EB=9F=AC=20=ED=95=B4=EA=B2=B0=20=EC=8B=9C=EB=8F=84=2023=20-=20?= =?UTF-8?q?xml=ED=8C=8C=EC=9D=BC=20=EB=82=B4=20=ED=83=9C=EA=B7=B8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/sonarcloud.yml | 42 ++++++++++++-------------------- 1 file changed, 16 insertions(+), 26 deletions(-) diff --git a/.github/workflows/sonarcloud.yml b/.github/workflows/sonarcloud.yml index 0e47aeb..6e485ea 100644 --- a/.github/workflows/sonarcloud.yml +++ b/.github/workflows/sonarcloud.yml @@ -29,48 +29,38 @@ jobs: run: mkdir -p coverage - name: Run Tests with Coverage Instrumentation - env: - CARGO_INCREMENTAL: 0 - RUSTFLAGS: "-Cinstrument-coverage" - LLVM_PROFILE_FILE: "coverage/coverage-%p-%m.profraw" - run: cargo test --all --verbose + run: | + CARGO_INCREMENTAL=0 \ + RUSTFLAGS="-Cinstrument-coverage" \ + LLVM_PROFILE_FILE="coverage/coverage-%p-%m.profraw" + cargo test --all --verbose - name: Generate Coverage Report (Cobertura XML) run: | - grcov ./coverage \ - --binary-path ./target/debug/deps/ \ - -s . \ + GRCOV_SOURCES="morutine-api/src morutine-common/src morutine-domain/src morutine-infra/src" + + PROFRAW_FILES=$(find ./coverage -name "*.profraw") + + grcov ${PROFRAW_FILES} \ + --binary-path ./target/debug/ \ + -s ${GRCOV_SOURCES} \ -t cobertura \ - --branch \ - --ignore-not-existing \ - --ignore "/*" \ - --ignore "*/tests/*" \ - --ignore "*/examples/*" \ + --branch --ignore-not-existing \ -o coverage.xml - name: Fix Cobertura XML format run: | - # 1. DOCTYPE 제거 (이전 오류 해결) sed -i 's///' coverage.xml - # 💡 2. 태그 제거 (최종 오류 해결) + sed -i 's/version="1\.9"/version="1\.0"/g' coverage.xml + sed -i 's/version="1\.0"/version="1"/' coverage.xml sed -i '//,/\/sources>/d' coverage.xml - # 3. version 속성 값 변경 (1.9 -> 1 치환) - sed -i 's/version="1\.9"/version="1"/' coverage.xml - - - name: Delete all profraw files before SonarCloud scan - run: find . -name "*.profraw" -type f -delete - - # 💡 Clippy/Cargo PATH 복구: 이전 워크플로우에서 누락되었던 필수 스텝 - - name: Set up Runner PATH (for SonarCloud) - run: echo "$HOME/.cargo/bin" >> $GITHUB_PATH - name: SonarCloud Scan uses: SonarSource/sonarcloud-github-action@v2 env: SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - # Clippy/Cargo PATH 문제 해결을 위해 SonarScanner에게 PATH를 전달 - PATH: ${{ env.PATH }}:${{ steps.install_rust.outputs.toolchain_path }}/bin + SONAR_SCANNER_OPTS: "-Dsonar.cfamily.clippy.path=/github/home/.cargo/bin" with: args: > -Dsonar.projectKey=MORUTINE_backend From 3a6dd0d3974ce66d06e5b8c5631079db82f919eb Mon Sep 17 00:00:00 2001 From: zakie Date: Sat, 29 Nov 2025 03:59:43 +0900 Subject: [PATCH 39/49] =?UTF-8?q?chore:=20sonarcloud=20=EC=BB=A4=EB=B2=84?= =?UTF-8?q?=EB=A6=AC=EC=A7=80=20=EB=A6=AC=ED=8F=AC=ED=8A=B8=20=EC=97=90?= =?UTF-8?q?=EB=9F=AC=20=ED=95=B4=EA=B2=B0=20=EC=8B=9C=EB=8F=84=2024=20-=20?= =?UTF-8?q?xml=ED=8C=8C=EC=9D=BC=20=EB=82=B4=20=ED=83=9C=EA=B7=B8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/sonarcloud.yml | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/.github/workflows/sonarcloud.yml b/.github/workflows/sonarcloud.yml index 6e485ea..22e34ae 100644 --- a/.github/workflows/sonarcloud.yml +++ b/.github/workflows/sonarcloud.yml @@ -25,23 +25,18 @@ jobs: - name: Install grcov run: cargo install grcov --force - - name: Create coverage directory - run: mkdir -p coverage - - name: Run Tests with Coverage Instrumentation run: | CARGO_INCREMENTAL=0 \ RUSTFLAGS="-Cinstrument-coverage" \ - LLVM_PROFILE_FILE="coverage/coverage-%p-%m.profraw" cargo test --all --verbose - name: Generate Coverage Report (Cobertura XML) run: | GRCOV_SOURCES="morutine-api/src morutine-common/src morutine-domain/src morutine-infra/src" - PROFRAW_FILES=$(find ./coverage -name "*.profraw") - - grcov ${PROFRAW_FILES} \ + find . -name "*.profraw" -print0 \ + | xargs -0 grcov \ --binary-path ./target/debug/ \ -s ${GRCOV_SOURCES} \ -t cobertura \ @@ -50,11 +45,15 @@ jobs: - name: Fix Cobertura XML format run: | + # XML 포맷 수정 (버전 충돌 및 태그 오류 해결) sed -i 's///' coverage.xml sed -i 's/version="1\.9"/version="1\.0"/g' coverage.xml sed -i 's/version="1\.0"/version="1"/' coverage.xml sed -i '//,/\/sources>/d' coverage.xml + - name: Set up Runner PATH + run: echo "$HOME/.cargo/bin" >> $GITHUB_PATH + - name: SonarCloud Scan uses: SonarSource/sonarcloud-github-action@v2 env: From 83e960ae403591931cd67f2672b35da232f98328 Mon Sep 17 00:00:00 2001 From: zakie Date: Sat, 29 Nov 2025 04:04:58 +0900 Subject: [PATCH 40/49] =?UTF-8?q?chore:=20sonarcloud=20=EC=BB=A4=EB=B2=84?= =?UTF-8?q?=EB=A6=AC=EC=A7=80=20=EB=A6=AC=ED=8F=AC=ED=8A=B8=20=EC=97=90?= =?UTF-8?q?=EB=9F=AC=20=ED=95=B4=EA=B2=B0=20=EC=8B=9C=EB=8F=84=2025=20-=20?= =?UTF-8?q?xml=ED=8C=8C=EC=9D=BC=20=EB=82=B4=20=ED=83=9C=EA=B7=B8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/sonarcloud.yml | 42 ++++++++++++++++++++++---------- 1 file changed, 29 insertions(+), 13 deletions(-) diff --git a/.github/workflows/sonarcloud.yml b/.github/workflows/sonarcloud.yml index 22e34ae..3ecf372 100644 --- a/.github/workflows/sonarcloud.yml +++ b/.github/workflows/sonarcloud.yml @@ -25,32 +25,48 @@ jobs: - name: Install grcov run: cargo install grcov --force + - name: Create coverage directory + run: mkdir -p coverage + - name: Run Tests with Coverage Instrumentation - run: | - CARGO_INCREMENTAL=0 \ - RUSTFLAGS="-Cinstrument-coverage" \ - cargo test --all --verbose + env: + CARGO_INCREMENTAL: 0 + RUSTFLAGS: "-Cinstrument-coverage" + LLVM_PROFILE_FILE: "coverage/coverage-%p-%m.profraw" + run: cargo test --all --verbose - name: Generate Coverage Report (Cobertura XML) run: | - GRCOV_SOURCES="morutine-api/src morutine-common/src morutine-domain/src morutine-infra/src" - - find . -name "*.profraw" -print0 \ - | xargs -0 grcov \ - --binary-path ./target/debug/ \ - -s ${GRCOV_SOURCES} \ + grcov ./coverage \ + --binary-path ./target/debug/deps/ \ + -s . \ -t cobertura \ - --branch --ignore-not-existing \ + --branch \ + --ignore-not-existing \ + --ignore "/*" \ + --ignore "*/tests/*" \ + --ignore "*/examples/*" \ -o coverage.xml - name: Fix Cobertura XML format run: | - # XML 포맷 수정 (버전 충돌 및 태그 오류 해결) + # 모든 수정 명령을 실행 sed -i 's///' coverage.xml sed -i 's/version="1\.9"/version="1\.0"/g' coverage.xml sed -i 's/version="1\.0"/version="1"/' coverage.xml sed -i '//,/\/sources>/d' coverage.xml + # 💡 디버깅 스텝 추가: 수정된 파일의 앞부분 10줄 출력 + - name: Check Final XML Format + run: | + echo "--- CHECKING FINAL XML HEADER ---" + head -n 10 coverage.xml + echo "-----------------------------------" + + - name: Delete all profraw files before SonarCloud scan + run: find . -name "*.profraw" -type f -delete + + # 💡 Clippy/Cargo PATH 문제 해결을 위해 SONAR_SCANNER_OPTS 복구 - name: Set up Runner PATH run: echo "$HOME/.cargo/bin" >> $GITHUB_PATH @@ -64,4 +80,4 @@ jobs: args: > -Dsonar.projectKey=MORUTINE_backend -Dsonar.organization=morutine - -Dsonar.coverageReportPaths=coverage.xml \ No newline at end of file + -Dsonar.coverageReportPaths=coverage.xml From 0eeb9c33f54d59bf957e60651c2e87dba23ee707 Mon Sep 17 00:00:00 2001 From: zakie Date: Sat, 29 Nov 2025 04:07:22 +0900 Subject: [PATCH 41/49] =?UTF-8?q?chore:=20sonarcloud=20=EC=BB=A4=EB=B2=84?= =?UTF-8?q?=EB=A6=AC=EC=A7=80=20=EB=A6=AC=ED=8F=AC=ED=8A=B8=20=EC=97=90?= =?UTF-8?q?=EB=9F=AC=20=ED=95=B4=EA=B2=B0=20=EC=8B=9C=EB=8F=84=2026=20-=20?= =?UTF-8?q?xml=ED=8C=8C=EC=9D=BC=20=EB=82=B4=20=ED=83=9C=EA=B7=B8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/sonarcloud.yml | 42 ++++++++++++-------------------- 1 file changed, 16 insertions(+), 26 deletions(-) diff --git a/.github/workflows/sonarcloud.yml b/.github/workflows/sonarcloud.yml index 3ecf372..884ae00 100644 --- a/.github/workflows/sonarcloud.yml +++ b/.github/workflows/sonarcloud.yml @@ -29,44 +29,34 @@ jobs: run: mkdir -p coverage - name: Run Tests with Coverage Instrumentation - env: - CARGO_INCREMENTAL: 0 - RUSTFLAGS: "-Cinstrument-coverage" - LLVM_PROFILE_FILE: "coverage/coverage-%p-%m.profraw" - run: cargo test --all --verbose + run: | + CARGO_INCREMENTAL=0 \ + RUSTFLAGS="-Cinstrument-coverage" \ + LLVM_PROFILE_FILE="coverage/coverage-%p-%m.profraw" + cargo test --all --verbose - name: Generate Coverage Report (Cobertura XML) run: | - grcov ./coverage \ - --binary-path ./target/debug/deps/ \ - -s . \ + GRCOV_SOURCES="morutine-api/src morutine-common/src morutine-domain/src morutine-infra/src" + + # 💡 최종 수정: Panic 오류 해결을 위해 find 명령으로 파일 목록을 전달합니다. + PROFRAW_FILES=$(find ./coverage -name "*.profraw") + + grcov ${PROFRAW_FILES} \ + --binary-path ./target/debug/ \ + -s ${GRCOV_SOURCES} \ -t cobertura \ - --branch \ - --ignore-not-existing \ - --ignore "/*" \ - --ignore "*/tests/*" \ - --ignore "*/examples/*" \ + --branch --ignore-not-existing \ -o coverage.xml - name: Fix Cobertura XML format run: | - # 모든 수정 명령을 실행 + # XML 포맷 수정 (DOCTYPE, , 버전 충돌 해결) sed -i 's///' coverage.xml sed -i 's/version="1\.9"/version="1\.0"/g' coverage.xml sed -i 's/version="1\.0"/version="1"/' coverage.xml sed -i '//,/\/sources>/d' coverage.xml - # 💡 디버깅 스텝 추가: 수정된 파일의 앞부분 10줄 출력 - - name: Check Final XML Format - run: | - echo "--- CHECKING FINAL XML HEADER ---" - head -n 10 coverage.xml - echo "-----------------------------------" - - - name: Delete all profraw files before SonarCloud scan - run: find . -name "*.profraw" -type f -delete - - # 💡 Clippy/Cargo PATH 문제 해결을 위해 SONAR_SCANNER_OPTS 복구 - name: Set up Runner PATH run: echo "$HOME/.cargo/bin" >> $GITHUB_PATH @@ -80,4 +70,4 @@ jobs: args: > -Dsonar.projectKey=MORUTINE_backend -Dsonar.organization=morutine - -Dsonar.coverageReportPaths=coverage.xml + -Dsonar.coverageReportPaths=coverage.xml \ No newline at end of file From 3893284706e09c456da331c1d00f5a3ec7622d01 Mon Sep 17 00:00:00 2001 From: zakie Date: Sat, 29 Nov 2025 04:17:14 +0900 Subject: [PATCH 42/49] =?UTF-8?q?chore:=20sonarcloud=20=EC=BB=A4=EB=B2=84?= =?UTF-8?q?=EB=A6=AC=EC=A7=80=20=EB=A6=AC=ED=8F=AC=ED=8A=B8=20=EC=97=90?= =?UTF-8?q?=EB=9F=AC=20=ED=95=B4=EA=B2=B0=20=EC=8B=9C=EB=8F=84=2027=20-=20?= =?UTF-8?q?xml=ED=8C=8C=EC=9D=BC=20=EB=82=B4=20=ED=83=9C=EA=B7=B8(gemi)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/sonarcloud.yml | 18 ++++++++---------- 1 file changed, 8 insertions(+), 10 deletions(-) diff --git a/.github/workflows/sonarcloud.yml b/.github/workflows/sonarcloud.yml index 884ae00..bc46e25 100644 --- a/.github/workflows/sonarcloud.yml +++ b/.github/workflows/sonarcloud.yml @@ -25,25 +25,23 @@ jobs: - name: Install grcov run: cargo install grcov --force - - name: Create coverage directory - run: mkdir -p coverage - - name: Run Tests with Coverage Instrumentation run: | CARGO_INCREMENTAL=0 \ RUSTFLAGS="-Cinstrument-coverage" \ - LLVM_PROFILE_FILE="coverage/coverage-%p-%m.profraw" + # 💡 최종 수정 1: .profraw 파일을 워크스페이스 루트에 기본값으로 생성 + LLVM_PROFILE_FILE="default.profraw" + # 기존의 .profraw 파일을 삭제하여 오류 방지 + rm -f default*.profraw cargo test --all --verbose - name: Generate Coverage Report (Cobertura XML) run: | GRCOV_SOURCES="morutine-api/src morutine-common/src morutine-domain/src morutine-infra/src" - # 💡 최종 수정: Panic 오류 해결을 위해 find 명령으로 파일 목록을 전달합니다. - PROFRAW_FILES=$(find ./coverage -name "*.profraw") - - grcov ${PROFRAW_FILES} \ - --binary-path ./target/debug/ \ + # 💡 최종 수정 2: grcov에게 워크스페이스 루트(.)를 검색하도록 위임 (가장 기본적인 LLVM 방식) + grcov . \ + --binary-path ./target/debug/ \ -s ${GRCOV_SOURCES} \ -t cobertura \ --branch --ignore-not-existing \ @@ -51,7 +49,7 @@ jobs: - name: Fix Cobertura XML format run: | - # XML 포맷 수정 (DOCTYPE, , 버전 충돌 해결) + # XML 포맷 수정 (버전 충돌 및 태그 오류 해결) sed -i 's///' coverage.xml sed -i 's/version="1\.9"/version="1\.0"/g' coverage.xml sed -i 's/version="1\.0"/version="1"/' coverage.xml From 7470b2df39404d8ee205ed80fe969462f8c4ab48 Mon Sep 17 00:00:00 2001 From: zakie Date: Sat, 29 Nov 2025 04:17:49 +0900 Subject: [PATCH 43/49] =?UTF-8?q?chore:=20sonarcloud=20=EC=BB=A4=EB=B2=84?= =?UTF-8?q?=EB=A6=AC=EC=A7=80=20=EB=A6=AC=ED=8F=AC=ED=8A=B8=20=EC=97=90?= =?UTF-8?q?=EB=9F=AC=20=ED=95=B4=EA=B2=B0=20=EC=8B=9C=EB=8F=84=2028=20-=20?= =?UTF-8?q?xml=ED=8C=8C=EC=9D=BC=20=EB=82=B4=20=ED=83=9C=EA=B7=B8(claud)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/sonarcloud.yml | 36 ++++++++++++++------------------ 1 file changed, 16 insertions(+), 20 deletions(-) diff --git a/.github/workflows/sonarcloud.yml b/.github/workflows/sonarcloud.yml index bc46e25..2b35714 100644 --- a/.github/workflows/sonarcloud.yml +++ b/.github/workflows/sonarcloud.yml @@ -26,44 +26,40 @@ jobs: run: cargo install grcov --force - name: Run Tests with Coverage Instrumentation + env: + CARGO_INCREMENTAL: "0" + RUSTFLAGS: "-Cinstrument-coverage" + LLVM_PROFILE_FILE: "default.profraw" run: | - CARGO_INCREMENTAL=0 \ - RUSTFLAGS="-Cinstrument-coverage" \ - # 💡 최종 수정 1: .profraw 파일을 워크스페이스 루트에 기본값으로 생성 - LLVM_PROFILE_FILE="default.profraw" - # 기존의 .profraw 파일을 삭제하여 오류 방지 rm -f default*.profraw cargo test --all --verbose - name: Generate Coverage Report (Cobertura XML) run: | - GRCOV_SOURCES="morutine-api/src morutine-common/src morutine-domain/src morutine-infra/src" - - # 💡 최종 수정 2: grcov에게 워크스페이스 루트(.)를 검색하도록 위임 (가장 기본적인 LLVM 방식) grcov . \ - --binary-path ./target/debug/ \ - -s ${GRCOV_SOURCES} \ + --binary-path ./target/debug/deps/ \ + -s . \ -t cobertura \ - --branch --ignore-not-existing \ + --branch \ + --ignore-not-existing \ + --ignore "/*" \ -o coverage.xml - - name: Fix Cobertura XML format + - name: Fix Cobertura XML format for SonarCloud run: | - # XML 포맷 수정 (버전 충돌 및 태그 오류 해결) - sed -i 's///' coverage.xml - sed -i 's/version="1\.9"/version="1\.0"/g' coverage.xml - sed -i 's/version="1\.0"/version="1"/' coverage.xml - sed -i '//,/\/sources>/d' coverage.xml + sed -i 's/]*>//' coverage.xml + sed -i 's///' coverage.xml + sed -i 's/ version="[0-9.]*"/ version="1"/' coverage.xml + sed -i '//,/<\/sources>/d' coverage.xml - - name: Set up Runner PATH - run: echo "$HOME/.cargo/bin" >> $GITHUB_PATH + - name: Delete profraw files + run: find . -name "*.profraw" -type f -delete - name: SonarCloud Scan uses: SonarSource/sonarcloud-github-action@v2 env: SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - SONAR_SCANNER_OPTS: "-Dsonar.cfamily.clippy.path=/github/home/.cargo/bin" with: args: > -Dsonar.projectKey=MORUTINE_backend From 1204ad69928063e61d730890b98b493fafaf30f3 Mon Sep 17 00:00:00 2001 From: zakie Date: Sat, 29 Nov 2025 04:23:13 +0900 Subject: [PATCH 44/49] =?UTF-8?q?chore:=20sonarcloud=20=EC=BB=A4=EB=B2=84?= =?UTF-8?q?=EB=A6=AC=EC=A7=80=20=EB=A6=AC=ED=8F=AC=ED=8A=B8=20=EC=97=90?= =?UTF-8?q?=EB=9F=AC=20=ED=95=B4=EA=B2=B0=20=EC=8B=9C=EB=8F=84=2029=20(cla?= =?UTF-8?q?ud)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/sonarcloud.yml | 19 +++++++++++++++++-- 1 file changed, 17 insertions(+), 2 deletions(-) diff --git a/.github/workflows/sonarcloud.yml b/.github/workflows/sonarcloud.yml index 2b35714..a05eec5 100644 --- a/.github/workflows/sonarcloud.yml +++ b/.github/workflows/sonarcloud.yml @@ -47,10 +47,25 @@ jobs: - name: Fix Cobertura XML format for SonarCloud run: | + # DTD 제거 sed -i 's/]*>//' coverage.xml - sed -i 's///' coverage.xml - sed -i 's/ version="[0-9.]*"/ version="1"/' coverage.xml + # XML 버전 수정 + sed -i 's///' coverage.xml + # coverage 태그의 version 속성을 1로 변경 + sed -i 's/]*version="[^"]*"//,/<\/sources>/d' coverage.xml + # 나머지 속성들 정리 + sed -i 's/]*>//' coverage.xml + + - name: Verify fixed coverage.xml + run: | + echo "=== First 30 lines of coverage.xml ===" + head -30 coverage.xml + echo "=== Checking for DOCTYPE ===" + grep -c "DOCTYPE" coverage.xml || echo "No DOCTYPE found (good)" + echo "=== Checking version ===" + grep "version=" coverage.xml | head -5 - name: Delete profraw files run: find . -name "*.profraw" -type f -delete From a9b89d189ff0d190528532421bf81ba15fd9e9ad Mon Sep 17 00:00:00 2001 From: zakie Date: Sat, 29 Nov 2025 04:28:50 +0900 Subject: [PATCH 45/49] =?UTF-8?q?chore:=20sonarcloud=20=EC=BB=A4=EB=B2=84?= =?UTF-8?q?=EB=A6=AC=EC=A7=80=20=EB=A6=AC=ED=8F=AC=ED=8A=B8=20=EC=97=90?= =?UTF-8?q?=EB=9F=AC=20=ED=95=B4=EA=B2=B0=20=EC=8B=9C=EB=8F=84=2030=20(cla?= =?UTF-8?q?ud)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/sonarcloud.yml | 30 ++++++++++++++++-------------- 1 file changed, 16 insertions(+), 14 deletions(-) diff --git a/.github/workflows/sonarcloud.yml b/.github/workflows/sonarcloud.yml index a05eec5..32f3022 100644 --- a/.github/workflows/sonarcloud.yml +++ b/.github/workflows/sonarcloud.yml @@ -47,25 +47,27 @@ jobs: - name: Fix Cobertura XML format for SonarCloud run: | - # DTD 제거 - sed -i 's/]*>//' coverage.xml - # XML 버전 수정 - sed -i 's///' coverage.xml - # coverage 태그의 version 속성을 1로 변경 - sed -i 's/]*version="[^"]*"//,/<\/sources>/d' coverage.xml - # 나머지 속성들 정리 - sed -i 's/]*>//' coverage.xml + # 모든 수정을 한 번에 + sed -i \ + -e 's/]*>//' \ + -e 's///' \ + -e 's/]*>//' \ + -e '//,/<\/sources>/d' \ + coverage.xml - name: Verify fixed coverage.xml run: | - echo "=== First 30 lines of coverage.xml ===" - head -30 coverage.xml + echo "=== First 50 lines of coverage.xml ===" + head -50 coverage.xml + echo "" + echo "=== Full first line ===" + head -1 coverage.xml + echo "" echo "=== Checking for DOCTYPE ===" grep -c "DOCTYPE" coverage.xml || echo "No DOCTYPE found (good)" - echo "=== Checking version ===" - grep "version=" coverage.xml | head -5 + echo "" + echo "=== Checking coverage tag ===" + grep -o "]*>" coverage.xml | head -1 - name: Delete profraw files run: find . -name "*.profraw" -type f -delete From 631e139a034e891d680ecbdb9adad9cd0f207ca8 Mon Sep 17 00:00:00 2001 From: zakie Date: Sat, 29 Nov 2025 04:34:56 +0900 Subject: [PATCH 46/49] =?UTF-8?q?chore:=20sonarcloud=20=EC=BB=A4=EB=B2=84?= =?UTF-8?q?=EB=A6=AC=EC=A7=80=20=EB=A6=AC=ED=8F=AC=ED=8A=B8=20=EC=97=90?= =?UTF-8?q?=EB=9F=AC=20=ED=95=B4=EA=B2=B0=20=EC=8B=9C=EB=8F=84=2031=20(cla?= =?UTF-8?q?ud)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/sonarcloud.yml | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/.github/workflows/sonarcloud.yml b/.github/workflows/sonarcloud.yml index 32f3022..eaeeceb 100644 --- a/.github/workflows/sonarcloud.yml +++ b/.github/workflows/sonarcloud.yml @@ -36,6 +36,10 @@ jobs: - name: Generate Coverage Report (Cobertura XML) run: | + echo "=== Checking for profraw files ===" + find . -name "*.profraw" -type f + + echo "=== Running grcov ===" grcov . \ --binary-path ./target/debug/deps/ \ -s . \ @@ -44,6 +48,12 @@ jobs: --ignore-not-existing \ --ignore "/*" \ -o coverage.xml + + echo "=== Checking coverage.xml was created ===" + ls -lh coverage.xml + + echo "=== First 20 lines of RAW coverage.xml ===" + head -20 coverage.xml - name: Fix Cobertura XML format for SonarCloud run: | From 140897257adf59a4a1fe3ef2187ddffc141c390f Mon Sep 17 00:00:00 2001 From: zakie Date: Sat, 29 Nov 2025 04:36:31 +0900 Subject: [PATCH 47/49] =?UTF-8?q?chore:=20sonarcloud=20=EC=BB=A4=EB=B2=84?= =?UTF-8?q?=EB=A6=AC=EC=A7=80=20=EB=A6=AC=ED=8F=AC=ED=8A=B8=20=EC=97=90?= =?UTF-8?q?=EB=9F=AC=20=ED=95=B4=EA=B2=B0=20=EC=8B=9C=EB=8F=84=2032=20(cla?= =?UTF-8?q?ud)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/sonarcloud.yml | 49 +++++++++----------------------- 1 file changed, 13 insertions(+), 36 deletions(-) diff --git a/.github/workflows/sonarcloud.yml b/.github/workflows/sonarcloud.yml index eaeeceb..e88f6eb 100644 --- a/.github/workflows/sonarcloud.yml +++ b/.github/workflows/sonarcloud.yml @@ -29,17 +29,11 @@ jobs: env: CARGO_INCREMENTAL: "0" RUSTFLAGS: "-Cinstrument-coverage" - LLVM_PROFILE_FILE: "default.profraw" - run: | - rm -f default*.profraw - cargo test --all --verbose + LLVM_PROFILE_FILE: "%m.profraw" + run: cargo test --all --verbose - name: Generate Coverage Report (Cobertura XML) run: | - echo "=== Checking for profraw files ===" - find . -name "*.profraw" -type f - - echo "=== Running grcov ===" grcov . \ --binary-path ./target/debug/deps/ \ -s . \ @@ -47,37 +41,20 @@ jobs: --branch \ --ignore-not-existing \ --ignore "/*" \ + --excl-line "^\\s*((debug_)?assert(_eq|_ne)?!|#\\[derive\\()" \ -o coverage.xml - - echo "=== Checking coverage.xml was created ===" - ls -lh coverage.xml - - echo "=== First 20 lines of RAW coverage.xml ===" - head -20 coverage.xml - - - name: Fix Cobertura XML format for SonarCloud - run: | - # 모든 수정을 한 번에 - sed -i \ - -e 's/]*>//' \ - -e 's///' \ - -e 's/]*>//' \ - -e '//,/<\/sources>/d' \ - coverage.xml - - name: Verify fixed coverage.xml + - name: Fix Cobertura XML for SonarCloud run: | - echo "=== First 50 lines of coverage.xml ===" - head -50 coverage.xml - echo "" - echo "=== Full first line ===" - head -1 coverage.xml - echo "" - echo "=== Checking for DOCTYPE ===" - grep -c "DOCTYPE" coverage.xml || echo "No DOCTYPE found (good)" - echo "" - echo "=== Checking coverage tag ===" - grep -o "]*>" coverage.xml | head -1 + python3 -c " + import xml.etree.ElementTree as ET + tree = ET.parse('coverage.xml') + root = tree.getroot() + root.set('version', '1') + for sources in root.findall('sources'): + root.remove(sources) + tree.write('coverage.xml', encoding='utf-8', xml_declaration=True) + " - name: Delete profraw files run: find . -name "*.profraw" -type f -delete From 967e7f7cd4b0e7834fd314bb7ed81cbfc15a9529 Mon Sep 17 00:00:00 2001 From: zakie Date: Sat, 29 Nov 2025 04:42:09 +0900 Subject: [PATCH 48/49] =?UTF-8?q?chore:=20sonarcloud=20=EC=BB=A4=EB=B2=84?= =?UTF-8?q?=EB=A6=AC=EC=A7=80=20=EB=A6=AC=ED=8F=AC=ED=8A=B8=20=EC=97=90?= =?UTF-8?q?=EB=9F=AC=20=ED=95=B4=EA=B2=B0=20=EC=8B=9C=EB=8F=84=2033=20(cla?= =?UTF-8?q?ud)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/sonarcloud.yml | 20 ++++++-------------- 1 file changed, 6 insertions(+), 14 deletions(-) diff --git a/.github/workflows/sonarcloud.yml b/.github/workflows/sonarcloud.yml index e88f6eb..d192c7f 100644 --- a/.github/workflows/sonarcloud.yml +++ b/.github/workflows/sonarcloud.yml @@ -32,29 +32,21 @@ jobs: LLVM_PROFILE_FILE: "%m.profraw" run: cargo test --all --verbose - - name: Generate Coverage Report (Cobertura XML) + - name: Generate Coverage Report (lcov format) run: | grcov . \ --binary-path ./target/debug/deps/ \ -s . \ - -t cobertura \ + -t lcov \ --branch \ --ignore-not-existing \ --ignore "/*" \ - --excl-line "^\\s*((debug_)?assert(_eq|_ne)?!|#\\[derive\\()" \ - -o coverage.xml + -o lcov.info - - name: Fix Cobertura XML for SonarCloud + - name: Convert lcov to Cobertura for SonarCloud run: | - python3 -c " - import xml.etree.ElementTree as ET - tree = ET.parse('coverage.xml') - root = tree.getroot() - root.set('version', '1') - for sources in root.findall('sources'): - root.remove(sources) - tree.write('coverage.xml', encoding='utf-8', xml_declaration=True) - " + pip install lcov_cobertura + lcov_cobertura lcov.info --output coverage.xml - name: Delete profraw files run: find . -name "*.profraw" -type f -delete From e51faf27072f6fe90f398d1336471fe3caadd871 Mon Sep 17 00:00:00 2001 From: zakie Date: Sat, 29 Nov 2025 05:02:38 +0900 Subject: [PATCH 49/49] =?UTF-8?q?chore:=20sonarcloud=20=EC=BB=A4=EB=B2=84?= =?UTF-8?q?=EB=A6=AC=EC=A7=80=20=EB=A6=AC=ED=8F=AC=ED=8A=B8=20=EC=97=90?= =?UTF-8?q?=EB=9F=AC=20=ED=95=B4=EA=B2=B0=20=EC=8B=9C=EB=8F=84=2034=20(cla?= =?UTF-8?q?ud)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/sonarcloud.yml | 34 +++++++++++++++++++++++++++++--- 1 file changed, 31 insertions(+), 3 deletions(-) diff --git a/.github/workflows/sonarcloud.yml b/.github/workflows/sonarcloud.yml index d192c7f..90feea9 100644 --- a/.github/workflows/sonarcloud.yml +++ b/.github/workflows/sonarcloud.yml @@ -43,10 +43,38 @@ jobs: --ignore "/*" \ -o lcov.info - - name: Convert lcov to Cobertura for SonarCloud + - name: Convert lcov to SonarCloud Generic Coverage format run: | - pip install lcov_cobertura - lcov_cobertura lcov.info --output coverage.xml + python3 << 'EOF' + import re + + coverage = {} + current_file = None + + with open('lcov.info', 'r') as f: + for line in f: + if line.startswith('SF:'): + current_file = line[3:].strip() + if current_file not in coverage: + coverage[current_file] = [] + elif line.startswith('DA:') and current_file: + parts = line[3:].strip().split(',') + if len(parts) >= 2: + line_num = parts[0] + hits = parts[1] + coverage[current_file].append((line_num, hits)) + + with open('coverage.xml', 'w') as f: + f.write('\n') + f.write('\n') + for filepath, lines in coverage.items(): + if lines: + f.write(f' \n') + for line_num, hits in lines: + f.write(f' 0 else "false"}"/>\n') + f.write(' \n') + f.write('\n') + EOF - name: Delete profraw files run: find . -name "*.profraw" -type f -delete