Merge pull request #4 from PAYONE-GmbH/develop #70
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Quality Check (Build, Lint, Format, Test, Sonarcloud) | |
on: | |
push: | |
branches: | |
- main | |
pull_request: | |
branches: | |
- main | |
- develop | |
workflow_dispatch: | |
workflow_call: | |
jobs: | |
test: | |
runs-on: ubuntu-22.04 | |
strategy: | |
matrix: | |
dotnet: ['6.0.x', '7.0.x', '8.0.x'] | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
- name: Setup .NET v${{ matrix.dotnet }} | |
uses: actions/setup-dotnet@v4 | |
with: | |
dotnet-version: ${{ matrix.dotnet }} | |
- name: Run Build | |
run: ./scripts.sh build | |
- name: Run Tests | |
run: ./scripts.sh test | |
sonar: | |
needs: [test] | |
runs-on: ubuntu-22.04 | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
- name: Setup .NET | |
uses: actions/setup-dotnet@v4 | |
with: | |
dotnet-version: '8.0.401' | |
- name: Run Tests | |
run: ./scripts.sh test | |
- name: Install SonarScanner for .NET | |
run: dotnet tool install --global dotnet-sonarscanner | |
- name: Run SonarCloud analysis | |
env: | |
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} | |
run: | | |
dotnet sonarscanner begin \ | |
/k:"PAYONE-GmbH_PCP-ServerSDK-DotNet" \ | |
/o:"payone-gmbh" \ | |
/d:sonar.login="${{ secrets.SONAR_TOKEN }}" \ | |
/d:sonar.language="cs" \ | |
/d:sonar.host.url="https://sonarcloud.io" \ | |
/d:sonar.sln="PCP-ServerSDK-DotNet.sln" \ | |
/d:sonar.cs.opencover.reportsPaths="tests/PCPServerSDKDotNetTests/TestResults/**/coverage.opencover.xml" \ | |
/d:sonar.test.exclusions="**/bin/**,**/obj/**" \ | |
/d:sonar.exclusions="**/bin/**,**/obj/**,**/*.generated.cs,app/PCPServerSDKDotNetRunner" \ | |
/d:sonar.coverage.exclusions="**/*.Generated.cs,**/Migrations/**,**/Models/**" \ | |
/d:sonar.cpd.exclusions="**/Endpoints/**" \ | |
/d:sonar.cs.dotnet.version="8.0.401" | |
./scripts.sh build | |
dotnet sonarscanner end /d:sonar.login="${{ secrets.SONAR_TOKEN }}" |