fix(tests): restore VS discovery with MSTest v4 alignment #16
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: publish | |
| on: | |
| workflow_dispatch: | |
| push: | |
| branches: [ master ] | |
| pull_request: | |
| branches: [ '*' ] | |
| release: | |
| types: [ published ] | |
| env: | |
| DOTNET_SKIP_FIRST_TIME_EXPERIENCE: 1 | |
| DOTNET_NOLOGO: true | |
| NuGetDirectory: ${{ github.workspace }}/nuget | |
| defaults: | |
| run: | |
| shell: pwsh | |
| jobs: | |
| build_test_and_pack: | |
| name: Build, Test, and Pack | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout Repository | |
| uses: actions/checkout@v4 | |
| with: | |
| fetch-depth: 0 | |
| - name: Setup .NET SDK | |
| uses: actions/setup-dotnet@v4 | |
| with: | |
| dotnet-version: | | |
| 10.x | |
| 9.x | |
| - name: Restore Dependencies | |
| run: dotnet restore TTSTextNormalization.sln | |
| - name: Build Solution | |
| run: dotnet build TTSTextNormalization.sln --configuration Release --no-restore | |
| - name: Run Tests for .NET 10.0 | |
| run: dotnet test TTSTextNormalization.Tests/TTSTextNormalization.Tests.csproj --configuration Release --framework net10.0 --no-build --logger "trx;LogFileName=test-results-net10.trx" | |
| - name: Run Tests for .NET 9.0 | |
| run: dotnet test TTSTextNormalization.Tests/TTSTextNormalization.Tests.csproj --configuration Release --framework net9.0 --no-build --logger "trx;LogFileName=test-results-net9.trx" | |
| - name: Upload Test Results | |
| if: always() | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: test-results | |
| path: '**/*.trx' | |
| retention-days: 7 | |
| - name: Pack Library | |
| run: dotnet pack TTSTextNormalization/TTSTextNormalization.csproj --configuration Release --no-build --output ${{ env.NuGetDirectory }} | |
| - name: Upload NuGet Packages Artifact | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: nuget-packages | |
| if-no-files-found: error | |
| retention-days: 7 | |
| path: ${{ env.NuGetDirectory }}/*.nupkg | |
| deploy: | |
| name: Deploy Packages to NuGet.org | |
| if: github.event_name == 'release' && github.event.action == 'published' | |
| runs-on: ubuntu-latest | |
| needs: [build_test_and_pack] | |
| environment: | |
| name: nuget.org | |
| url: https://www.nuget.org/packages/Agash.TTSTextNormalization | |
| permissions: | |
| contents: read | |
| steps: | |
| - name: Download NuGet Packages Artifact | |
| uses: actions/download-artifact@v4 | |
| with: | |
| name: nuget-packages | |
| path: ${{ env.NuGetDirectory }} | |
| - name: Setup .NET SDK | |
| uses: actions/setup-dotnet@v4 | |
| with: | |
| dotnet-version: 10.x | |
| - name: Publish NuGet Packages | |
| env: | |
| NUGET_API_KEY: ${{ secrets.NUGET_APIKEY }} | |
| run: | | |
| Get-ChildItem "${{ env.NuGetDirectory }}" -Filter *.nupkg | ForEach-Object { | |
| Write-Host "Pushing $($_.FullName)..." | |
| dotnet nuget push $_.FullName --api-key "$env:NUGET_API_KEY" --source https://api.nuget.org/v3/index.json --skip-duplicate | |
| } |