dotnet windows #454
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: dotnet windows | |
| defaults: | |
| run: | |
| shell: pwsh | |
| on: | |
| pull_request: | |
| branches: [main] | |
| schedule: | |
| - cron: "15 7 * * *" | |
| workflow_dispatch: | |
| permissions: {} | |
| jobs: | |
| dotnet-windows: | |
| outputs: | |
| status: ${{ job.status }} | |
| permissions: | |
| contents: read | |
| runs-on: windows-latest | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| senzingsdk-version: [production-v4, staging-v4] | |
| include: | |
| - dotnet-version: "8" | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@v5 | |
| with: | |
| persist-credentials: false | |
| - uses: actions/setup-dotnet@v5 | |
| with: | |
| dotnet-version: ${{ matrix.dotnet-version }} | |
| - name: Install Senzing SDK | |
| uses: senzing-factory/github-action-install-senzing-sdk@v3 | |
| with: | |
| senzingsdk-version: ${{ matrix.senzingsdk-version }} | |
| - name: Add to "Path" environment variable | |
| run: | | |
| Add-Content $env:GITHUB_PATH "$Env:USERPROFILE\Senzing\er\lib" | |
| - name: Build with DotNet | |
| run: | | |
| dotnet test Senzing.Sdk.Demo -p:GeneratePackageOnBuild=false | |
| if ( $? -eq $false ) { exit 1 } | |
| dotnet build -c Release Senzing.Sdk -p:GenerateDocumentationFile=true | |
| if ( $? -eq $false ) { exit 1 } | |
| - name: Validate tests compile | |
| run: | | |
| dotnet build Senzing.Sdk.Tests | |
| if ( $? -eq $false ) { exit 1 } | |
| - name: Run DotNet tests | |
| run: | | |
| dotnet build Senzing.Sdk.TestHelpers | |
| dotnet test --no-build Senzing.Sdk.Tests --logger trx --collect:"XPlat Code Coverage" | |
| if ( $? -eq $false ) { exit 1 } | |
| $Env:filter = (Get-Date -Format "yyyy-MM-dd") | |
| $Env:results_folder = (Get-ChildItem -Path ${{ github.workspace }}/Senzing.Sdk.Tests/TestResults/ -Depth 0 -Directory | Where-Object { $_.Name -notmatch "$Env:filter" }) | |
| cp $Env:results_folder/coverage.cobertura.xml ${{ github.workspace }}/coverage.cobertura.${{ matrix.senzingsdk-version }}.xml | |
| - name: Store coverage file | |
| uses: actions/upload-artifact@v5 | |
| with: | |
| name: coverage.cobertura.${{ matrix.senzingsdk-version }}.xml | |
| path: ${{ github.workspace }}/coverage.cobertura.${{ matrix.senzingsdk-version }}.xml | |
| coverage: | |
| name: Coverage | |
| needs: dotnet-windows | |
| permissions: | |
| pull-requests: write | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| senzingsdk-version: [production-v4, staging-v4] | |
| uses: senzing-factory/build-resources/.github/workflows/csharp-coverage-comment.yaml@v3 | |
| with: | |
| filename: coverage.cobertura.${{ matrix.senzingsdk-version }}.xml | |
| thresholds: "85 90" | |
| slack-notification: | |
| needs: [dotnet-windows] | |
| if: ${{ always() && contains(fromJSON('["failure", "cancelled"]'), needs.dotnet-windows.outputs.status ) && github.event_name == 'schedule' }} | |
| secrets: | |
| SLACK_BOT_TOKEN: ${{ secrets.SLACK_BOT_TOKEN }} | |
| uses: senzing-factory/build-resources/.github/workflows/build-failure-slack-notification.yaml@v3 | |
| with: | |
| job-status: ${{ needs.dotnet-windows.outputs.status }} |