name: Build on: push: branches-ignore: - 'dependabot/**' - 'copilot/**' pull_request: release: types: [published] workflow_dispatch: permissions: contents: read jobs: Linux: runs-on: ubuntu-24.04 steps: - name: Checkout uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0 with: fetch-depth: 0 # needed for Nerdbank.GitVersioning persist-credentials: false - name: Setup .NET uses: actions/setup-dotnet@9a946fdbd5fb07b82b2f5a4466058b876ab72bb2 # v5.3.0 - name: Build Unit Tests .NET run: dotnet build -f net10.0 test/Renci.SshNet.Tests/ - name: Build IntegrationTests .NET run: dotnet build -f net10.0 test/Renci.SshNet.IntegrationTests/ - name: Run Unit Tests .NET run: | dotnet test \ -f net10.0 \ --no-build \ --logger "console;verbosity=normal" \ --logger GitHubActions \ -p:CollectCoverage=true \ -p:CoverletOutputFormat=cobertura \ -p:CoverletOutput=../../coverlet/linux_unit_test_net_10_coverage.xml \ test/Renci.SshNet.Tests/ - name: Run Integration Tests .NET run: | dotnet test \ -f net10.0 \ --no-build \ --logger "console;verbosity=normal" \ --logger GitHubActions \ -p:CollectCoverage=true \ -p:CoverletOutputFormat=cobertura \ -p:CoverletOutput=../../coverlet/linux_integration_test_net_10_coverage.xml \ test/Renci.SshNet.IntegrationTests/ - name: Archive Coverlet Results uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1 with: name: Coverlet Results Linux path: coverlet Windows: runs-on: windows-2025 steps: - name: Checkout uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0 with: fetch-depth: 0 # needed for Nerdbank.GitVersioning persist-credentials: false - name: Setup .NET uses: actions/setup-dotnet@9a946fdbd5fb07b82b2f5a4466058b876ab72bb2 # v5.3.0 - name: Build Solution run: dotnet build Renci.SshNet.slnx - name: Publish AOT Compatibility Test App run: dotnet publish -r win-x64 /warnaserror test/Renci.SshNet.AotCompatibilityTestApp/ - name: Create NuGet Package run: dotnet pack - name: Archive NuGet Package uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1 with: name: NuGet Package path: src/Renci.SshNet/bin/Release/*.*nupkg - name: Run Unit Tests .NET run: | dotnet test ` -f net10.0 ` --no-build ` --logger "console;verbosity=normal" ` --logger GitHubActions ` -p:CollectCoverage=true ` -p:CoverletOutputFormat=cobertura ` -p:CoverletOutput=../../coverlet/windows_unit_test_net_10_coverage.xml ` test/Renci.SshNet.Tests/ - name: Run Unit Tests .NET Framework run: | dotnet test ` -f net462 ` --no-build ` --logger "console;verbosity=normal" ` --logger GitHubActions ` -p:CollectCoverage=true ` -p:CoverletOutputFormat=cobertura ` -p:CoverletOutput=../../coverlet/windows_unit_test_net_4_6_2_coverage.xml ` test/Renci.SshNet.Tests/ Windows-Integration-Tests-NetFramework: name: Windows Integration Tests .NET Framework runs-on: windows-2025 steps: - name: Checkout uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0 with: fetch-depth: 0 # needed for Nerdbank.GitVersioning persist-credentials: false - name: Setup .NET uses: actions/setup-dotnet@9a946fdbd5fb07b82b2f5a4466058b876ab72bb2 # v5.3.0 - name: Setup WSL2 uses: Vampire/setup-wsl@d1da7f2c0322a5ee4f24975344f67fc0f5baf364 # v7.0.0 with: distribution: Ubuntu-24.04 - name: Setup SSH Server shell: wsl-bash {0} run: | apt-get update && apt-get upgrade -y apt-get install -y podman podman build -t renci-ssh-tests-server-image -f test/Renci.SshNet.IntegrationTests/Dockerfile test/Renci.SshNet.IntegrationTests/ podman run --rm -h renci-ssh-tests-server -d -p 2222:22 renci-ssh-tests-server-image - name: Run Integration Tests .NET Framework run: dotnet test ` -f net48 ` --logger "console;verbosity=normal" ` --logger GitHubActions ` -p:CollectCoverage=true ` -p:CoverletOutputFormat=cobertura ` -p:CoverletOutput=..\..\coverlet\windows_integration_test_net_4_8_coverage.xml ` test\Renci.SshNet.IntegrationTests\ - name: Archive Coverlet Results uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1 with: name: Coverlet Results Windows .NET Framework path: coverlet Windows-Integration-Tests-Net: name: Windows Integration Tests .NET runs-on: windows-2025 steps: - name: Checkout uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0 with: fetch-depth: 0 # needed for Nerdbank.GitVersioning persist-credentials: false - name: Setup .NET uses: actions/setup-dotnet@9a946fdbd5fb07b82b2f5a4466058b876ab72bb2 # v5.3.0 - name: Setup WSL2 uses: Vampire/setup-wsl@d1da7f2c0322a5ee4f24975344f67fc0f5baf364 # v7.0.0 with: distribution: Ubuntu-24.04 - name: Setup SSH Server shell: wsl-bash {0} run: | apt-get update && apt-get upgrade -y apt-get install -y podman podman build -t renci-ssh-tests-server-image -f test/Renci.SshNet.IntegrationTests/Dockerfile test/Renci.SshNet.IntegrationTests/ podman run --rm -h renci-ssh-tests-server -d -p 2222:22 renci-ssh-tests-server-image - name: Run Integration Tests .NET run: dotnet test ` -f net10.0 ` --logger "console;verbosity=normal" ` --logger GitHubActions ` -p:CollectCoverage=true ` -p:CoverletOutputFormat=cobertura ` -p:CoverletOutput=..\..\coverlet\windows_integration_test_net_9_coverage.xml ` test\Renci.SshNet.IntegrationTests\ - name: Archive Coverlet Results uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1 with: name: Coverlet Results Windows .NET path: coverlet Publish-GitHub-Package: name: Publish GitHub Package runs-on: ubuntu-24.04 if: github.ref == 'refs/heads/develop' permissions: packages: write needs: - Windows - Linux - Windows-Integration-Tests-NetFramework - Windows-Integration-Tests-Net steps: - name: Download NuGet Package uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1 with: name: NuGet Package - name: Publish to GitHub NuGet Registry run: | dotnet nuget add source \ --username $GITHUB_ACTOR \ --password ${{ secrets.GITHUB_TOKEN }} \ --store-password-in-clear-text \ --name github \ "https://nuget.pkg.github.com/$GITHUB_REPOSITORY_OWNER/index.json" dotnet nuget push "*.nupkg" \ --source github \ --api-key ${{ secrets.GITHUB_TOKEN }} Publish-NuGet-Package: name: Publish NuGet Package runs-on: ubuntu-24.04 if: github.event_name == 'release' environment: nuget-publish permissions: id-token: write needs: - Windows - Linux - Windows-Integration-Tests-NetFramework - Windows-Integration-Tests-Net steps: - name: Download NuGet Package uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1 with: name: NuGet Package - name: NuGet login (OIDC → temp API key) uses: NuGet/login@8d196754b4036150537f80ac539e15c2f1028841 # v1.2.0 id: login with: user: ${{ secrets.NUGET_USER }} - name: Publish to NuGet Registry run: | dotnet nuget push "*.nupkg" \ --source https://api.nuget.org/v3/index.json \ --api-key ${{ steps.login.outputs.NUGET_API_KEY }}