Skip to content

Commit

Permalink
Migrate from AppVeyor to GitHub Actions
Browse files Browse the repository at this point in the history
  • Loading branch information
mus65 committed Nov 16, 2024
1 parent 1d2d186 commit 57b4eb9
Show file tree
Hide file tree
Showing 10 changed files with 163 additions and 76 deletions.
137 changes: 137 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,137 @@
name: Build

on: [ push ]

jobs:
Linux:
runs-on: ubuntu-24.04
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0 # needed for Nerdbank.GitVersioning

- name: Setup .NET
uses: actions/setup-dotnet@v4
with:
dotnet-version: 8.0.x

- name: Build Unit Tests .NET
run: dotnet build -f net8.0 test/Renci.SshNet.Tests/Renci.SshNet.Tests.csproj

- name: Build IntegrationTests .NET
run: dotnet build -f net8.0 test/Renci.SshNet.IntegrationTests/Renci.SshNet.IntegrationTests.csproj

- name: Build IntegrationTests .NET Framework
run: dotnet build -f net48 test/Renci.SshNet.IntegrationTests/Renci.SshNet.IntegrationTests.csproj

- name: Run Unit Tests .NET
run: |
dotnet test \
-f net8.0 \
--no-build \
--logger "console;verbosity=normal" \
--logger GitHubActions \
-p:CollectCoverage=true \
-p:CoverletOutputFormat=cobertura \
-p:CoverletOutput=../../coverlet/linux_unit_test_net_8_coverage.xml \
test/Renci.SshNet.Tests/Renci.SshNet.Tests.csproj
- name: Run Integration Tests .NET
run: |
dotnet test \
-f net8.0 \
--no-build \
--logger "console;verbosity=normal" \
--logger GitHubActions \
-p:CollectCoverage=true \
-p:CoverletOutputFormat=cobertura \
-p:CoverletOutput=../../coverlet/linux_integration_test_net_8_coverage.xml \
test/Renci.SshNet.IntegrationTests/Renci.SshNet.IntegrationTests.csproj
# Also run a subset of the integration tests targeting netfx using mono. This is a temporary measure to get
# some coverage until a proper solution for running the .NET Framework integration tests in CI is found.
# Running all the tests causes problems which are not worth solving in this rare configuration.
# See https://github.com/sshnet/SSH.NET/pull/1462 and related links
- name: Run Integration Tests Mono
run: |
sudo apt-get install ca-certificates gnupg
sudo gpg --homedir /tmp --no-default-keyring --keyring /usr/share/keyrings/mono-official-archive-keyring.gpg --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys 3FA7E0328081BFF6A14DA29AA6A19B38D3D831EF
echo "deb [signed-by=/usr/share/keyrings/mono-official-archive-keyring.gpg] https://download.mono-project.com/repo/ubuntu stable-focal main" | sudo tee /etc/apt/sources.list.d/mono-official-stable.list
sudo apt-get update
sudo apt-get install mono-devel
dotnet test \
-f net48 \
--no-build \
--logger "console;verbosity=normal" \
--logger GitHubActions \
-p:CollectCoverage=true \
-p:CoverletOutputFormat=cobertura \
-p:CoverletOutput=../../coverlet/linux_integration_test_net_48_coverage.xml \
--filter "Name~Ecdh|Name~ECDsa|Name~Zlib|Name~Gcm" \
test/Renci.SshNet.IntegrationTests/Renci.SshNet.IntegrationTests.csproj
- name: Archive Coverlet Results
uses: actions/upload-artifact@v4
with:
name: Coverlet Results Linux
path: coverlet

Windows:
runs-on: windows-2022
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0 # needed for Nerdbank.GitVersioning

- name: Setup .NET
uses: actions/setup-dotnet@v4
with:
dotnet-version: 9.0.x

- name: Build Solution
run: dotnet build Renci.SshNet.sln

- 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@v4
with:
name: NuGet Package
path: |
src/Renci.SshNet/bin/Release/*.*nupkg
- name: Run Unit Tests .NET
run: |
dotnet test `
-f net8.0 `
--no-build `
--logger "console;verbosity=normal" `
--logger GitHubActions `
-p:CollectCoverage=true `
-p:CoverletOutputFormat=cobertura `
-p:CoverletOutput=../../coverlet/windows_unit_test_net_8_coverage.xml `
test/Renci.SshNet.Tests/Renci.SshNet.Tests.csproj
- 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/Renci.SshNet.Tests.csproj
- name: Archive Coverlet Results
uses: actions/upload-artifact@v4
with:
name: Coverlet Results Windows
path: coverlet
2 changes: 1 addition & 1 deletion CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ Before subsequent coverage collections, delete the previous collections with `gi

## CI

The repository makes use of continuous integration (CI) on [AppVeyor](https://ci.appveyor.com/project/drieseng/ssh-net/history) to validate builds and tests on PR branches and non-PR branches. At the time of writing, some tests can occasionally fail in CI due to a dependency on timing or a dependency on networking/socket code. If you see an existing test which is unrelated to your changes occasionally failing in CI but passing locally, you probably don't need to worry about it. If you see one of your newly-added tests failing, it is probably worth investigating why and whether it can be made more stable.
The repository makes use of continuous integration (CI) with GitHub Actions to validate builds and tests on PR branches and non-PR branches. At the time of writing, some tests can occasionally fail in CI due to a dependency on timing or a dependency on networking/socket code. If you see an existing test which is unrelated to your changes occasionally failing in CI but passing locally, you probably don't need to worry about it. If you see one of your newly-added tests failing, it is probably worth investigating why and whether it can be made more stable.

## Good to know

Expand Down
6 changes: 4 additions & 2 deletions Directory.Packages.props
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,14 @@
<CentralPackageVersionOverrideEnabled>false</CentralPackageVersionOverrideEnabled>
</PropertyGroup>
<ItemGroup>
<PackageVersion Include="Appveyor.TestLogger" Version="2.0.0" />
<PackageVersion Include="BenchmarkDotNet" Version="0.14.0" />
<PackageVersion Include="BouncyCastle.Cryptography" Version="2.4.0" />
<PackageVersion Include="coverlet.collector" Version="6.0.2" />
<PackageVersion Include="coverlet.msbuild" Version="6.0.2" />
<PackageVersion Include="LiquidTestReports.Markdown" Version="1.0.9" />
<PackageVersion Include="GitHubActionsTestLogger" Version="2.4.1">
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
<PrivateAssets>all</PrivateAssets>
</PackageVersion>
<PackageVersion Include="Meziantou.Analyzer" Version="2.0.163" />
<!-- Must be kept at version 1.0.0 or higher, see https://github.com/sshnet/SSH.NET/pull/1288 for details. -->
<PackageVersion Include="Microsoft.Bcl.AsyncInterfaces" Version="1.0.0" />
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ SSH.NET is a Secure Shell (SSH-2) library for .NET, optimized for parallelism.

[![Version](https://img.shields.io/nuget/vpre/SSH.NET.svg)](https://www.nuget.org/packages/SSH.NET)
[![NuGet download count](https://img.shields.io/nuget/dt/SSH.NET.svg)](https://www.nuget.org/packages/SSH.NET)
[![Build status](https://ci.appveyor.com/api/projects/status/ih77qu6tap3o92gu/branch/develop?svg=true)](https://ci.appveyor.com/api/projects/status/ih77qu6tap3o92gu/branch/develop)
![Build status](https://github.com/sshnet/SSH.NET/actions/workflows/build.yml/badge.svg)

## Key Features

Expand Down
11 changes: 10 additions & 1 deletion Renci.SshNet.sln
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution
.editorconfig = .editorconfig
.gitattributes = .gitattributes
.gitignore = .gitignore
appveyor.yml = appveyor.yml
CODEOWNERS = CODEOWNERS
CONTRIBUTING.md = CONTRIBUTING.md
Directory.Build.props = Directory.Build.props
Expand Down Expand Up @@ -83,6 +82,14 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Renci.SshNet.IntegrationBen
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Renci.SshNet.AotCompatibilityTestApp", "test\Renci.SshNet.AotCompatibilityTestApp\Renci.SshNet.AotCompatibilityTestApp.csproj", "{F2E3FC50-4EF4-488C-B3D2-C45E99898D8B}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = ".github", ".github", "{05229079-6738-42CE-8F73-F4E182929B03}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "workflows", "workflows", "{95F25B1A-2B14-4745-9087-43C00CD90EE0}"
ProjectSection(SolutionItems) = preProject
.github\workflows\build.yml = .github\workflows\build.yml
.github\workflows\docs.yml = .github\workflows\docs.yml
EndProjectSection
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Expand Down Expand Up @@ -244,6 +251,8 @@ Global
{19895BAF-F946-470D-8497-7034F9F2A8A7} = {1E46D4B6-EE87-4D29-8641-0AE8CD8ED0F0}
{3572019A-3A57-4578-B5A2-6280576EB508} = {1E46D4B6-EE87-4D29-8641-0AE8CD8ED0F0}
{92E7B1B8-4C70-4138-9970-433B2FC2E3EB} = {1E46D4B6-EE87-4D29-8641-0AE8CD8ED0F0}
{05229079-6738-42CE-8F73-F4E182929B03} = {04E8CC26-116E-4116-9558-7ED542548E70}
{95F25B1A-2B14-4745-9087-43C00CD90EE0} = {05229079-6738-42CE-8F73-F4E182929B03}
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {BAD6019D-4AF7-4E15-99A0-8036E16FC0E5}
Expand Down
65 changes: 0 additions & 65 deletions appveyor.yml

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>net8.0</TargetFramework>
<TargetFramework>net9.0</TargetFramework>
<PublishAot>true</PublishAot>
<SelfContained>true</SelfContained>
<TrimmerSingleWarn>false</TrimmerSingleWarn>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,14 @@

<ItemGroup>
<PackageReference Include="BouncyCastle.Cryptography" />
<PackageReference Include="GitHubActionsTestLogger">
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
<PrivateAssets>all</PrivateAssets>
</PackageReference>
<PackageReference Include="Microsoft.NET.Test.Sdk" />
<PackageReference Include="MSTest.TestAdapter" />
<PackageReference Include="MSTest.TestFramework" />
<PackageReference Include="Testcontainers" />
<PackageReference Include="Appveyor.TestLogger" />
<PackageReference Include="LiquidTestReports.Markdown" />
<PackageReference Include="coverlet.msbuild">
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
<PrivateAssets>all</PrivateAssets>
Expand Down
2 changes: 1 addition & 1 deletion test/Renci.SshNet.Tests/Common/AsyncSocketListener.cs
Original file line number Diff line number Diff line change
Expand Up @@ -324,7 +324,7 @@ void ConnectionDisconnected()
}
catch (ObjectDisposedException)
{
// TODO On .NET 7, sometimes we get ObjectDisposedException when _started but only on appveyor, locally it works
// TODO On .NET 7, sometimes we get ObjectDisposedException when _started but only in CI, locally it works
ConnectionDisconnected();
}
catch (SocketException ex)
Expand Down
6 changes: 4 additions & 2 deletions test/Renci.SshNet.Tests/Renci.SshNet.Tests.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,14 @@
</ItemGroup>

<ItemGroup>
<PackageReference Include="GitHubActionsTestLogger">
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
<PrivateAssets>all</PrivateAssets>
</PackageReference>
<PackageReference Include="Microsoft.NET.Test.Sdk" />
<PackageReference Include="MSTest.TestAdapter" />
<PackageReference Include="MSTest.TestFramework" />
<PackageReference Include="Moq" />
<PackageReference Include="Appveyor.TestLogger" />
<PackageReference Include="LiquidTestReports.Markdown" />
<PackageReference Include="coverlet.msbuild">
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
<PrivateAssets>all</PrivateAssets>
Expand Down

0 comments on commit 57b4eb9

Please sign in to comment.