-
Notifications
You must be signed in to change notification settings - Fork 0
ci(sonar): run SonarCloud scan and upload coverage #10
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -15,6 +15,11 @@ jobs: | |||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||
| steps: | ||||||||||||||||||||||||||||
| - uses: actions/checkout@v4 | ||||||||||||||||||||||||||||
| with: | ||||||||||||||||||||||||||||
| # Full history so SonarCloud can attribute new code / blame accurately. | ||||||||||||||||||||||||||||
| fetch-depth: 0 | ||||||||||||||||||||||||||||
|
amondnet marked this conversation as resolved.
|
||||||||||||||||||||||||||||
| # No later step needs authenticated git; keep the token out of .git/config. | ||||||||||||||||||||||||||||
| persist-credentials: false | ||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||
| - uses: oven-sh/setup-bun@v2 | ||||||||||||||||||||||||||||
| with: | ||||||||||||||||||||||||||||
|
|
@@ -29,10 +34,7 @@ jobs: | |||||||||||||||||||||||||||
| - name: Type check | ||||||||||||||||||||||||||||
| run: bun run type-check | ||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||
| - name: Run tests | ||||||||||||||||||||||||||||
| run: bun test | ||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||
| - name: Generate coverage report | ||||||||||||||||||||||||||||
| - name: Run tests with coverage | ||||||||||||||||||||||||||||
| run: bun run test:coverage | ||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||
| - name: Upload coverage reports to Codecov | ||||||||||||||||||||||||||||
|
|
@@ -42,6 +44,13 @@ jobs: | |||||||||||||||||||||||||||
| files: ./coverage/lcov.info | ||||||||||||||||||||||||||||
| continue-on-error: true | ||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||
| - name: SonarCloud Scan | ||||||||||||||||||||||||||||
| uses: SonarSource/sonarqube-scan-action@713881670b6b3676cda39549040e2d88c70d582e # v8.2.0 | ||||||||||||||||||||||||||||
| continue-on-error: true | ||||||||||||||||||||||||||||
| env: | ||||||||||||||||||||||||||||
| SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} | ||||||||||||||||||||||||||||
| SONAR_HOST_URL: https://sonarcloud.io | ||||||||||||||||||||||||||||
|
Comment on lines
+47
to
+52
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
Prompt To Fix With AIThis is a comment left during a code review.
Path: .github/workflows/ci.yml
Line: 48-53
Comment:
Without `GITHUB_TOKEN` in the step's `env`, the SonarCloud action cannot authenticate with the GitHub API to post inline analysis comments or the PR status check decoration. The dashboard upload still succeeds, but reviewers won't see any SonarCloud feedback directly on the PR.
```suggestion
- name: SonarCloud Scan
uses: SonarSource/sonarqube-scan-action@713881670b6b3676cda39549040e2d88c70d582e # v8.2.0
continue-on-error: true
env:
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
SONAR_HOST_URL: https://sonarcloud.io
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
```
How can I resolve this? If you propose a fix, please make it concise.
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Thanks — I checked the official There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. You're right, and I apologize for the incorrect guidance. PR decoration on SonarCloud is indeed handled by the GitHub App installed during project onboarding — Tip: You can customize Greptile's behavior for this repo with |
||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||
| - name: Build | ||||||||||||||||||||||||||||
| run: bun run build | ||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,16 @@ | ||
| sonar.organization=pleaseai | ||
| sonar.projectKey=pleaseai_cli-toolkit | ||
|
|
||
| # Analyze source; tests live under test/ | ||
| sonar.sources=src | ||
| sonar.tests=test | ||
| sonar.test.inclusions=test/**/*.test.ts | ||
|
amondnet marked this conversation as resolved.
|
||
|
|
||
| # Enable type-aware TypeScript analysis | ||
| sonar.typescript.tsconfigPath=tsconfig.json | ||
|
|
||
| # Coverage produced by `bun test --coverage` (see bunfig.toml) | ||
| sonar.javascript.lcov.reportPaths=coverage/lcov.info | ||
|
|
||
| # Build output and coverage artifacts are not source | ||
| sonar.exclusions=dist/**,coverage/** | ||
Uh oh!
There was an error while loading. Please reload this page.