ci: use ms test platform for test executions #89
This file contains hidden or 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: .NET Multi-platform Verification | |
| on: | |
| push: | |
| paths-ignore: | |
| - 'LICENSE.md' | |
| - 'README.md' | |
| - '.editorconfig' | |
| - '.github/workflows/publish.yml' | |
| pull_request: | |
| branches: | |
| - master | |
| - devel | |
| jobs: | |
| linux-build: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v6 | |
| with: | |
| fetch-depth: 0 | |
| - name: Setup .NET | |
| uses: actions/setup-dotnet@v5 | |
| with: | |
| dotnet-version: '10.0.x' | |
| - name: Set up JDK 17 | |
| uses: actions/setup-java@v5 | |
| with: | |
| java-version: 17 | |
| distribution: 'zulu' | |
| - name: Cache SonarCloud packages | |
| uses: actions/cache@v5 | |
| with: | |
| path: ~/sonar/cache | |
| key: ${{ runner.os }}-sonar | |
| restore-keys: ${{ runner.os }}-sonar | |
| - name: Cache SonarCloud scanner | |
| id: cache-sonar-scanner | |
| uses: actions/cache@v5 | |
| with: | |
| path: ./.sonar/scanner | |
| key: ${{ runner.os }}-sonar-scanner | |
| restore-keys: ${{ runner.os }}-sonar-scanner | |
| - name: Install SonarCloud scanner | |
| if: steps.cache-sonar-scanner.outputs.cache-hit != 'true' | |
| shell: pwsh | |
| run: | | |
| New-Item -Path ./.sonar/scanner -ItemType Directory | |
| dotnet tool update dotnet-sonarscanner --tool-path ./.sonar/scanner | |
| - name: Install dependencies | |
| run: dotnet restore CommonNet.Extensions.Tests/CommonNet.Extensions.Tests.csproj | |
| - name: SonarCloud Begin | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} | |
| shell: pwsh | |
| run: ./.sonar/scanner/dotnet-sonarscanner begin /k:"dmako_CommonNetExtensions" /o:"dmako-github" /d:sonar.token="${{ secrets.SONAR_TOKEN }}" /d:sonar.host.url="https://sonarcloud.io" /d:sonar.scanner.scanAll=false /d:sonar.cs.opencover.reportsPaths="coverage/**/coverage.opencover.xml" | |
| - name: Build Tests | |
| run: dotnet build --configuration Release --no-restore CommonNet.Extensions.Tests/CommonNet.Extensions.Tests.csproj | |
| - name: Tests | |
| shell: pwsh | |
| run: | | |
| $currentDirectory = Get-Location | |
| dotnet test --no-restore --configuration Release --no-build --verbosity normal --framework net8.0 --results-directory $currentDirectory/coverage/net8.0 /p:CollectCoverage=true /p:CoverletOutputFormat=cobertura --project CommonNet.Extensions.Tests/CommonNet.Extensions.Tests.csproj | |
| dotnet test --no-restore --configuration Release --no-build --verbosity normal --framework net10.0 --results-directory $currentDirectory/coverage/net10.0 /p:CollectCoverage=true /p:CoverletOutputFormat=cobertura --project CommonNet.Extensions.Tests/CommonNet.Extensions.Tests.csproj | |
| - name: SonarCloud End | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} | |
| shell: pwsh | |
| run: ./.sonar/scanner/dotnet-sonarscanner end /d:sonar.token="${{ secrets.SONAR_TOKEN }}" | |
| - name: Upload coverage reports to Codecov | |
| uses: codecov/codecov-action@v5 | |
| with: | |
| token: ${{ secrets.CODECOV_TOKEN }} | |
| working-directory: coverage | |
| flags: unittests | |
| os: linux | |
| windows-build: | |
| runs-on: windows-latest | |
| steps: | |
| - uses: actions/checkout@v6 | |
| with: | |
| fetch-depth: 0 | |
| - name: Setup .NET | |
| uses: actions/setup-dotnet@v5 | |
| with: | |
| dotnet-version: '10.0.x' | |
| - name: Install dependencies | |
| run: dotnet restore CommonNet.Extensions.Tests/CommonNet.Extensions.Tests.csproj | |
| - name: Build Tests | |
| run: dotnet build --configuration Release --no-restore CommonNet.Extensions.Tests/CommonNet.Extensions.Tests.csproj | |
| - name: Tests | |
| shell: pwsh | |
| run: | | |
| $currentDirectory = Get-Location | |
| dotnet test --no-restore --configuration Release --no-build --verbosity normal --framework net48 --results-directory $currentDirectory/coverage/net48 /p:CollectCoverage=true /p:CoverletOutputFormat=cobertura --project CommonNet.Extensions.Tests/CommonNet.Extensions.Tests.csproj | |
| dotnet test --no-restore --configuration Release --no-build --verbosity normal --framework net8.0 --results-directory $currentDirectory/coverage/net8.0 /p:CollectCoverage=true /p:CoverletOutputFormat=cobertura --project CommonNet.Extensions.Tests/CommonNet.Extensions.Tests.csproj | |
| dotnet test --no-restore --configuration Release --no-build --verbosity normal --framework net10.0 --results-directory $currentDirectory/coverage/net10.0 /p:CollectCoverage=true /p:CoverletOutputFormat=cobertura --project CommonNet.Extensions.Tests/CommonNet.Extensions.Tests.csproj | |
| - name: Upload coverage reports to Codecov | |
| uses: codecov/codecov-action@v5 | |
| with: | |
| token: ${{ secrets.CODECOV_TOKEN }} | |
| working-directory: coverage | |
| flags: unittests | |
| os: windows |