Skip to content

c# client SDK

c# client SDK #284

Workflow file for this run

# This workflow will build a .NET project
# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-net
name: .NET build
on:
push:
pull_request:
types: [opened, reopened]
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
path: spacetimedb-csharp-sdk
- name: Setup .NET
uses: actions/setup-dotnet@v4
with:
dotnet-version: 7.0.x
- name: Checkout SpacetimeDB
uses: actions/checkout@v4
with:
repository: clockworklabs/SpacetimeDB
path: SpacetimeDB
- name: Setup SpacetimeDB packages
working-directory: spacetimedb-csharp-sdk
run: |
( cd ../SpacetimeDB/crates/bindings-csharp/BSATN.Runtime && dotnet pack )
# Write out the nuget config file to `nuget.config`. This causes the spacetimedb-csharp-sdk repository
# to be aware of the local versions of the `bindings-csharp` packages in SpacetimeDB, and use them if
# available. Otherwise, `spacetimedb-csharp-sdk` will use the NuGet versions of the packages.
# This means that (if version numbers match) we will test the local versions of the C# packages, even
# if they're not pushed to NuGet.
# See https://learn.microsoft.com/en-us/nuget/reference/nuget-config-file for more info on the config file,
# and https://tldp.org/LDP/abs/html/here-docs.html for more info on this bash feature.
cat >nuget.config <<EOF
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<packageSources>
<!-- Local NuGet repositories -->
<add key="Local SpacetimeDB.BSATN.Runtime" value="../SpacetimeDB/crates/bindings-csharp/BSATN.Runtime/bin/Release" />
<!-- Official NuGet.org server -->
<add key="NuGet.org" value="https://api.nuget.org/v3/index.json" />
</packageSources>
</configuration>
EOF
- name: Restore dependencies
working-directory: spacetimedb-csharp-sdk
run: dotnet restore
- name: Build everything
working-directory: spacetimedb-csharp-sdk
run: dotnet build --no-restore -warnaserror
- name: Run tests
working-directory: spacetimedb-csharp-sdk
run: dotnet test --no-build
- name: Verify formatting
working-directory: spacetimedb-csharp-sdk
run: dotnet format --no-restore --verify-no-changes SpacetimeDB.ClientSDK.sln