기존 공통 응답 제거 후 RESTful 응답 구조로 변경 + 소나 클라우드 에러 해결 #49
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: Create coverage directory | |
| 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 | |
| - 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 . \ | |
| -t cobertura \ | |
| --branch \ | |
| --ignore-not-existing \ | |
| --ignore "/*" \ | |
| --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 | |
| - name: Delete all profraw files before SonarCloud scan | |
| 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 }} | |
| with: | |
| args: > | |
| -Dsonar.projectKey=MORUTINE_backend | |
| -Dsonar.organization=morutine | |
| -Dsonar.coverageReportPaths=coverage.xml |