Skip to content

Commit

Permalink
多操作系统多运行时版本矩阵测试
Browse files Browse the repository at this point in the history
  • Loading branch information
nnhy committed Nov 18, 2024
1 parent 48cc8bb commit 9091e98
Show file tree
Hide file tree
Showing 5 changed files with 16 additions and 9 deletions.
13 changes: 9 additions & 4 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,21 +9,26 @@ on:

jobs:
test:
runs-on: windows-latest
runs-on: ${{ matrix.os }}

strategy:
matrix:
dotnet-version: [ '4.6.2', '5.x', '6.x', '7.x', '8.x', '9.x' ]
os: [ubuntu-latest, windows-latest, macos-latest]
target-framework: [ 'net6.0', 'net8.0', 'net9.0' ]

steps:
- uses: actions/checkout@v4
- name: Setup dotNET
uses: actions/setup-dotnet@v4
with:
dotnet-version: ${{ matrix.dotnet-version }}
dotnet-version: |
6.x
7.x
8.x
9.x
- name: Build
run: |
dotnet build -c Release
- name: Test
run: |
dotnet test
dotnet test -f ${{ matrix.target-framework }}
2 changes: 1 addition & 1 deletion XUnitTest.Core/IO/CsvFileTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ public void BigString()
}

var txt = ms.ToArray().ToStr();
var lines = txt.Split(Environment.NewLine);
var lines = txt.Split([Environment.NewLine], StringSplitOptions.None);
Assert.Equal(6, lines.Length);
Assert.Equal("Code,Name,Enable,CreateTime", lines[0]);
Assert.Equal($"1234,Stone,1,{((DateTime)list[0][3]).ToFullString()}", lines[1]);
Expand Down
6 changes: 3 additions & 3 deletions XUnitTest.Core/Serialization/JsonTestBase.cs
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ protected void CheckModel(Model[] models)
Assert.Equal("/uploader/swiperPic/405621836.jpg", m.AdImgUrl);
Assert.Equal(typeof(NewLife.Common.PinYin), m.Type);
Assert.Equal(DateTimeOffset.Parse("2022-11-29T14:13:17.8763881+08:00"), m.Offset);
#if NET6_0_OR_GREATER
#if NET7_0_OR_GREATER
Assert.Equal(DateOnly.Parse("2022-11-29"), m.Date);
Assert.Equal(TimeOnly.Parse("14:13:17.8763881"), m.Time);
#endif
Expand All @@ -81,7 +81,7 @@ protected void CheckModel(Model[] models)
Assert.Equal("/uploader/swiperPic/1978468752.jpg", m.AdImgUrl);
Assert.Equal(typeof(String), m.Type);
Assert.Equal(DateTimeOffset.Parse("2022-11-29T14:13:17.8763881+08:00"), m.Offset);
#if NET6_0_OR_GREATER
#if NET7_0_OR_GREATER
Assert.Equal(DateOnly.Parse("2022-11-29"), m.Date);
Assert.Equal(TimeOnly.Parse("14:13:17.8763881"), m.Time);
#endif
Expand All @@ -101,7 +101,7 @@ protected class Model
public String AdImgUrl { get; set; }
public Type Type { get; set; }
public DateTimeOffset Offset { get; set; }
#if NET6_0_OR_GREATER
#if NET7_0_OR_GREATER
public DateOnly Date { get; set; }
public TimeOnly Time { get; set; }
#endif
Expand Down
2 changes: 2 additions & 0 deletions XUnitTest.Core/Web/JwtBuilderTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -363,6 +363,7 @@ public void RS512()
Assert.True(builder2["admin"].ToBoolean());
}

#if NETCOREAPP
[Fact]
public void ES256()
{
Expand Down Expand Up @@ -502,6 +503,7 @@ public void ES512()
Assert.Equal("NewLife", builder2["name"]);
Assert.True(builder2["admin"].ToBoolean());
}
#endif

[Fact]
public void Decode()
Expand Down
2 changes: 1 addition & 1 deletion XUnitTest.Core/XUnitTest.Core.csproj
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<Project Sdk="Microsoft.NET.Sdk" ToolsVersion="Current">
<PropertyGroup>
<TargetFrameworks>net462;net5.0;net6.0;net7.0;net8.0;net9.0</TargetFrameworks>
<TargetFrameworks>net462;net6.0;net8.0;net9.0</TargetFrameworks>
<IsPackable>false</IsPackable>
<RootNamespace>XUnitTest</RootNamespace>
<DebugType>pdbonly</DebugType>
Expand Down

0 comments on commit 9091e98

Please sign in to comment.