diff --git a/.github/workflows/CodeQuality.yml b/.github/workflows/CodeQuality.yml new file mode 100644 index 00000000..c1c3476d --- /dev/null +++ b/.github/workflows/CodeQuality.yml @@ -0,0 +1,42 @@ +name: Build & Test & SonarQube + +on: + push: + pull_request: + types: [opened, synchronize, reopened] + +jobs: + build: + name: Build + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + with: + fetch-depth: 0 # Shallow clones should be disabled for a better relevancy of analysis + + - name: Setup dotnet + uses: actions/setup-dotnet@v3 + with: + dotnet-version: '8.0.x' + + - name: Restore dependencies + run: dotnet restore COMET-WebServices.sln + + - name: Sonarqube Begin + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # Needed to get PR information, if any + SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} + run: | + dotnet tool install --global dotnet-sonarscanner + dotnet sonarscanner begin /k:"RHEAGROUP_CDP4-COMET-WebServices-Community-Edition" /o:"rheagroup" /d:sonar.login="${{ secrets.SONAR_TOKEN }}" /d:sonar.host.url="https://sonarcloud.io" /d:sonar.cs.opencover.reportsPaths="./CoverageResults/coverage.opencover.xml" + + - name: Build + run: dotnet build COMET-WebServices.sln --no-restore /p:ContinuousIntegrationBuild=true + + - name: Run Tests and Compute Coverage + run: dotnet test COMET-WebServices.sln --no-restore --no-build --verbosity normal /p:CollectCoverage=true /p:CoverletOutput="../CoverageResults/" /p:MergeWith="../CoverageResults/coverage.json" /p:CoverletOutputFormat=\"opencover,json\" + + - name: Sonarqube end + run: dotnet sonarscanner end /d:sonar.login="${{ secrets.SONAR_TOKEN }}" + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} \ No newline at end of file diff --git a/.github/workflows/codeql.yml b/.github/workflows/codeql-analysis.yml similarity index 92% rename from .github/workflows/codeql.yml rename to .github/workflows/codeql-analysis.yml index 79a34eb5..c2cae3cd 100644 --- a/.github/workflows/codeql.yml +++ b/.github/workflows/codeql-analysis.yml @@ -1,4 +1,4 @@ -name: "CodeQL" +name: "CodeQL Analysis" on: push: diff --git a/CDP4Authentication.Tests/CDP4Authentication.Tests.csproj b/CDP4Authentication.Tests/CDP4Authentication.Tests.csproj index 998b5c16..f45f7f03 100644 --- a/CDP4Authentication.Tests/CDP4Authentication.Tests.csproj +++ b/CDP4Authentication.Tests/CDP4Authentication.Tests.csproj @@ -20,6 +20,15 @@ all runtime; build; native; contentfiles; analyzers; buildtransitive + + + runtime; build; native; contentfiles; analyzers; buildtransitive + all + + + all + runtime; build; native; contentfiles; analyzers; buildtransitive + diff --git a/CDP4WspDatabaseAuthentication.Tests/CDP4WspDatabaseAuthentication.Tests.csproj b/CDP4WspDatabaseAuthentication.Tests/CDP4WspDatabaseAuthentication.Tests.csproj index 20c1dfa1..fe5072cf 100644 --- a/CDP4WspDatabaseAuthentication.Tests/CDP4WspDatabaseAuthentication.Tests.csproj +++ b/CDP4WspDatabaseAuthentication.Tests/CDP4WspDatabaseAuthentication.Tests.csproj @@ -19,6 +19,15 @@ all runtime; build; native; contentfiles; analyzers; buildtransitive + + + runtime; build; native; contentfiles; analyzers; buildtransitive + all + + + all + runtime; build; native; contentfiles; analyzers; buildtransitive + diff --git a/CometServer.Tests/CometServer.Tests.csproj b/CometServer.Tests/CometServer.Tests.csproj index 7589aa6b..1ea5fd3c 100644 --- a/CometServer.Tests/CometServer.Tests.csproj +++ b/CometServer.Tests/CometServer.Tests.csproj @@ -20,6 +20,15 @@ all runtime; build; native; contentfiles; analyzers; buildtransitive + + + runtime; build; native; contentfiles; analyzers; buildtransitive + all + + + all + runtime; build; native; contentfiles; analyzers; buildtransitive + diff --git a/coverlet.runsettings b/coverlet.runsettings new file mode 100644 index 00000000..eaaba7af --- /dev/null +++ b/coverlet.runsettings @@ -0,0 +1,12 @@ + + + + + + + opencover + + + + + \ No newline at end of file