Fix unit tests #740
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: Build & Test & SonarQube | |
on: | |
push: | |
pull_request: | |
types: [opened, synchronize, reopened] | |
jobs: | |
build: | |
name: Build | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
with: | |
fetch-depth: 0 # Shallow clones should be disabled for a better relevancy of analysis | |
- name: Set up JDK 17 | |
uses: actions/setup-java@v4 | |
with: | |
distribution: 'temurin' | |
java-version: '17' | |
overwrite-settings: false | |
- name: Setup dotnet | |
uses: actions/setup-dotnet@v3 | |
with: | |
dotnet-version: '8.0.x' | |
- name: add DevExpress nuget feed | |
run: dotnet nuget add source https://nuget.devexpress.com/api -n DXFeed -u DevExpress -p ${{ secrets.DEVEXPRESS_NUGET_KEY }} --store-password-in-clear-text | |
- 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-SDK-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: Run Tests and Compute Coverage | |
run: dotnet test CDP4-SDK.sln --verbosity normal --filter="(TestCategory!~WebServicesDependent) & (TestCategory!~CICDExclusion)" /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 }} | |
- name: PR Based Nuget | |
if: ${{ github.event_name == 'pull_request' }} | |
run: | | |
dotnet pack CDP4-SDK.sln --version-suffix "${{ github.run_id }}-${{ github.run_number }}-${{ github.run_attempt }}-PR-${{ github.event.pull_request.number }}" -o . | |
dotnet nuget push *.nupkg --skip-duplicate --source https://nuget.pkg.github.com/RHEAGROUP/index.json -k ${{ secrets.GITHUB_TOKEN }} |