-
Notifications
You must be signed in to change notification settings - Fork 471
87 lines (63 loc) · 2.88 KB
/
build.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
name: Build
on: [ push, pull_request ]
env:
MONO_TAG: "6.0.0.334"
jobs:
build-and-test:
name: Build and test
strategy:
matrix:
os: [ ubuntu-latest, windows-latest, macos-13 ]
# NOTE: If we wanted to use `macos-latest` we would have to move the .NET Core 2.1 and 3.1 builds and test runs
# to a separate job. This is because `macos-14` and newer are ARM-only and those target frameworks don't support
# that architecture, causing `dotnet` to want to fall back to X64. However, once we install .NET 6 or newer,
# we get a toolchain that only has ARM support and no X64 support, so that fallback will no longer work.
# Using `macos-13` is (for the time being, while still available) the simpler solution as it is not ARM-based yet,
# so there won't be any architecture mismatch in the first place.
runs-on: ${{ matrix.os }}
steps:
- name: Checkout repository
uses: actions/checkout@v4
# Several .NET Core versions will be used during the test run.
# The lowest version gets installed first in order to prevent
# "a newer version is already installed" install errors.
- name: Install .NET Core 2.1
uses: actions/setup-dotnet@v4
with:
dotnet-version: 2.1.x
- name: Install .NET Core 3.1
uses: actions/setup-dotnet@v4
with:
dotnet-version: 3.1.x
- name: Install .NET 6.0
uses: actions/setup-dotnet@v4
with:
dotnet-version: 6.0.x
# Building requires an up-to-date .NET SDK.
- name: Install .NET 7.0
uses: actions/setup-dotnet@v4
with:
dotnet-version: 7.0.x
# -----
# Build
# -----
- name: Restore NuGet packages
run: dotnet restore
- name: Build all targets
run: dotnet build -c Release --no-restore
# ----
# Test
# ----
- name: Test on .NET Core 2.1
run: dotnet test -c Release -f netcoreapp2.1 --no-build --no-restore -l "console;verbosity=detailed"
- name: Test on .NET Core 3.1
run: dotnet test -c Release -f netcoreapp3.1 --no-build --no-restore -l "console;verbosity=detailed"
- name: Test on .NET 6.0
run: dotnet test -c Release -f net6.0 --no-build --no-restore -l "console;verbosity=detailed"
- name: Test on .NET Framework 4.6.2 (Windows only)
if: matrix.os == 'windows-latest'
run: dotnet test -c Release -f net462 --no-build --no-restore -l "console;verbosity=detailed"
- name: Test on .NET Framework 4.6.2 using Mono (Linux only)
if: matrix.os == 'ubuntu-latest'
run: |
docker run --rm -v "$PWD":'/project' -w='/project' mono:$MONO_TAG bash -c 'mono ./src/Castle.Core.Tests/bin/Release/net462/Castle.Core.Tests.exe && mono ./src/Castle.Core.Tests.WeakNamed/bin/Release/net462/Castle.Core.Tests.WeakNamed.exe'