Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
55 changes: 41 additions & 14 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
name: Build

name: SonarQube
on:
push:
branches:
Expand All @@ -11,20 +10,48 @@ jobs:
build:
name: Build and analyze
runs-on: windows-latest

env:
BUILD_WRAPPER_OUT_DIR: build_wrapper_output_directory
SONAR_SCANNER_PROJECT_KEY: SupportTeam-SC-demos_kilo-cppAndcSharp

steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0 # Shallow clones should be disabled for a better relevancy of analysis
- uses: SonarSource/sonarqube-scan-action@v4
fetch-depth: 0

- name: Install .NET SDK
uses: actions/setup-dotnet@v4
with:
dotnet-version: '8.x'

- name: Install SonarScanner for .NET
run: dotnet tool install --global dotnet-sonarscanner

- name: Install Build Wrapper
uses: SonarSource/sonarqube-scan-action/install-build-wrapper@v5

- name: SonarScanner for .NET - Begin
env:
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
run: |
dotnet-sonarscanner begin `
/k:"${{ env.SONAR_SCANNER_PROJECT_KEY }}" `
/o:"supportteam-sc-demos" `
/d:sonar.login="${{ secrets.SONAR_TOKEN }}" `
/d:sonar.cfamily.build-wrapper-output="${{ env.BUILD_WRAPPER_OUT_DIR }}"

- name: Setup MSBuild
uses: microsoft/setup-msbuild@v2

- name: Restore .NET dependencies
run: dotnet restore CPlusPlusAndCSharp.sln

- name: Build Solution with Build Wrapper
run: |
build-wrapper-win-x86-64 --out-dir $env:BUILD_WRAPPER_OUT_DIR msbuild CPlusPlusAndCSharp.sln /p:Configuration=Release
shell: pwsh

- name: SonarScanner for .NET - End
env:
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
SONAR_HOST_URL: ${{ secrets.SONAR_HOST_URL }}
# If you wish to fail your job when the Quality Gate is red, uncomment the
# following lines. This would typically be used to fail a deployment.
# We do not recommend to use this in a pull request. Prefer using pull request
# decoration instead.
# - uses: SonarSource/sonarqube-quality-gate-action@v1
# timeout-minutes: 5
# env:
# SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
run: dotnet-sonarscanner end /d:sonar.login="${{ secrets.SONAR_TOKEN }}"
2 changes: 2 additions & 0 deletions CPlusPlusAndCSharp/CPlusPlusAndCSharp.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -30,3 +30,5 @@ void f()
// 4. Use the Error List window to view errors
// 5. Go to Project > Add New Item to create new code files, or Project > Add Existing Item to add existing code files to the project
// 6. In the future, to open this project again, go to File > Open > Project and select the .sln file

// Triggering Actions
1 change: 0 additions & 1 deletion CPlusPlusAndCSharp/sonar-project.properties

This file was deleted.

1 change: 0 additions & 1 deletion CSharpProject/sonar-project.properties

This file was deleted.

44 changes: 0 additions & 44 deletions Jenkinsfile

This file was deleted.

1 change: 0 additions & 1 deletion sonar-project.properties

This file was deleted.

Loading