Skip to content

Commit 726dbd8

Browse files
authored
feat: improves doc, unit tests, ci/cd (#113)
* chore: improve README based on issue #112 * test: improve unit test based on issue #109 * chore: implement release please * chore: add supabase stack
1 parent 879920a commit 726dbd8

18 files changed

+744
-21
lines changed

.github/workflows/build-and-test.yml

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,12 @@ jobs:
2323
- name: Build
2424
run: dotnet build --configuration Release --no-restore
2525

26-
- name: Initialize Testing Stack
27-
run: docker compose up -d
26+
- uses: supabase/setup-cli@v1
27+
with:
28+
version: latest
29+
30+
- name: Start Supabase
31+
run: supabase start
2832

2933
- name: Test
3034
run: dotnet test --no-restore

.github/workflows/release.yml

Lines changed: 20 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,29 @@ name: Publish NuGet Package
33
on:
44
push:
55
branches:
6-
- release/* # Default release branch
6+
- master
7+
workflow_run:
8+
workflows: [ build-and-test ]
9+
types:
10+
- completed
711

812
jobs:
13+
release-please:
14+
runs-on: ubuntu-latest
15+
permissions:
16+
contents: write
17+
pull-requests: write
18+
issues: write
19+
steps:
20+
- uses: googleapis/release-please-action@v4
21+
with:
22+
target-branch: ${{ github.ref_name }}
23+
manifest-file: .release-please-manifest.json
24+
config-file: release-please-config.json
25+
926
publish:
27+
needs: release-please
28+
if: ${{ github.repository_owner == 'supabase-community' && startsWith(github.event.head_commit.message, 'chore(master)') && github.ref == 'refs/heads/master' && github.event_name == 'push' }}
1029
name: build, pack & publish
1130
runs-on: ubuntu-latest
1231
steps:

.release-please-manifest.json

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
{
2+
".": "4.1.0"
3+
}

Postgrest/Postgrest.csproj

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,10 @@
2222
</Description>
2323
<PackageIconUrl>https://avatars.githubusercontent.com/u/54469796?s=200&amp;v=4</PackageIconUrl>
2424
<PackageTags>supabase,postgrest</PackageTags>
25+
<!-- x-release-please-start-version -->
2526
<ReleaseVersion>4.1.0</ReleaseVersion>
2627
<PackageVersion>4.1.0</PackageVersion>
28+
<!-- x-release-please-end -->
2729
<GeneratePackageOnBuild>true</GeneratePackageOnBuild>
2830
<PackageIcon>icon.png</PackageIcon>
2931
<PackageReadmeFile>README.md</PackageReadmeFile>
@@ -35,7 +37,7 @@
3537
</PropertyGroup>
3638

3739
<PropertyGroup Condition=" '$(Version)' == '' ">
38-
<VersionPrefix Condition=" '$(VersionPrefix)' == '' ">4.1.0</VersionPrefix>
40+
<VersionPrefix Condition=" '$(VersionPrefix)' == '' ">4.1.0</VersionPrefix> <!-- x-release-please-version -->
3941
<VersionSuffix Condition=" '$(VersionSuffix)' == '' "></VersionSuffix>
4042
<Version Condition=" '$(VersionSuffix)' != '' ">$(VersionPrefix)-$(VersionSuffix)</Version>
4143
<Version Condition=" '$(Version)' == '' ">$(VersionPrefix)</Version>

PostgrestTests/ClientTests.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ namespace PostgrestTests
1919
[TestClass]
2020
public class ClientTests
2121
{
22-
private const string BaseUrl = "http://localhost:3000";
22+
private const string BaseUrl = "http://localhost:54321/rest/v1";
2323

2424
[TestMethod("Initializes")]
2525
public void TestInitialization()

PostgrestTests/CoercionTests.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ namespace PostgrestTests;
1111
[TestClass]
1212
public class CoercionTests
1313
{
14-
private const string BaseUrl = "http://localhost:3000";
14+
private const string BaseUrl = "http://localhost:54321/rest/v1";
1515

1616
[TestMethod("Coercion: Can coerce primitive types")]
1717
public async Task CanCoercePrimitiveTypes()

PostgrestTests/Helpers.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,9 +25,9 @@ internal static Client GetHostedClient()
2525
internal static Client GetLocalClient()
2626
{
2727
var url = Environment.GetEnvironmentVariable("SUPABASE_URL");
28-
if (url == null) url = "http://localhost:3000";
28+
if (url == null) url = "http://localhost:54321";
2929
var publicKey = Environment.GetEnvironmentVariable("SUPABASE_PUBLIC_KEY");
30-
if (publicKey == null) publicKey = "reallyreallyreallyreallyverysafe";
30+
if (publicKey == null) publicKey = "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJzdXBhYmFzZS1kZW1vIiwicm9sZSI6ImFub24iLCJleHAiOjE5ODM4MTI5OTZ9.CRXP1A7WOeoJeXxjNni43kdQwgnWNReilDMblYTn_I0";
3131

3232
var client = new Client($"{url}/rest/v1", new ClientOptions
3333
{

PostgrestTests/LinqTests.cs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ namespace PostgrestTests
1313
[TestClass]
1414
public class LinqTests
1515
{
16-
private const string BaseUrl = "http://localhost:3000";
16+
private const string BaseUrl = "http://localhost:54321/rest/v1";
1717

1818
[TestMethod("Linq: Select")]
1919
public async Task TestLinqSelect()
@@ -123,14 +123,17 @@ await client.Table<KitchenSink>()
123123
.Get();
124124

125125
await client.Table<KitchenSink>()
126+
.Where(x => x.DateTimeValue == null)
126127
.Set(x => x.BooleanValue!, true)
127128
.Update();
128129

129130
await client.Table<KitchenSink>()
131+
.Where(x => x.DateTimeValue == null)
130132
.Set(x => x.BooleanValue, true)
131133
.Update();
132134

133135
await client.Table<KitchenSink>()
136+
.Where(x => x.DateTimeValue == null)
134137
.Set(x => x.StringValue!, null)
135138
.Update();
136139
}

PostgrestTests/Models/Category.cs

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
using System;
2+
using Supabase.Postgrest.Attributes;
3+
using Supabase.Postgrest.Models;
4+
5+
namespace PostgrestTests.Models;
6+
7+
[Table("category")]
8+
public class Category : BaseModel
9+
{
10+
[PrimaryKey("id")]
11+
public Guid Id { get; set; }
12+
13+
[Column("name")]
14+
public string? Name { get; set; }
15+
}

PostgrestTests/Models/Product.cs

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
using System;
2+
using Supabase.Postgrest.Attributes;
3+
using Supabase.Postgrest.Models;
4+
5+
namespace PostgrestTests.Models;
6+
7+
[Table("product")]
8+
public class Product : BaseModel
9+
{
10+
11+
[PrimaryKey("id")]
12+
public Guid Id { get; set; }
13+
14+
[Column("name")]
15+
public string? Name { get; set; }
16+
17+
[Reference(typeof(Category))]
18+
public Category? Category { get; set; }
19+
}

0 commit comments

Comments
 (0)