Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ci: add windows and macos test pipeline #137

Merged
merged 8 commits into from
Sep 5, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
7 changes: 5 additions & 2 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,11 @@ jobs:
FILTER_REGEX_EXCLUDE: .*Tests/.*
VALIDATE_MARKDOWN: false
build:
strategy:
matrix:
os: [ubuntu-latest, windows-latest, macos-latest]
name: "Build"
runs-on: ubuntu-latest
runs-on: ${{ matrix.os }}
timeout-minutes: 5
permissions:
contents: read
Expand All @@ -45,7 +48,7 @@ jobs:
uses: actions/setup-dotnet@v3
with:
dotnet-version: '6.0.x'
- name: Check out code into the Go module directory
- name: Check out code into the project directory
uses: actions/checkout@v3
- name: Run unit tests
run: make test
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,20 @@
using System.IO;
using System.Runtime.InteropServices;
using System.Security.Cryptography.X509Certificates;
using Xunit;

namespace Notation.Plugin.Protocol.Tests
{
public sealed class RunOnLinux : TheoryAttribute
{
public RunOnLinux()
{
if (!RuntimeInformation.IsOSPlatform(OSPlatform.Linux))
{
Skip = "test only works on Linux";
}
}
}
public class CertificateExtensionTests
{
[Theory]
Expand All @@ -26,7 +37,9 @@ public void KeySpec_ValidKeySize_ReturnsKeySpec(string keyType, int keySize)
Assert.Equal(keySize, result.Size);
}

[Theory]
// only run test on Linux because ECDSA other than NIST P-256,
// NIST P-384, NIST P-521 is not supported on Windows and macOS
[RunOnLinux]
[InlineData("RSA", 1024)]
[InlineData("EC", 163)]
public void KeySpec_InvalidKeySize_ThrowsValidationException(string keyType, int keySize)
Expand Down Expand Up @@ -56,6 +69,5 @@ private static X509Certificate2 LoadCertificate(string keyType, int keySize)
var certName = $"{keyType.ToLower()}_{keySize}.crt";
return new X509Certificate2(Path.Combine(Directory.GetCurrentDirectory(), "TestData", certName));
}

}
}