Skip to content

Commit

Permalink
ci : sonar only on PR
Browse files Browse the repository at this point in the history
  • Loading branch information
QRuhier committed Sep 12, 2024
1 parent c2f2302 commit 2b4dc46
Show file tree
Hide file tree
Showing 2 changed files with 33 additions and 18 deletions.
33 changes: 33 additions & 0 deletions .github/workflows/sonar.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
name: SonarCloud PR Analysis

on:
pull_request:
branches:
- '**' # Trigger on pull requests targeting any branch

jobs:
sonarcloud:
name: Sonar Analysis
runs-on: ubuntu-latest
needs: test-build
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0 # Ensure full history is fetched for accurate analysis

- name: Download coverage artifact
uses: actions/download-artifact@v4
with:
name: coverage
path: coverage

- name: SonarCloud Scan
uses: sonarsource/[email protected]
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
with:
args: >
-Dsonar.pullrequest.key=${{ github.event.pull_request.number }}
-Dsonar.pullrequest.branch=${{ github.head_ref }}
-Dsonar.pullrequest.base=${{ github.base_ref }}
18 changes: 0 additions & 18 deletions .github/workflows/test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -31,21 +31,3 @@ jobs:
with:
name: build
path: dist/

sonarcloud:
runs-on: ubuntu-latest
needs: test-build
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Download coverage artifact
uses: actions/download-artifact@v4
with:
name: coverage
path: coverage
- name: SonarCloud Scan
uses: sonarsource/sonarcloud-github-action@master
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}

0 comments on commit 2b4dc46

Please sign in to comment.