From c555ee8fac95b1520225d9c34d73d3e5beb97e52 Mon Sep 17 00:00:00 2001 From: Derek Bailey Date: Mon, 13 Dec 2021 11:51:27 -0800 Subject: [PATCH] Add .NET test to github workflows (#6982) --- .github/workflows/build.yml | 28 +++++++++++++++++++ appveyor.yml | 13 --------- .../FlatBuffersExampleTests.cs | 4 +-- 3 files changed, 30 insertions(+), 15 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 85950fde3..a69bfc507 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -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 diff --git a/appveyor.yml b/appveyor.yml index fdbe9e5c2..c54aed0cb 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -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 diff --git a/tests/FlatBuffers.Test/FlatBuffersExampleTests.cs b/tests/FlatBuffers.Test/FlatBuffersExampleTests.cs index 79a213c38..ec3b2eaa5 100644 --- a/tests/FlatBuffers.Test/FlatBuffersExampleTests.cs +++ b/tests/FlatBuffers.Test/FlatBuffersExampleTests.cs @@ -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