diff --git a/.github/workflows/sonarcloud.yml b/.github/workflows/sonarcloud.yml deleted file mode 100644 index a50a038c6..000000000 --- a/.github/workflows/sonarcloud.yml +++ /dev/null @@ -1,70 +0,0 @@ -name: Sonarcloud -on: - workflow_dispatch: - push: - branches: - - main - paths-ignore: ['.vscode/**'] - pull_request: - types: [opened, synchronize, reopened] - paths-ignore: ['.vscode/**'] - - -permissions: - contents: read - pull-requests: read - -env: - SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} - -jobs: - checksecret: - name: check if SONAR_TOKEN is set in github secrets - runs-on: ubuntu-latest - outputs: - is_SONAR_TOKEN_set: ${{ steps.checksecret_job.outputs.is_SONAR_TOKEN_set }} - steps: - - name: Check whether unity activation requests should be done - id: checksecret_job - run: | - echo "is_SONAR_TOKEN_set=${{ env.SONAR_TOKEN != '' }}" >> $GITHUB_OUTPUT - build: - needs: [checksecret] - if: needs.checksecret.outputs.is_SONAR_TOKEN_set == 'true' - name: Build - runs-on: windows-latest - steps: - - name: Set up JDK 17 - uses: actions/setup-java@77dd5b2ce225ea11469928ac317850245a74ae78 # v6.2.0 - with: - distribution: 'temurin' - java-version: 17 - - name: Setup .NET 8 - uses: actions/setup-dotnet@0f4a354dd5547a28c70b7853dbd95d5b67886e73 # v6.1.0 - with: - dotnet-version: 8.0.x - - name: Setup .NET 10 - uses: actions/setup-dotnet@0f4a354dd5547a28c70b7853dbd95d5b67886e73 # v6.1.0 - with: - dotnet-version: 10.0.x - - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 - with: - fetch-depth: 0 # Shallow clones should be disabled for a better relevancy of analysis - - name: Cache SonarCloud packages - uses: actions/cache@55cc8345863c7cc4c66a329aec7e433d2d1c52a9 # v6.1.0 - with: - path: ~/.sonar/cache - key: ${{ runner.os }}-sonar - restore-keys: ${{ runner.os }}-sonar - - name: Install SonarCloud scanner - run: dotnet tool install dotnet-sonarscanner --create-manifest-if-needed - - name: Build and analyze - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # Needed to get PR information, if any - shell: pwsh - run: | - dotnet tool run dotnet-sonarscanner begin /k:"microsoft_OpenAPI.NET" /o:"microsoft" /d:sonar.token="${{ secrets.SONAR_TOKEN }}" /d:sonar.host.url="https://sonarcloud.io" /d:sonar.cs.opencover.reportsPaths="**/coverage.opencover*.xml" - dotnet workload restore - dotnet build - dotnet test --solution Microsoft.OpenApi.slnx --verbosity normal --coverlet --coverlet-output-format opencover --report-gh - dotnet tool run dotnet-sonarscanner end /d:sonar.token="${{ secrets.SONAR_TOKEN }}"