기존 공통 응답 제거 후 RESTful 응답 구조로 변경 + 소나 클라우드 에러 해결 #59
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Sonar Coverage | |
| on: | |
| push: | |
| branches: | |
| - develop | |
| pull_request: | |
| branches: | |
| - develop | |
| jobs: | |
| sonar: | |
| runs-on: ubuntu-22.04 | |
| steps: | |
| - uses: actions/checkout@v4 | |
| with: | |
| fetch-depth: 0 | |
| - name: Install Rust Toolchain & Components | |
| uses: dtolnay/rust-toolchain@stable | |
| with: | |
| components: clippy, llvm-tools-preview | |
| - name: Install grcov | |
| run: cargo install grcov --force | |
| - name: Run Tests with Coverage Instrumentation | |
| 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} \ | |
| -t cobertura \ | |
| --branch --ignore-not-existing \ | |
| -o coverage.xml | |
| - name: Fix Cobertura XML format | |
| run: | | |
| # XML 포맷 수정 (버전 충돌 및 태그 오류 해결) | |
| sed -i 's/<!DOCTYPE coverage SYSTEM "http:\/\/cobertura\.sourceforge\.net\/xml\/coverage-04\.dtd">//' 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>/,/\/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: | |
| 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.coverageReportPaths=coverage.xml |