Add .NET test to github workflows (#6982)

This commit is contained in:
Derek Bailey 2021-12-13 11:51:27 -08:00 committed by GitHub
parent b92bb0584d
commit c555ee8fac
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 30 additions and 15 deletions

View File

@ -80,6 +80,34 @@ jobs:
- name: test
run: Release\flattests.exe
build-dotnet-windows:
name: Build .NET Windows
runs-on: windows-latest
strategy:
matrix:
configuration: [
'',
'-p:UnsafeByteBuffer=true',
# Fails two tests currently.
#'-p:EnableSpanT=true,UnsafeByteBuffer=true'
]
steps:
- uses: actions/checkout@v1
- name: Setup .NET Core SDK
uses: actions/setup-dotnet@v1.9.0
with:
dotnet-version: '3.1.x'
- name: Build
run: |
cd tests\FlatBuffers.Test
dotnet new sln --force --name FlatBuffers.Core.Test
dotnet sln FlatBuffers.Core.Test.sln add FlatBuffers.Core.Test.csproj
dotnet build -c Release ${{matrix.configuration}} -o out FlatBuffers.Core.Test.sln
- name: Run
run: |
cd tests\FlatBuffers.Test
out\FlatBuffers.Core.Test.exe
build-mac:
name: Build Mac
runs-on: macos-latest

View File

@ -55,19 +55,6 @@ test_script:
- "npm run compile"
- "cd tests"
- "TypeScriptTest.bat"
- rem "---------------- C# -----------------"
# Have to compile this here rather than in "build" above because AppVeyor only
# supports building one project??
- "cd FlatBuffers.Test"
- "dotnet new sln"
- "dotnet sln add FlatBuffers.Test.csproj"
- "nuget restore"
- "mkdir .tmp"
- "msbuild.exe /property:Configuration=Release;OutputPath=.tmp /verbosity:minimal FlatBuffers.Test.csproj"
- ".tmp\\FlatBuffers.Test.exe"
# Run tests with UNSAFE_BYTEBUFFER
- "msbuild.exe /property:Configuration=Release;UnsafeByteBuffer=true;OutputPath=.tmp /verbosity:minimal FlatBuffers.Test.csproj"
- ".tmp\\FlatBuffers.Test.exe"
artifacts:
- path: $(CONFIGURATION)\flatc.exe

View File

@ -116,13 +116,13 @@ namespace FlatBuffers.Test
// Dump to output directory so we can inspect later, if needed
#if ENABLE_SPAN_T
var data = fbb.DataBuffer.ToSizedArray();
string filename = @".tmp/monsterdata_cstest" + (sizePrefix ? "_sp" : "") + ".mon";
string filename = @"monsterdata_cstest" + (sizePrefix ? "_sp" : "") + ".mon";
File.WriteAllBytes(filename, data);
#else
using (var ms = fbb.DataBuffer.ToMemoryStream(fbb.DataBuffer.Position, fbb.Offset))
{
var data = ms.ToArray();
string filename = @".tmp/monsterdata_cstest" + (sizePrefix ? "_sp" : "") + ".mon";
string filename = @"monsterdata_cstest" + (sizePrefix ? "_sp" : "") + ".mon";
File.WriteAllBytes(filename, data);
}
#endif