Skip to content

Commit 9d3eb3d

Browse files
committed
Add Windows tests to CI
1 parent 7eb1500 commit 9d3eb3d

File tree

11 files changed

+66
-16
lines changed

11 files changed

+66
-16
lines changed

.github/workflows/build.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ jobs:
1717
strategy:
1818
fail-fast: false
1919
matrix:
20-
os: [macos-latest]
20+
os: [ubuntu-latest, windows-latest, macos-latest]
2121
configuration: [Release, Debug]
2222

2323
steps:

.github/workflows/test.yml

Lines changed: 19 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ jobs:
1717
strategy:
1818
fail-fast: false
1919
matrix:
20-
os: [macos-latest]
20+
os: [macos-latest, windows-latest]
2121
configuration: [Release]
2222

2323
steps:
@@ -29,9 +29,26 @@ jobs:
2929
with:
3030
dotnet-version: '6.x'
3131

32-
- name: Install Mono
32+
- name: Install Mono - Ubuntu
33+
if: matrix.os == 'ubuntu-latest'
34+
run: |
35+
sudo apt install ca-certificates gnupg
36+
sudo gpg --homedir /tmp --no-default-keyring --keyring gnupg-ring:/usr/share/keyrings/mono-official-archive-keyring.gpg --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys 3FA7E0328081BFF6A14DA29AA6A19B38D3D831EF
37+
sudo chmod +r /usr/share/keyrings/mono-official-archive-keyring.gpg
38+
echo "deb [signed-by=/usr/share/keyrings/mono-official-archive-keyring.gpg] https://download.mono-project.com/repo/ubuntu stable-focal main" | sudo tee /etc/apt/sources.list.d/mono-official-stable.list
39+
sudo apt update
40+
sudo apt install mono-complete mono-vbnc
41+
42+
- name: Install Mono - macOS
43+
if: matrix.os == 'macos-latest'
3344
run: |
3445
brew install --cask mono-mdk
3546
47+
- name: Install Mono - Windows
48+
if: matrix.os == 'windows-latest'
49+
run: |
50+
winget install Mono.Mono --accept-source-agreements --accept-package-agreements
51+
echo "PATH=$env:PATH;C:\Program Files\Mono\bin" >> $env:GITHUB_ENV
52+
3653
- name: Run tests
3754
run: make prepare all check CONFIGURATION=${{ matrix.configuration }}

Makefile

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,13 +22,13 @@ clean:
2222
check: build check-monodoc check-mdoc
2323

2424
check-mdoc:
25-
cd mdoc; $(MAKE) check -B
25+
$(MAKE) check -B -C mdoc
2626

2727
nuget:
2828
nuget pack mdoc/mdoc.nuspec -outputdirectory bin/Nuget
2929

3030
check-monodoc:
31-
cd monodoc; $(MAKE) check -B
31+
$(MAKE) check -B -C monodoc
3232

3333
zip:
3434
rm -f $(BIN)/mdoc*.zip
8 KB
Binary file not shown.

external/Test/DocTest-VB-Eii.dll

6.5 KB
Binary file not shown.
8.5 KB
Binary file not shown.
26 KB
Binary file not shown.

external/Test/mdoc.Test.FSharp.dll

0 Bytes
Binary file not shown.

mdoc/Makefile

Lines changed: 38 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
CONFIGURATION = Release
22
PROGRAM = ../bin/$(CONFIGURATION)/mdoc.exe
3-
MONO = mono
3+
MONO = $(if $(filter Windows_NT,$(OS)),,mono)
44
CSCOMPILE = mcs
55
VBCOMPILE = vbnc
66
TEST_CSCFLAGS = -target:library
@@ -47,8 +47,8 @@ EXTRA_DISTFILES = \
4747
MULTI-CLASSIC = Test/DocTest-DropNS-classic.dll Test/DocTest-DropNS-classic-multitest.dll
4848
MULTI-UNIFIED = Test/DocTest-DropNS-unified.dll Test/DocTest-DropNS-unified-multitest.dll
4949

50-
DIFF = diff -rup
51-
DIFF_QUIET = diff --brief
50+
DIFF = diff -rup $(if $(filter Windows_NT,$(OS)),--strip-trailing-cr,)
51+
DIFF_QUIET = diff --brief $(if $(filter Windows_NT,$(OS)),--strip-trailing-cr,)
5252

5353
ifeq ($(ENVIRONMENT),wsl)
5454
DIFF = diff -rup -Z
@@ -59,11 +59,40 @@ cleanup:
5959
-rm -Rf Test/en.actual Test/html.actual
6060

6161
nunit:
62-
mono ../packages/NUnit.ConsoleRunner.3.6.0/tools/nunit3-console.exe mdoc.Test/bin/$(CONFIGURATION)/mdoc.Test.dll
62+
$(MONO) ../packages/NUnit.ConsoleRunner.3.6.0/tools/nunit3-console.exe mdoc.Test/bin/$(CONFIGURATION)/mdoc.Test.dll
63+
64+
ifeq ($(filter Windows_NT,$(OS)),)
6365

6466
Test/DocTest-VB-Eii.dll:
6567
$(VBCOMPILE) -out:Test/DocTest-VB-Eii.dll Test/ClassEnumerator.vb
6668

69+
../mdoc/mdoc.Test/mdoc.Test.FSharp/bin/Release/mdoc.Test.FSharp.dll:
70+
msbuild ../mdoc/mdoc.Test/mdoc.Test.FSharp/mdoc.Test.FSharp.fsproj -property:Configuration=Release
71+
72+
Test/TestInterfaceImplementation/bin/Release/TestInterfaceImplementation.dll:
73+
msbuild ../mdoc/Test/TestInterfaceImplementation/TestInterfaceImplementation.csproj -property:Configuration=Release
74+
75+
Test/AttachedEventsAndProperties/bin/Release/AttachedEventsAndProperties.dll:
76+
msbuild ../mdoc/Test/AttachedEventsAndProperties/AttachedEventsAndProperties.csproj -property:Configuration=Release
77+
78+
else # Full .NET Framework has extra attributes and slightly different generated types
79+
80+
Test/DocTest-VB-Eii.dll:
81+
cp ../external/Test/DocTest-VB-Eii.dll Test/DocTest-VB-Eii.dll
82+
83+
../mdoc/mdoc.Test/mdoc.Test.FSharp/bin/Release/mdoc.Test.FSharp.dll:
84+
cp ../external/Test/mdoc.Test.FSharp.dll ../mdoc/mdoc.Test/mdoc.Test.FSharp/bin/Release/mdoc.Test.FSharp.dll
85+
86+
Test/TestInterfaceImplementation/bin/Release/TestInterfaceImplementation.dll:
87+
mkdir -p Test/TestInterfaceImplementation/bin/Release/
88+
cp ../external/Test/TestInterfaceImplementation.dll Test/TestInterfaceImplementation/bin/Release/TestInterfaceImplementation.dll
89+
90+
Test/AttachedEventsAndProperties/bin/Release/AttachedEventsAndProperties.dll:
91+
mkdir -p Test/AttachedEventsAndProperties/bin/Release/
92+
cp ../external/Test/AttachedEventsAndProperties.dll Test/AttachedEventsAndProperties/bin/Release/AttachedEventsAndProperties.dll
93+
94+
endif
95+
6796
Test/DocTest-addNonGeneric.dll:
6897
$(CSCOMPILE) $(TEST_CSCFLAGS) -unsafe -debug -optimize -target:library -out:$@ Test/DocTest-addNonGeneric.cs
6998

@@ -174,7 +203,7 @@ Test/DocTest-typeForwards-Third.dll:
174203
$(CSCOMPILE) $(TEST_CSCFLAGS) -unsafe -debug -optimize -target:library -out:Test/DocTest-typeForwards-Third-First.dll /reference:$@ Test/DocTest-typeForwards.cs /define:THIRD
175204

176205
Test/DocTest-TypeProjection.dll:
177-
rm -f DocTest-TypeProjection.dll
206+
rm -f $@
178207
$(CSCOMPILE) $(TEST_CSCFLAGS) -unsafe -debug -optimize -target:library -out:$@ Test/DocTest-TypeProjection.cs
179208

180209
# build test dll to test forwardings nested type
@@ -183,7 +212,7 @@ Test/DocTest-nestedType-typeForwards-First.dll:
183212
$(CSCOMPILE) $(TEST_CSCFLAGS) -unsafe -debug -optimize -target:library -out:$@ Test/DocTest-nestedType-typeForwards.cs /define:FIRST
184213

185214
Test/DocTest-LongFileName.dll:
186-
rm -f DocTest-LongFileName.dll
215+
rm -f $@
187216
$(CSCOMPILE) $(TEST_CSCFLAGS) -unsafe -debug -optimize -target:library -out:$@ Test/DocTest-LongFileName.cs
188217

189218
.PHONY: Test/DocTest-nestedType-typeForwards-Second.dll
@@ -670,7 +699,7 @@ check-monodocer-fx-statistics-remove:
670699

671700
check-monodocer-fsharp:
672701
-rm -Rf Test/en.actual
673-
msbuild ../mdoc/mdoc.Test/mdoc.Test.FSharp/mdoc.Test.FSharp.fsproj -property:Configuration=Release
702+
$(MAKE) ../mdoc/mdoc.Test/mdoc.Test.FSharp/bin/Release/mdoc.Test.FSharp.dll
674703
$(MONO) $(PROGRAM) update -lang fsharp -o Test/en.actual ../mdoc/mdoc.Test/mdoc.Test.FSharp/bin/Release/mdoc.Test.FSharp.dll
675704

676705
ifeq ($(ENVIRONMENT), wsl)
@@ -682,7 +711,7 @@ endif
682711

683712
check-monodocer-members-implementation:
684713
-rm -Rf Test/en.actual
685-
msbuild ../mdoc/Test/TestInterfaceImplementation/TestInterfaceImplementation.csproj -property:Configuration=Release
714+
$(MAKE) Test/TestInterfaceImplementation/bin/Release/TestInterfaceImplementation.dll
686715
$(MONO) $(PROGRAM) update -o Test/en.actual Test/TestInterfaceImplementation/bin/Release/TestInterfaceImplementation.dll
687716
$(DIFF) Test/en.expected.members-implementation Test/en.actual
688717

@@ -768,7 +797,7 @@ check-monodocer-import-fx-update: check-monodocer-import-fx-work
768797

769798
check-monodocer-attached-entities:
770799
-rm -Rf Test/en.actual
771-
msbuild ../mdoc/Test/AttachedEventsAndProperties/AttachedEventsAndProperties.csproj -property:Configuration=Release
800+
$(MAKE) Test/AttachedEventsAndProperties/bin/Release/AttachedEventsAndProperties.dll
772801
$(MONO) $(PROGRAM) update --debug -o Test/en.actual Test/AttachedEventsAndProperties/bin/Release/AttachedEventsAndProperties.dll -lang docid -lang vb.net -lang fsharp -lang javascript -lang c++/cli -lang c++/cx -lang c++/winrt
773802
$(DIFF) Test/en.expected-attached-entities Test/en.actual
774803

mdoc/mdoc.Test/MDocFileSourceTests.cs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
using System.Collections.Generic;
33
using System.IO;
44
using System.Linq;
5+
using System.Runtime.InteropServices;
56
using System.Xml.Linq;
67
using Mono.Documentation;
78
using Mono.Documentation.Framework;
@@ -406,7 +407,9 @@ public void GetTypeXmlPath_ShouldReturnCorrectPath_WhenTypeIsDropped()
406407
string result = fileSource.GetTypeXmlPath(basePath, nsName, typeName);
407408

408409
// Assert
409-
string expectedResult = "basePath/DroppedNamespace.Namespace/TypeName.xml";
410+
string expectedResult = RuntimeInformation.IsOSPlatform(OSPlatform.Windows)
411+
? "basePath\\DroppedNamespace.Namespace\\TypeName.xml"
412+
: "basePath/DroppedNamespace.Namespace/TypeName.xml";
410413
Assert.AreEqual(expectedResult, result);
411414
}
412415

0 commit comments

Comments
 (0)