Skip to content

Commit

Permalink
Merge pull request #323 from icsharpcode/update-unit-tests
Browse files Browse the repository at this point in the history
Fix unit testing for netcore3.1 and net6.0 targets.
  • Loading branch information
christophwille committed Dec 15, 2021
2 parents 953c924 + 17eafc3 commit 8090219
Show file tree
Hide file tree
Showing 4 changed files with 52 additions and 7 deletions.
56 changes: 49 additions & 7 deletions .github/workflows/dotnet.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,28 +26,70 @@ jobs:
version: ${{ env.BuildVersion }}.${{ github.run_number }}
assemblyVersion: ${{ env.BuildVersion }}.${{ github.run_number }}
fileVersion: ${{ env.BuildVersion }}.${{ github.run_number }}

- name: Setup .NET 3.1 (for unit tests only)
uses: actions/setup-dotnet@v1
with:
dotnet-version: 3.1.x

- name: Setup .NET
uses: actions/setup-dotnet@v1
with:
dotnet-version: 6.0.x
- name: Setup NuGet.exe
uses: nuget/setup-nuget@v1
- run: nuget restore ICSharpCode.AvalonEdit.sln

- name: Add msbuild to PATH
uses: microsoft/[email protected]

- run: msbuild ICSharpCode.AvalonEdit.sln /t:Restore /p:Configuration=${{ matrix.configuration }}

- name: Build
run: dotnet build ICSharpCode.AvalonEdit.sln --no-restore -c ${{ matrix.configuration }}
- name: Test
run: dotnet test ICSharpCode.AvalonEdit.sln --no-build --verbosity normal -c ${{ matrix.configuration }}
run: msbuild ICSharpCode.AvalonEdit.sln /p:Configuration=${{ matrix.configuration }}

- name: Setup VSTest
uses: Malcolmnixon/Setup-VSTest@v4

- name: net6.0-windows Unit Tests
run: vstest.console $env:TestAssembly
env:
TestAssembly: ICSharpCode.AvalonEdit.Tests\bin\${{ matrix.configuration }}\net6.0-windows\ICSharpCode.AvalonEdit.Tests.dll

- name: netcoreapp3.1 Unit Tests
run: vstest.console $env:TestAssembly
env:
TestAssembly: ICSharpCode.AvalonEdit.Tests\bin\${{ matrix.configuration }}\netcoreapp3.1\ICSharpCode.AvalonEdit.Tests.dll

- name: net45 Unit Tests
run: vstest.console $env:TestAssembly
env:
TestAssembly: ICSharpCode.AvalonEdit.Tests\bin\${{ matrix.configuration }}\net45\ICSharpCode.AvalonEdit.Tests.dll

- name: net40 Unit Tests
run: vstest.console $env:TestAssembly
env:
TestAssembly: ICSharpCode.AvalonEdit.Tests\bin\${{ matrix.configuration }}\net40\ICSharpCode.AvalonEdit.Tests.dll

- name: Style - tab check
run: python BuildTools\tidy.py

- name: Pack
run: dotnet pack ICSharpCode.AvalonEdit/ICSharpCode.AvalonEdit.csproj -c ${{ matrix.configuration }}
run: dotnet pack ICSharpCode.AvalonEdit/ICSharpCode.AvalonEdit.csproj -c ${{ matrix.configuration }}

- name: Upload NuGet
if: matrix.configuration == 'release'
uses: actions/upload-artifact@v2
with:
name: AvalonEdit NuGet Package (${{ matrix.configuration }})
path: ICSharpCode.AvalonEdit/bin/Release/AvalonEdit*.nupkg
if-no-files-found: error

- name: Upload Snupkg Artifact
if: matrix.configuration == 'release'
uses: actions/upload-artifact@v2
with:
name: AvalonEdit Snupkg (${{ matrix.configuration }})
path: ICSharpCode.AvalonEdit/bin/Release/AvalonEdit*.snupkg
if-no-files-found: error

- name: Publish NuGet
if: github.ref == 'refs/heads/master' && matrix.configuration == 'release'
run: |
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
namespace ICSharpCode.AvalonEdit.Editing
{
[TestFixture]
[Apartment(System.Threading.ApartmentState.STA)]
public class ChangeDocumentTests
{
[Test]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@
<PackageReference Include="Newtonsoft.Json" Version="12.0.3" />
<PackageReference Include="NUnit" Version="3.13.2" />
<PackageReference Include="NUnit3TestAdapter" Version="4.1.0" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.0.0" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\ICSharpCode.AvalonEdit\ICSharpCode.AvalonEdit.csproj" />
Expand Down
1 change: 1 addition & 0 deletions ICSharpCode.AvalonEdit.Tests/WeakReferenceTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
namespace ICSharpCode.AvalonEdit
{
[TestFixture]
[Apartment(System.Threading.ApartmentState.STA)]
public class WeakReferenceTests
{
[Test]
Expand Down

0 comments on commit 8090219

Please sign in to comment.