Skip to content

Commit cf7f44f

Browse files
committed
Fix and run tests
1 parent f456e39 commit cf7f44f

File tree

4 files changed

+70
-35
lines changed

4 files changed

+70
-35
lines changed

.github/workflows/dotnet-release.yml

+3-6
Original file line numberDiff line numberDiff line change
@@ -18,12 +18,9 @@ jobs:
1818
run: dotnet restore
1919
- name: Build Release
2020
run: dotnet build Castle.Windsor.sln -c Release
21-
- name: Castle.Windsor.Tests
22-
run: dotnet test src/Castle.Windsor.Tests
23-
- name: Castle.Windsor.Extensions.DependencyInjection.Tests
24-
run: dotnet test src/Castle.Windsor.Extensions.DependencyInjection.Tests
25-
- name: Castle.Facilities.AspNetCore.Tests
26-
run: dotnet test src/Castle.Facilities.AspNetCore.Tests
21+
- name: Test on .NET 6.0
22+
run: dotnet test -c Release -f net6.0 --no-build --no-restore -l "console;verbosity=detailed"
23+
2724
deploy:
2825
needs: build-ubuntu
2926
runs-on: ubuntu-latest

.github/workflows/dotnet.yml

+62-21
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,6 @@
11
name: .NET CI
22

33
on:
4-
push:
5-
paths-ignore:
6-
- '**.md'
7-
- '.github/**'
84
pull_request:
95
branches: [ master, main ]
106
paths-ignore:
@@ -13,32 +9,77 @@ on:
139

1410
jobs:
1511
build:
16-
12+
name: Build and test Linux
1713
runs-on: ubuntu-latest
1814

1915
steps:
2016
- uses: actions/checkout@v2
17+
18+
# Install all supported .NET versions
19+
- name: Install .NET Core 3.1
20+
uses: actions/setup-dotnet@v1
21+
with:
22+
dotnet-version: 3.1.x
23+
2124
- name: Setup .NET 6.0
2225
uses: actions/setup-dotnet@v1
2326
with:
2427
dotnet-version: 6.0.x
28+
29+
# Building requires an up-to-date .NET SDK.
30+
- name: Install .NET 7.0
31+
uses: actions/setup-dotnet@v1
32+
with:
33+
dotnet-version: 7.0.x
34+
35+
# Restore and build
2536
- name: Restore dependencies
26-
run: dotnet restore
37+
run: dotnet restore
2738
- name: Build Nuget Versions
28-
run: dotnet build ./tools/Explicit.NuGet.Versions/Explicit.NuGet.Versions.sln
39+
run: dotnet build ./tools/Explicit.NuGet.Versions/Explicit.NuGet.Versions.sln
2940
- name: Build Release
3041
run: dotnet build Castle.Windsor.sln -c Release
31-
- name: Castle.Windsor.Tests
32-
run: dotnet test src/Castle.Windsor.Tests
33-
- name: Castle.Windsor.Extensions.DependencyInjection.Tests
34-
run: dotnet test src/Castle.Windsor.Extensions.DependencyInjection.Tests
35-
- name: Castle.Facilities.AspNetCore.Tests
36-
run: dotnet test src/Castle.Facilities.AspNetCore.Tests
37-
- name: Castle.Facilities.AspNet.SystemWeb.Tests
38-
run: dotnet test src/Castle.Facilities.AspNet.SystemWeb.Tests
39-
- name: Castle.Facilities.AspNet.Mvc.Tests
40-
run: dotnet test src/Castle.Facilities.AspNet.Mvc.Tests
41-
- name: Castle.Facilities.AspNet.WebApi.Tests
42-
run: dotnet test src/Castle.Facilities.AspNet.WebApi.Tests
43-
- name: Castle.Facilities.WcfIntegration.Tests
44-
run: dotnet test src/Castle.Facilities.WcfIntegration.Tests
42+
43+
# Run tests for linux
44+
45+
- name: Test on .NET Core 3.1
46+
run: dotnet test -c Release -f netcoreapp3.1 --no-build --no-restore -l "console;verbosity=detailed"
47+
48+
- name: Test on .NET 6.0
49+
run: dotnet test -c Release -f net6.0 --no-build --no-restore -l "console;verbosity=detailed"
50+
51+
test-windows:
52+
name: Build and test on Windows
53+
runs-on: windows-latest
54+
55+
steps:
56+
- uses: actions/checkout@v2
57+
58+
# Several .NET Core versions will be used during the test run.
59+
# The lowest version gets installed first in order to prevent
60+
# "a newer version is already installed" install errors.
61+
62+
- name: Install .NET Core 2.1
63+
uses: actions/setup-dotnet@v1
64+
with:
65+
dotnet-version: 2.1.x
66+
67+
- name: Install .NET Core 3.1
68+
uses: actions/setup-dotnet@v1
69+
with:
70+
dotnet-version: 3.1.x
71+
72+
- name: Install .NET 6.0
73+
uses: actions/setup-dotnet@v1
74+
with:
75+
dotnet-version: 6.0.x
76+
77+
# Building requires an up-to-date .NET SDK.
78+
- name: Install .NET 7.0
79+
uses: actions/setup-dotnet@v1
80+
with:
81+
dotnet-version: 7.0.x
82+
83+
# Run tests on windows
84+
- name: Test on .NET Framework 4.6.2 (Windows only)
85+
run: dotnet test -c Release -f net462 -l "console;verbosity=detailed"

src/Castle.Windsor.Tests/Castle.Windsor.Tests.csproj

+2-6
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<Project Sdk="Microsoft.NET.Sdk">
22

33
<PropertyGroup>
4-
<TargetFrameworks>net462;netcoreapp3.1;net6.0</TargetFrameworks>
4+
<TargetFrameworks>net462;netcoreapp3.1;net6.0</TargetFrameworks>
55
</PropertyGroup>
66

77
<Import Project="..\..\buildscripts\common.props"></Import>
@@ -45,7 +45,7 @@
4545

4646
<ItemGroup>
4747
<PackageReference Include="NUnit" Version="3.13.3" />
48-
<PackageReference Include="NUnit3TestAdapter" Version="4.2.1" />
48+
<PackageReference Include="NUnit3TestAdapter" Version="3.16.1" />
4949
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.3.2" />
5050
</ItemGroup>
5151

@@ -69,8 +69,4 @@
6969
<Reference Include="WindowsBase" />
7070
</ItemGroup>
7171

72-
<PropertyGroup Condition="'$(TargetFramework)'=='net462'">
73-
<DefineConstants>$(DefineConstants);FEATURE_THREADABORT;FEATURE_WPF;FEATURE_CONSOLETRACELISTENER</DefineConstants>
74-
</PropertyGroup>
75-
7672
</Project>

src/Castle.Windsor.Tests/Config/ConfigurationTestCase.cs

+3-2
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
namespace Castle.MicroKernel.Tests.Configuration
1616
{
1717
using System.Collections.Generic;
18-
18+
using System.IO;
1919
using Castle.Core;
2020
using Castle.Core.Configuration;
2121
using Castle.Core.Resource;
@@ -218,7 +218,8 @@ public void ShouldNotThrowCircularDependencyException()
218218
[Test]
219219
public void Can_properly_populate_array_dependency_from_xml_config_when_registering_by_convention()
220220
{
221-
Container.Install(Configuration.FromXmlFile("config\\ComponentWithArrayDependency.config"))
221+
var path = Path.Combine("Config", "ComponentWithArrayDependency.config");
222+
Container.Install(Configuration.FromXmlFile(path))
222223
.Register(Component.For<IConfig>().ImplementedBy<Config>().Named("componentWithArrayDependency"));
223224
Container.Register(
224225
Classes.FromAssembly(GetCurrentAssembly()).Pick().WithServiceFirstInterface());

0 commit comments

Comments
 (0)