Skip to content

Commit 31cc0a8

Browse files
author
Thomas Fuchs
committed
Split workflows for reuse
1 parent 4701c61 commit 31cc0a8

File tree

5 files changed

+82
-71
lines changed

5 files changed

+82
-71
lines changed
Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
name: Build and test on linux
2+
3+
on:
4+
workflow_call:
5+
6+
jobs:
7+
build:
8+
runs-on: ubuntu-latest
9+
10+
steps:
11+
- uses: actions/checkout@v3
12+
13+
# Building requires an up-to-date .NET SDK.
14+
- name: Setup dotnet
15+
uses: actions/setup-dotnet@v3
16+
with:
17+
dotnet-version: |
18+
6.0.x
19+
7.0.x
20+
21+
# Restore and build
22+
- name: Restore dependencies
23+
run: dotnet restore
24+
- name: Build Nuget Versions
25+
run: dotnet build ./tools/Explicit.NuGet.Versions/Explicit.NuGet.Versions.sln
26+
- name: Build Release
27+
run: dotnet build Castle.Windsor.sln -c Release
28+
29+
# Run tests for linux
30+
- name: Test on .NET 6.0
31+
run: |
32+
dotnet test src/Castle.Windsor.Tests -c Release -f net6.0 --no-build --no-restore -l "console;verbosity=detailed"
33+
dotnet test src/Castle.Windsor.Extensions.DependencyInjection.Tests -c Release -f net6.0 --no-build --no-restore -l "console;verbosity=detailed"
Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
name: Build and test on Windows
2+
3+
on:
4+
workflow_call:
5+
6+
jobs:
7+
build:
8+
runs-on: windows-latest
9+
10+
steps:
11+
- uses: actions/checkout@v3
12+
13+
# Building requires an up-to-date .NET SDK.
14+
- name: Setup dotnet
15+
uses: actions/setup-dotnet@v3
16+
with:
17+
dotnet-version: |
18+
6.0.x
19+
7.0.x
20+
21+
# Restore and build
22+
- name: Restore dependencies
23+
run: dotnet restore
24+
- name: Build Release
25+
run: dotnet build Castle.Windsor.sln -c Release
26+
27+
# Run tests on windows
28+
- name: Test on .NET Framework 4.6.2 (Windows only)
29+
run: |
30+
dotnet test src/Castle.Windsor.Tests -c Release -f net462 --no-build --no-restore -l "console;verbosity=detailed"
31+
dotnet test src/Castle.Facilities.AspNet.Mvc.Tests -c Release -f net462 --no-build --no-restore -l "console;verbosity=detailed"
32+
dotnet test src/Castle.Facilities.AspNet.SystemWeb.Tests -c Release -f net462 --no-build --no-restore -l "console;verbosity=detailed"
33+
dotnet test src/Castle.Facilities.AspNet.WebApi.Tests -c Release -f net462 --no-build --no-restore -l "console;verbosity=detailed"
34+
dotnet test src/Castle.Facilities.WcfIntegration.Tests -c Release -f net462 --no-build --no-restore -l "console;verbosity=detailed"

.github/workflows/dotnet-release.yml

Lines changed: 9 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -6,26 +6,19 @@ on:
66
- 'v*.*.*'
77

88
jobs:
9-
build-ubuntu:
10-
runs-on: ubuntu-latest
11-
steps:
12-
- uses: actions/checkout@v2
13-
- name: Setup .NET 7.0
14-
uses: actions/setup-dotnet@v1
15-
with:
16-
dotnet-version: 7.0.x
17-
- name: Restore dependencies
18-
run: dotnet restore
19-
- name: Build Release
20-
run: dotnet build Castle.Windsor.sln -c Release
21-
- name: Test on .NET 6.0
22-
run: dotnet test -c Release -f net6.0 --no-build --no-restore -l "console;verbosity=detailed"
9+
build-lin:
10+
name: Build and test Linux
11+
uses: ./.github/workflows/build-test-linux.yml
12+
13+
build-win:
14+
name: Build and test on Windows
15+
uses: ./.github/workflows/build-test-win.yml
2316

2417
deploy:
25-
needs: build-ubuntu
18+
needs: [build-lin, build-win]
2619
runs-on: ubuntu-latest
2720
steps:
28-
- uses: actions/checkout@v2
21+
- uses: actions/checkout@v3
2922
- name: Setup .NET Core
3023
uses: actions/setup-dotnet@v1
3124
with:

.github/workflows/dotnet.yml

Lines changed: 4 additions & 55 deletions
Original file line numberDiff line numberDiff line change
@@ -7,61 +7,10 @@ on:
77
- '**.md'
88

99
jobs:
10-
build:
10+
build-lin:
1111
name: Build and test Linux
12-
runs-on: ubuntu-latest
13-
14-
steps:
15-
- uses: actions/checkout@v2
16-
17-
# Building requires an up-to-date .NET SDK.
18-
- name: Setup dotnet
19-
uses: actions/setup-dotnet@v3
20-
with:
21-
dotnet-version: |
22-
6.0.x
23-
7.0.x
24-
25-
# Restore and build
26-
- name: Restore dependencies
27-
run: dotnet restore
28-
- name: Build Nuget Versions
29-
run: dotnet build ./tools/Explicit.NuGet.Versions/Explicit.NuGet.Versions.sln
30-
- name: Build Release
31-
run: dotnet build Castle.Windsor.sln -c Release
32-
33-
# Run tests for linux
34-
- name: Test on .NET 6.0
35-
run: |
36-
dotnet test src/Castle.Windsor.Tests -c Release -f net6.0 --no-build --no-restore -l "console;verbosity=detailed"
37-
dotnet test src/Castle.Windsor.Extensions.DependencyInjection.Tests -c Release -f net6.0 --no-build --no-restore -l "console;verbosity=detailed"
12+
uses: ./.github/workflows/build-test-linux.yml
3813

39-
test-windows:
14+
build-win:
4015
name: Build and test on Windows
41-
runs-on: windows-latest
42-
43-
steps:
44-
- uses: actions/checkout@v2
45-
46-
# Building requires an up-to-date .NET SDK.
47-
- name: Setup dotnet
48-
uses: actions/setup-dotnet@v3
49-
with:
50-
dotnet-version: |
51-
6.0.x
52-
7.0.x
53-
54-
# Restore and build
55-
- name: Restore dependencies
56-
run: dotnet restore
57-
- name: Build Release
58-
run: dotnet build Castle.Windsor.sln -c Release
59-
60-
# Run tests on windows
61-
- name: Test on .NET Framework 4.6.2 (Windows only)
62-
run: |
63-
dotnet test src/Castle.Windsor.Tests -c Release -f net462 --no-build --no-restore -l "console;verbosity=detailed"
64-
dotnet test src/Castle.Facilities.AspNet.Mvc.Tests -c Release -f net462 --no-build --no-restore -l "console;verbosity=detailed"
65-
dotnet test src/Castle.Facilities.AspNet.SystemWeb.Tests -c Release -f net462 --no-build --no-restore -l "console;verbosity=detailed"
66-
dotnet test src/Castle.Facilities.AspNet.WebApi.Tests -c Release -f net462 --no-build --no-restore -l "console;verbosity=detailed"
67-
dotnet test src/Castle.Facilities.WcfIntegration.Tests -c Release -f net462 --no-build --no-restore -l "console;verbosity=detailed"
16+
uses: ./.github/workflows/build-test-win.yml

Castle.Windsor.sln

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,8 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Castle Build", "Castle Buil
2020
.gitattributes = .gitattributes
2121
.gitignore = .gitignore
2222
appveyor.yml = appveyor.yml
23+
.github\workflows\build-test-linux.yml = .github\workflows\build-test-linux.yml
24+
.github\workflows\build-test-win.yml = .github\workflows\build-test-win.yml
2325
build.cmd = build.cmd
2426
CHANGELOG.md = CHANGELOG.md
2527
CONTRIBUTING.md = CONTRIBUTING.md

0 commit comments

Comments
 (0)