Skip to content
Draft
Show file tree
Hide file tree
Changes from all 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
46 changes: 46 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
name: Build

on:
push:
branches: [ main, master, dev/** ]
pull_request:
branches: [ main, master ]

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: ${{ github.ref != 'refs/heads/main' && github.ref != 'refs/heads/master' }}

jobs:
build:
runs-on: ${{ matrix.os }}

strategy:
fail-fast: false
matrix:
os: [windows-latest, macos-latest]
configuration: [Release]

steps:
- name: Checkout code
uses: actions/checkout@v4

- name: Setup .NET
uses: actions/setup-dotnet@v4
with:
dotnet-version: '6.x'

- name: Install Mono - macOS
if: matrix.os == 'macos-latest'
run: |
brew install --cask mono-mdk

- name: Build and pack
run: make prepare build nuget CONFIGURATION=${{ matrix.configuration }}

- name: Upload build artifacts
uses: actions/upload-artifact@v4
with:
name: build-artifacts-${{ matrix.os }}-${{ matrix.configuration }}
path: |
bin/Nuget/
retention-days: 7
44 changes: 44 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
name: Tests

on:
push:
branches: [ main, master, dev/** ]
pull_request:
branches: [ main, master ]

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: ${{ github.ref != 'refs/heads/main' && github.ref != 'refs/heads/master' }}

jobs:
test:
runs-on: ${{ matrix.os }}

strategy:
fail-fast: false
matrix:
os: [macos-latest, windows-latest]
configuration: [Release]

steps:
- name: Checkout code
uses: actions/checkout@v4

- name: Setup .NET
uses: actions/setup-dotnet@v4
with:
dotnet-version: '6.x'

- name: Install Mono - macOS
if: matrix.os == 'macos-latest'
run: |
brew install --cask mono-mdk

- name: Install Mono - Windows
if: matrix.os == 'windows-latest'
run: |
winget install Mono.Mono --accept-source-agreements --accept-package-agreements
echo "PATH=$env:PATH;C:\Program Files\Mono\bin" >> $env:GITHUB_ENV

- name: Run tests
run: make prepare all check CONFIGURATION=${{ matrix.configuration }}
4 changes: 2 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -22,13 +22,13 @@ clean:
check: build check-monodoc check-mdoc

check-mdoc:
cd mdoc; $(MAKE) check -B
$(MAKE) check -B -C mdoc

nuget:
nuget pack mdoc/mdoc.nuspec -outputdirectory bin/Nuget

check-monodoc:
cd monodoc; $(MAKE) check -B
$(MAKE) check -B -C monodoc

zip:
rm -f $(BIN)/mdoc*.zip
Expand Down
Binary file added external/Test/AttachedEventsAndProperties.dll
Binary file not shown.
Binary file added external/Test/DocTest-VB-Eii.dll
Binary file not shown.
Binary file added external/Test/TestInterfaceImplementation.dll
Binary file not shown.
Binary file modified external/Test/mdoc.Test.Cplusplus.dll
Binary file not shown.
Binary file modified external/Test/mdoc.Test.FSharp.dll
Binary file not shown.
5 changes: 5 additions & 0 deletions global.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"sdk": {
"version": "6.0.428"
}
}
47 changes: 38 additions & 9 deletions mdoc/Makefile
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
CONFIGURATION = Release
PROGRAM = ../bin/$(CONFIGURATION)/mdoc.exe
MONO = mono
MONO = $(if $(filter Windows_NT,$(OS)),,mono)
CSCOMPILE = mcs
VBCOMPILE = vbnc
TEST_CSCFLAGS = -target:library
Expand Down Expand Up @@ -47,8 +47,8 @@ EXTRA_DISTFILES = \
MULTI-CLASSIC = Test/DocTest-DropNS-classic.dll Test/DocTest-DropNS-classic-multitest.dll
MULTI-UNIFIED = Test/DocTest-DropNS-unified.dll Test/DocTest-DropNS-unified-multitest.dll

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

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

nunit:
mono ../packages/NUnit.ConsoleRunner.3.6.0/tools/nunit3-console.exe mdoc.Test/bin/$(CONFIGURATION)/mdoc.Test.dll
$(MONO) ../packages/NUnit.ConsoleRunner.3.6.0/tools/nunit3-console.exe mdoc.Test/bin/$(CONFIGURATION)/mdoc.Test.dll

ifeq ($(filter Windows_NT,$(OS)),)

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

../mdoc/mdoc.Test/mdoc.Test.FSharp/bin/Release/mdoc.Test.FSharp.dll:
msbuild ../mdoc/mdoc.Test/mdoc.Test.FSharp/mdoc.Test.FSharp.fsproj -property:Configuration=Release

Test/TestInterfaceImplementation/bin/Release/TestInterfaceImplementation.dll:
msbuild ../mdoc/Test/TestInterfaceImplementation/TestInterfaceImplementation.csproj -property:Configuration=Release

Test/AttachedEventsAndProperties/bin/Release/AttachedEventsAndProperties.dll:
msbuild ../mdoc/Test/AttachedEventsAndProperties/AttachedEventsAndProperties.csproj -property:Configuration=Release

else # Full .NET Framework has extra attributes and slightly different generated types

Test/DocTest-VB-Eii.dll:
cp ../external/Test/DocTest-VB-Eii.dll Test/DocTest-VB-Eii.dll

../mdoc/mdoc.Test/mdoc.Test.FSharp/bin/Release/mdoc.Test.FSharp.dll:
cp ../external/Test/mdoc.Test.FSharp.dll ../mdoc/mdoc.Test/mdoc.Test.FSharp/bin/Release/mdoc.Test.FSharp.dll

Test/TestInterfaceImplementation/bin/Release/TestInterfaceImplementation.dll:
mkdir -p Test/TestInterfaceImplementation/bin/Release/
cp ../external/Test/TestInterfaceImplementation.dll Test/TestInterfaceImplementation/bin/Release/TestInterfaceImplementation.dll

Test/AttachedEventsAndProperties/bin/Release/AttachedEventsAndProperties.dll:
mkdir -p Test/AttachedEventsAndProperties/bin/Release/
cp ../external/Test/AttachedEventsAndProperties.dll Test/AttachedEventsAndProperties/bin/Release/AttachedEventsAndProperties.dll

endif

Test/DocTest-addNonGeneric.dll:
$(CSCOMPILE) $(TEST_CSCFLAGS) -unsafe -debug -optimize -target:library -out:$@ Test/DocTest-addNonGeneric.cs

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

Test/DocTest-TypeProjection.dll:
rm -f DocTest-TypeProjection.dll
rm -f $@
$(CSCOMPILE) $(TEST_CSCFLAGS) -unsafe -debug -optimize -target:library -out:$@ Test/DocTest-TypeProjection.cs

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

Test/DocTest-LongFileName.dll:
rm -f DocTest-LongFileName.dll
rm -f $@
$(CSCOMPILE) $(TEST_CSCFLAGS) -unsafe -debug -optimize -target:library -out:$@ Test/DocTest-LongFileName.cs

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

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

ifeq ($(ENVIRONMENT), wsl)
Expand All @@ -682,7 +711,7 @@ endif

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

Expand Down Expand Up @@ -768,7 +797,7 @@ check-monodocer-import-fx-update: check-monodocer-import-fx-work

check-monodocer-attached-entities:
-rm -Rf Test/en.actual
msbuild ../mdoc/Test/AttachedEventsAndProperties/AttachedEventsAndProperties.csproj -property:Configuration=Release
$(MAKE) Test/AttachedEventsAndProperties/bin/Release/AttachedEventsAndProperties.dll
$(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
$(DIFF) Test/en.expected-attached-entities Test/en.actual

Expand Down
5 changes: 4 additions & 1 deletion mdoc/mdoc.Test/MDocFileSourceTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Runtime.InteropServices;
using System.Xml.Linq;
using Mono.Documentation;
using Mono.Documentation.Framework;
Expand Down Expand Up @@ -406,7 +407,9 @@ public void GetTypeXmlPath_ShouldReturnCorrectPath_WhenTypeIsDropped()
string result = fileSource.GetTypeXmlPath(basePath, nsName, typeName);

// Assert
string expectedResult = "basePath/DroppedNamespace.Namespace/TypeName.xml";
string expectedResult = RuntimeInformation.IsOSPlatform(OSPlatform.Windows)
? "basePath\\DroppedNamespace.Namespace\\TypeName.xml"
: "basePath/DroppedNamespace.Namespace/TypeName.xml";
Assert.AreEqual(expectedResult, result);
}

Expand Down
2 changes: 1 addition & 1 deletion mdoc/mdoc.Test/mdoc.Test.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
</PropertyGroup>
<ItemGroup>
<Reference Include="mdoc.Test.Cplusplus, Version=1.0.6709.28740, Culture=neutral, processorArchitecture=x86">
<Reference Include="mdoc.Test.Cplusplus, Version=1.0.6709.28740, Culture=neutral, processorArchitecture=x64">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\..\external\Test\mdoc.Test.Cplusplus.dll</HintPath>
</Reference>
Expand Down
3 changes: 2 additions & 1 deletion monodoc/Makefile
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
CONFIGURATION = Release
MONO = $(if $(filter Windows_NT,$(OS)),,mono)

check:
mono ../packages/NUnit.ConsoleRunner.3.6.0/tools/nunit3-console.exe Test/bin/$(CONFIGURATION)/Monodoc.Test.dll
$(MONO) ../packages/NUnit.ConsoleRunner.3.6.0/tools/nunit3-console.exe Test/bin/$(CONFIGURATION)/Monodoc.Test.dll
@echo "monodoc Tests Complete!"