Support both .NET 8 and .NET 9 #1809
Workflow file for this run
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 and run unit tests | |
on: | |
push: | |
branches: | |
- main | |
pull_request: | |
branches: | |
- main | |
- release | |
release: | |
types: | |
- published | |
jobs: | |
build: | |
runs-on: ${{ matrix.os }} | |
strategy: | |
matrix: | |
os: [windows-latest] # [ubuntu-latest, windows-latest, macOS-latest] | |
configuration: [Release, Debug] | |
env: | |
IsReleaseBuild: ${{ matrix.configuration == 'Release' && github.event_name == 'release' && !github.event.release.prerelease && github.ref == 'refs/heads/master' }} | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: actions/setup-dotnet@v4 | |
with: | |
dotnet-version: '8.0.x' | |
# Install SF SDK | |
- name: Install SF | |
shell: powershell | |
run: | | |
Set-ExecutionPolicy -ExecutionPolicy Unrestricted -Force -Scope CurrentUser | |
$ProgressPreference = 'SilentlyContinue' | |
Invoke-WebRequest -OutFile setup.exe -Uri https://download.microsoft.com/download/b/8/a/b8a2fb98-0ec1-41e5-be98-9d8b5abf7856/MicrosoftServiceFabric.10.1.2448.9590.exe | |
.\setup.exe /accepteula /force /quiet | |
- name: Build with dotnet | |
run: dotnet build --configuration ${{ matrix.configuration }} | |
- name: Run Unit Tests | |
run: dotnet test --no-build --configuration ${{ matrix.configuration }} | |
- name: Create NuGet packages | |
run: dotnet pack --no-build --configuration ${{ matrix.configuration }} | |
- name: Add GitHub package source | |
run: dotnet nuget add source https://nuget.pkg.github.com/microsoft/index.json --name "github" --username NotUsed --password ${{ secrets.GITHUB_TOKEN }} | |
- name: Publish NuGet packages | |
run: dotnet nuget push nuget\*.nupkg --api-key ${{ secrets.GITHUB_TOKEN }} --source "github" --skip-duplicate --no-symbols true | |
if: matrix.configuration == 'Release' && github.event_name == 'release' && github.ref == 'refs/heads/master' |