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

Add GitHub actions #655

Open
wants to merge 8 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 7 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
34 changes: 34 additions & 0 deletions .github/workflows/build-test-linux.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
name: Build and test on linux

on:
workflow_call:

jobs:
build:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v3

# Building requires an up-to-date .NET SDK.
- name: Setup dotnet
uses: actions/setup-dotnet@v3
with:
dotnet-version: |
6.0.x
7.0.x

# Restore and build
- name: Restore dependencies
run: dotnet restore
- name: Build Nuget Versions
run: dotnet build ./tools/Explicit.NuGet.Versions/Explicit.NuGet.Versions.sln
- name: Build Release
run: dotnet build Castle.Windsor.sln -c Release

# Run tests for linux
- name: Test on .NET 6.0
run: |
dotnet test src/Castle.Windsor.Tests -c Release -f net6.0 --no-build --no-restore -l "console;verbosity=detailed"
dotnet test src/Castle.Facilities.AspNetCore.Tests -c Release -f net6.0 --no-build --no-restore -l "console;verbosity=detailed"
dotnet test src/Castle.Windsor.Extensions.DependencyInjection.Tests -c Release -f net6.0 --no-build --no-restore -l "console;verbosity=detailed"
34 changes: 34 additions & 0 deletions .github/workflows/build-test-win.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
name: Build and test on Windows

on:
workflow_call:

jobs:
build:
runs-on: windows-latest

steps:
- uses: actions/checkout@v3

# Building requires an up-to-date .NET SDK.
- name: Setup dotnet
uses: actions/setup-dotnet@v3
with:
dotnet-version: |
6.0.x
7.0.x

# Restore and build
- name: Restore dependencies
run: dotnet restore
- name: Build Release
run: dotnet build Castle.Windsor.sln -c Release

# Run tests on windows
- name: Test on .NET Framework 4.6.2 (Windows only)
run: |
dotnet test src/Castle.Windsor.Tests -c Release -f net462 --no-build --no-restore -l "console;verbosity=detailed"
dotnet test src/Castle.Facilities.AspNet.Mvc.Tests -c Release -f net462 --no-build --no-restore -l "console;verbosity=detailed"
dotnet test src/Castle.Facilities.AspNet.SystemWeb.Tests -c Release -f net462 --no-build --no-restore -l "console;verbosity=detailed"
dotnet test src/Castle.Facilities.AspNet.WebApi.Tests -c Release -f net462 --no-build --no-restore -l "console;verbosity=detailed"
dotnet test src/Castle.Facilities.WcfIntegration.Tests -c Release -f net462 --no-build --no-restore -l "console;verbosity=detailed"
43 changes: 43 additions & 0 deletions .github/workflows/dotnet-release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
name: .NET Release

on:
push:
tags:
- 'v*.*.*'

jobs:
build-lin:
name: Build and test Linux
uses: ./.github/workflows/build-test-linux.yml

build-win:
name: Build and test on Windows
uses: ./.github/workflows/build-test-win.yml

deploy:
needs: [build-lin, build-win]
Toxantron marked this conversation as resolved.
Show resolved Hide resolved
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3

# Building requires an up-to-date .NET SDK.
- name: Setup dotnet
uses: actions/setup-dotnet@v3
with:
dotnet-version: |
6.0.x
7.0.x

- name: Restore dependencies
run: dotnet restore
- name: Get the version
id: get_version
run: echo ::set-output name=VERSION::$(echo $GITHUB_REF | cut -d / -f 3 | cut -d "v" -f 2)

- name: Build
run: dotnet build Castle.Windsor.sln --configuration Release
- name: Pack
run: dotnet pack Castle.Windsor.sln -c Release -o artifacts -p:PackageVersion=${{ steps.get_version.outputs.VERSION }}

- name: Push generated Rebus package to GitHub registry
Toxantron marked this conversation as resolved.
Show resolved Hide resolved
run: dotnet nuget push artifacts -k ${{secrets.NUGET_SECRET_KEY}} -s https://api.nuget.org/v3/index.json --skip-duplicate --no-symbols
16 changes: 16 additions & 0 deletions .github/workflows/dotnet.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
name: .NET CI

on:
pull_request:
branches: [ master, main ]
paths-ignore:
- '**.md'

jobs:
build-lin:
name: Build and test Linux
uses: ./.github/workflows/build-test-linux.yml

build-win:
name: Build and test on Windows
uses: ./.github/workflows/build-test-win.yml
8 changes: 6 additions & 2 deletions Castle.Windsor.sln
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio Version 16
VisualStudioVersion = 16.0.30711.63
# Visual Studio Version 17
VisualStudioVersion = 17.7.33913.275
MinimumVisualStudioVersion = 10.0.40219.1
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Castle.Windsor", "src\Castle.Windsor\Castle.Windsor.csproj", "{5F6A631E-8EB1-4BC1-826D-86D3059945B8}"
EndProject
Expand All @@ -20,9 +20,13 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Castle Build", "Castle Buil
.gitattributes = .gitattributes
.gitignore = .gitignore
appveyor.yml = appveyor.yml
.github\workflows\build-test-linux.yml = .github\workflows\build-test-linux.yml
.github\workflows\build-test-win.yml = .github\workflows\build-test-win.yml
build.cmd = build.cmd
CHANGELOG.md = CHANGELOG.md
CONTRIBUTING.md = CONTRIBUTING.md
.github\workflows\dotnet-release.yml = .github\workflows\dotnet-release.yml
.github\workflows\dotnet.yml = .github\workflows\dotnet.yml
LICENSE = LICENSE
README.md = README.md
EndProjectSection
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
<PackageReference Include="Microsoft.TestPlatform.ObjectModel" Version="11.0.0" />
<PackageReference Include="Microsoft.Web.Infrastructure" Version="1.0.0" />
<PackageReference Include="NUnit" Version="3.13.3" />
<PackageReference Include="NUnit3TestAdapter" Version="4.2.1" />
<PackageReference Include="NUnit3TestAdapter" Version="4.5.0" />
</ItemGroup>

<ItemGroup>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.3.2" />
<PackageReference Include="Microsoft.TestPlatform.ObjectModel" Version="11.0.0" />
<PackageReference Include="NUnit" Version="3.13.3" />
<PackageReference Include="NUnit3TestAdapter" Version="4.2.1" />
<PackageReference Include="NUnit3TestAdapter" Version="4.5.0" />
</ItemGroup>

<ItemGroup>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
<PackageReference Include="Microsoft.TestPlatform.ObjectModel" Version="11.0.0" />
<PackageReference Include="Microsoft.Web.Infrastructure" Version="1.0.0" />
<PackageReference Include="NUnit" Version="3.13.3" />
<PackageReference Include="NUnit3TestAdapter" Version="4.2.1" />
<PackageReference Include="NUnit3TestAdapter" Version="4.5.0" />
</ItemGroup>

<ItemGroup>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
<Project Sdk="Microsoft.NET.Sdk">
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFramework>netcoreapp3.1</TargetFramework>
<TargetFramework>net6.0</TargetFramework>
</PropertyGroup>

<ItemGroup>
<!-- This is an intentional upgrade to NUnit. This is the solution for https://github.com/castleproject/Windsor/issues/243 once we upgrade NUnit and make dotnet test a first class citizen-->
<PackageReference Include="NUnit" Version="3.13.3" />
<PackageReference Include="NUnit3TestAdapter" Version="4.2.1" />
<PackageReference Include="NUnit3TestAdapter" Version="4.5.0" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.3.2" />
<PackageReference Include="Microsoft.AspNetCore" Version="2.0.1" />
<PackageReference Include="Microsoft.AspNetCore.Mvc" Version="2.0.2" />
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<Project Sdk="Microsoft.NET.Sdk">
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFramework>netstandard2.0</TargetFramework>
Expand All @@ -18,12 +18,12 @@
<RootNamespace>Castle.Facilities.AspNetCore</RootNamespace>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Microsoft.AspNetCore" Version="2.0.1" />
<PackageReference Include="Microsoft.AspNetCore.Mvc" Version="2.0.2" />
<PackageReference Include="Microsoft.AspNetCore.Mvc.Razor" Version="2.0.2" />
<PackageReference Include="Microsoft.Extensions.Logging" Version="2.0.0" />
</ItemGroup>
<ItemGroup>
<PackageReference Include="Microsoft.AspNetCore" Version="2.0.1" />
<PackageReference Include="Microsoft.AspNetCore.Mvc" Version="2.0.2" />
<PackageReference Include="Microsoft.AspNetCore.Mvc.Razor" Version="2.0.2" />
<PackageReference Include="Microsoft.Extensions.Logging" Version="2.0.0" />
</ItemGroup>

<ItemGroup>
<ProjectReference Include="..\Castle.Windsor\Castle.Windsor.csproj" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
<ItemGroup>
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.3.2" />
<PackageReference Include="NUnit" Version="3.13.3" />
<PackageReference Include="NUnit3TestAdapter" Version="4.2.1" />
<PackageReference Include="NUnit3TestAdapter" Version="4.5.0" />
</ItemGroup>

<ItemGroup>
Expand Down
9 changes: 5 additions & 4 deletions src/Castle.Windsor.Tests/Castle.Windsor.Tests.csproj
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFrameworks>net462;netcoreapp3.1;net6.0</TargetFrameworks>
<TargetFrameworks>net462;netcoreapp3.1;net6.0</TargetFrameworks>
</PropertyGroup>

<Import Project="..\..\buildscripts\common.props"></Import>
Expand Down Expand Up @@ -47,13 +47,14 @@
<PackageReference Include="Castle.Core-log4net" Version="[5.1.0,6.0)" />
<PackageReference Include="Castle.Core-NLog" Version="[5.1.0,6.0)" />
<PackageReference Include="NUnit" Version="3.13.3" />
<PackageReference Include="NUnit3TestAdapter" Version="4.2.1" />
<PackageReference Include="NUnit3TestAdapter" Version="4.5.0" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.3.2" />
</ItemGroup>

<ItemGroup Condition="'$(TargetFramework)'=='net462'">
<PackageReference Include="Microsoft.TestPlatform.ObjectModel" Version="11.0.0" />
</ItemGroup>

<ItemGroup>
<ProjectReference Include="..\Castle.Facilities.Logging\Castle.Facilities.Logging.csproj" />
<ProjectReference Include="..\Castle.Windsor\Castle.Windsor.csproj" />
Expand All @@ -68,7 +69,7 @@
<Reference Include="WindowsBase" />
</ItemGroup>

<PropertyGroup Condition="'$(TargetFramework)'=='net462'">
<PropertyGroup Condition="'$(TargetFramework)'=='net462'">
<DefineConstants>$(DefineConstants);FEATURE_THREADABORT;FEATURE_WPF;FEATURE_CONSOLETRACELISTENER</DefineConstants>
</PropertyGroup>

Expand Down
5 changes: 3 additions & 2 deletions src/Castle.Windsor.Tests/Config/ConfigurationTestCase.cs
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
namespace Castle.MicroKernel.Tests.Configuration
{
using System.Collections.Generic;

using System.IO;
using Castle.Core;
using Castle.Core.Configuration;
using Castle.Core.Resource;
Expand Down Expand Up @@ -218,7 +218,8 @@ public void ShouldNotThrowCircularDependencyException()
[Test]
public void Can_properly_populate_array_dependency_from_xml_config_when_registering_by_convention()
{
Container.Install(Configuration.FromXmlFile("config\\ComponentWithArrayDependency.config"))
var path = Path.Combine("Config", "ComponentWithArrayDependency.config");
Container.Install(Configuration.FromXmlFile(path))
.Register(Component.For<IConfig>().ImplementedBy<Config>().Named("componentWithArrayDependency"));
Container.Register(
Classes.FromAssembly(GetCurrentAssembly()).Pick().WithServiceFirstInterface());
Expand Down
5 changes: 3 additions & 2 deletions src/Castle.Windsor.Tests/LoggingFacility/BaseTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ namespace Castle.Facilities.Logging.Tests
using Castle.Services.Logging.Log4netIntegration;
using Castle.Services.Logging.NLogIntegration;
using Castle.Windsor;
using System.IO;

/// <summary>
/// Summary description for BaseTest.
Expand All @@ -42,12 +43,12 @@ protected string GetConfigFile<TLoggerFactory>()
if (typeof(TLoggerFactory) == typeof(Log4netFactory) ||
typeof(TLoggerFactory) == typeof(ExtendedLog4netFactory))
{
return "LoggingFacility\\log4net.facilities.test.config";
return Path.Combine("LoggingFacility", "log4net.facilities.test.config");
}
if (typeof(TLoggerFactory) == typeof(NLogFactory) ||
typeof(TLoggerFactory) == typeof(ExtendedNLogFactory))
{
return "LoggingFacility\\NLog.facilities.test.config";
return Path.Combine("LoggingFacility", "NLog.facilities.test.config");
}
return string.Empty;
}
Expand Down