diff --git a/.github/workflows/Publish.yml b/.github/workflows/Publish.yml index 9fb5e4f9..bab332b0 100644 --- a/.github/workflows/Publish.yml +++ b/.github/workflows/Publish.yml @@ -12,7 +12,7 @@ permissions: jobs: Code_Coverage: - runs-on: ubuntu-latest + runs-on: windows-latest steps: - name: Checkout repository uses: actions/checkout@v4 @@ -24,6 +24,20 @@ jobs: with: dotnet-version: '8.x' + - name: Set up JDK 17 + uses: actions/setup-java@v4 + with: + java-version: 17 + distribution: 'zulu' + + - name: Cache SonarCloud scanner + id: cache-sonar-scanner + uses: actions/cache@v4 + with: + path: .\.sonar\scanner + key: ${{ runner.os }}-sonar-scanner + restore-keys: ${{ runner.os }}-sonar-scanner + - name: Install dotnet tools run: | dotnet tool install JetBrains.dotCover.GlobalTool --global @@ -33,6 +47,26 @@ jobs: dotnet tool install --global dotnet-reportgenerator-globaltool dotnet restore + - name: Begin SonarCloud Analysis + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} + shell: powershell + run: | + dotnet sonarscanner begin /k:"mihakralj_QuanTAlib" /o:"mihakralj-quantalib" /d:sonar.token="${{ secrets.SONAR_TOKEN }}" /d:sonar.host.url="https://sonarcloud.io" ` + /d:sonar.solution.file="QuanTAlib.sln" ` + /d:sonar.cs.opencover.reportsPaths="**/*cover*.xml" ` + /d:sonar.cs.dotcover.reportsPaths="**/dotcover.xml" ` + /d:sonar.coverage.exclusions="**Tests.cs,**/*.md,**/*.html,**/*.css,**/docs/**/*,**/archive/**/*,**/notebooks/**/*,**/obj/**/*,**/bin/**/*" ` + /d:sonar.exclusions="**/TestResults/**/*,**/bin/**/*,**/obj/**/*,**/*.html,**/coverage/**/*,**/CoverageReport/**/*,**/*.md,**/*.css,**/docs/**/*,**/archive/**/*,**/notebooks/**/*" ` + /d:sonar.test.exclusions="**Tests.cs,**/obj/**/*,**/bin/**/*" ` + /d:sonar.cpd.exclusions="**Tests.cs" ` + /d:sonar.cs.roslyn.ignoreIssues="false" ` + /d:sonar.issue.ignore.multicriteria="e1" ` + /d:sonar.issue.ignore.multicriteria.e1.ruleKey="csharpsquid:S1944,csharpsquid:S2053,csharpsquid:S2222,csharpsquid:S2259,csharpsquid:S2583,csharpsquid:S2589,csharpsquid:S3329,csharpsquid:S3655,csharpsquid:S3900,csharpsquid:S3949,csharpsquid:S3966,csharpsquid:S4158,csharpsquid:S4347,csharpsquid:S5773,csharpsquid:S6781" ` + /d:sonar.issue.ignore.multicriteria.e1.resourceKey="**/*.cs" ` + /d:sonar.verbose="true" + - name: Build Projects run: | dotnet build --no-restore --configuration Debug @@ -54,6 +88,13 @@ jobs: run: | reportgenerator -reports:*cover*.xml -targetdir:. + - name: End SonarCloud Analysis + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} + shell: powershell + run: dotnet sonarscanner end /d:sonar.token="${{ secrets.SONAR_TOKEN }}" + - name: Upload Coverage to Codacy uses: codacy/codacy-coverage-reporter-action@v1 with: @@ -66,23 +107,6 @@ jobs: files: 'cover*' verbose: true - - name: SonarCloud Scan - uses: SonarSource/sonarcloud-github-action@master - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} - with: - args: > - -Dsonar.projectKey=mihakralj_QuanTAlib - -Dsonar.organization=mihakralj-quantalib - -Dsonar.sources=. - -Dsonar.cs.opencover.reportsPaths=**/*cover*.xml - -Dsonar.cs.dotcover.reportsPaths=**/dotcover.xml - -Dsonar.coverage.exclusions=**Tests.cs,**/*.md,**/*.html,**/*.css,**/docs/**/*,**/archive/**/*,**/notebooks/**/* - -Dsonar.exclusions=**/TestResults/**/*,**/bin/**/*,**/obj/**/*,**/*.html,**/coverage/**/*,**/CoverageReport/**/*,**/*.md,**/*.css,**/docs/**/*,**/archive/**/*,**/notebooks/**/* - -Dsonar.cpd.exclusions=**Tests.cs - -Dsonar.test.exclusions=**Tests.cs - CodeQL: runs-on: ubuntu-latest steps: