From fc045d021cd427d799fe73ccb80d294b02b22962 Mon Sep 17 00:00:00 2001 From: "Daniel J. Summers" Date: Sat, 20 Apr 2024 22:58:41 -0400 Subject: [PATCH] Bump version to 3 - Add description to each project - Add .sh files to test and package --- src/Common/BitBadger.Documents.Common.fsproj | 3 +- src/Directory.Build.props | 3 +- .../BitBadger.Documents.Postgres.fsproj | 3 +- src/Postgres/README.md | 2 +- src/Sqlite/BitBadger.Documents.Sqlite.fsproj | 3 +- src/Sqlite/README.md | 16 ++++----- src/Tests/Program.fs | 32 +++++++++++------- src/package.sh | 13 ++++++++ src/test_all.sh | 33 +++++++++++++++++++ 9 files changed, 82 insertions(+), 26 deletions(-) create mode 100755 src/package.sh create mode 100755 src/test_all.sh diff --git a/src/Common/BitBadger.Documents.Common.fsproj b/src/Common/BitBadger.Documents.Common.fsproj index f0d42e9..bded7fe 100644 --- a/src/Common/BitBadger.Documents.Common.fsproj +++ b/src/Common/BitBadger.Documents.Common.fsproj @@ -1,7 +1,8 @@  - Added Field type for by-field operations + Common files for PostgreSQL and SQLite document database libraries + v3 release JSON Document SQL diff --git a/src/Directory.Build.props b/src/Directory.Build.props index 635e0d6..e8389bc 100644 --- a/src/Directory.Build.props +++ b/src/Directory.Build.props @@ -6,14 +6,13 @@ 3.0.0.0 3.0.0.0 3.0.0 - rc-2 danieljsummers Bit Badger Solutions README.md icon.png https://bitbadger.solutions/open-source/relational-documents/ false - https://github.com/bit-badger/BitBadger.Documents + https://git.bitbadger.solutions/bit-badger/BitBadger.Documents Git MIT License MIT diff --git a/src/Postgres/BitBadger.Documents.Postgres.fsproj b/src/Postgres/BitBadger.Documents.Postgres.fsproj index 2df863a..a8eb158 100644 --- a/src/Postgres/BitBadger.Documents.Postgres.fsproj +++ b/src/Postgres/BitBadger.Documents.Postgres.fsproj @@ -1,7 +1,8 @@  - Adds Field type for by-field operations (BREAKING from rc-1); adds RemoveFields* functions + Use PostgreSQL as a document database + v3 release; official replacement for BitBadger.Npgsql.Documents JSON Document PostgreSQL Npgsql diff --git a/src/Postgres/README.md b/src/Postgres/README.md index 039856b..25b493d 100644 --- a/src/Postgres/README.md +++ b/src/Postgres/README.md @@ -45,7 +45,7 @@ Retrieve all customers: ```csharp // C#; parameter is table name // Find.All type signature is Func>> -var customers = await Find.All("customer"); +var customers = await Find.All("customer"); ``` ```fsharp diff --git a/src/Sqlite/BitBadger.Documents.Sqlite.fsproj b/src/Sqlite/BitBadger.Documents.Sqlite.fsproj index 4c108db..b6009bb 100644 --- a/src/Sqlite/BitBadger.Documents.Sqlite.fsproj +++ b/src/Sqlite/BitBadger.Documents.Sqlite.fsproj @@ -1,7 +1,8 @@  - Adds Field type for by-field operations (BREAKING from rc-1); adds RemoveFields* functions + Use SQLite as a document database + Overall v3 release; initial release supporting SQLite JSON Document SQLite diff --git a/src/Sqlite/README.md b/src/Sqlite/README.md index b79958f..56546c0 100644 --- a/src/Sqlite/README.md +++ b/src/Sqlite/README.md @@ -45,7 +45,7 @@ Retrieve all customers: ```csharp // C#; parameter is table name // Find.All type signature is Func>> -var customers = await Find.All("customer"); +var customers = await Find.All("customer"); ``` ```fsharp @@ -72,28 +72,28 @@ Count customers in Atlanta: ```csharp // C#; parameters are table name, field, operator, and value -// Count.ByField type signature is Func> -var customerCount = await Count.ByField("customer", "City", Op.EQ, "Atlanta"); +// Count.ByField type signature is Func> +var customerCount = await Count.ByField("customer", Field.EQ("City", "Atlanta")); ``` ```fsharp // F# -// Count.byField type signature is string -> string -> Op -> obj -> Task -let! customerCount = Count.byField "customer" "City" EQ "Atlanta" +// Count.byField type signature is string -> Field -> Task +let! customerCount = Count.byField "customer" (Field.EQ "City" "Atlanta") ``` Delete customers in Chicago: _(no offense, Second City; just an example...)_ ```csharp // C#; parameters are same as above, except return is void -// Delete.ByField type signature is Func -await Delete.ByField("customer", "City", Op.EQ, "Chicago"); +// Delete.ByField type signature is Func +await Delete.ByField("customer", Field.EQ("City", "Chicago")); ``` ```fsharp // F# // Delete.byField type signature is string -> string -> Op -> obj -> Task -do! Delete.byField "customer" "City" EQ "Chicago" +do! Delete.byField "customer" (Field.EQ "City" "Chicago") ``` ## More Information diff --git a/src/Tests/Program.fs b/src/Tests/Program.fs index 7b1bdf2..d87146f 100644 --- a/src/Tests/Program.fs +++ b/src/Tests/Program.fs @@ -1,19 +1,27 @@ open Expecto open BitBadger.Documents.Tests.CSharp +let postgresOnly = + match System.Environment.GetEnvironmentVariable "BBDOX_PG_ONLY" with + | null -> false + | "true" -> true + | _ -> false + let allTests = - testList - "BitBadger.Documents" - [ CommonTests.all - CommonCSharpTests.Unit - PostgresTests.all - PostgresCSharpTests.All - PostgresExtensionTests.integrationTests - testSequenced PostgresCSharpExtensionTests.Integration - SqliteTests.all - SqliteCSharpTests.All - SqliteExtensionTests.integrationTests - testSequenced SqliteCSharpExtensionTests.Integration ] + testList "BitBadger.Documents" [ + if not postgresOnly then + CommonTests.all + CommonCSharpTests.Unit + PostgresTests.all + PostgresCSharpTests.All + PostgresExtensionTests.integrationTests + testSequenced PostgresCSharpExtensionTests.Integration + if not postgresOnly then + SqliteTests.all + SqliteCSharpTests.All + SqliteExtensionTests.integrationTests + testSequenced SqliteCSharpExtensionTests.Integration + ] [] let main args = runTestsWithCLIArgs [] args allTests diff --git a/src/package.sh b/src/package.sh new file mode 100755 index 0000000..d88421a --- /dev/null +++ b/src/package.sh @@ -0,0 +1,13 @@ +#!/bin/bash + +echo --- Package Common library +dotnet pack Common/BitBadger.Documents.Common.fsproj -c Release +cp Common/bin/Release/BitBadger.Documents.Common.*.nupkg . + +echo --- Package PostgreSQL library +dotnet pack Postgres/BitBadger.Documents.Postgres.fsproj -c Release +cp Postgres/bin/Release/BitBadger.Documents.Postgres.*.nupkg . + +echo --- Package SQLite library +dotnet pack Sqlite/BitBadger.Documents.Sqlite.fsproj -c Release +cp Sqlite/bin/Release/BitBadger.Documents.Sqlite.*.nupkg . diff --git a/src/test_all.sh b/src/test_all.sh new file mode 100755 index 0000000..f93110d --- /dev/null +++ b/src/test_all.sh @@ -0,0 +1,33 @@ +#!/bin/bash + +dotnet clean BitBadger.Documents.sln +dotnet restore BitBadger.Documents.sln +dotnet build BitBadger.Documents.sln --no-restore + +cd ./Tests || exit + +export BBDOX_PG_PORT=8301 +PG_VERSIONS=('12' '13' '14' '15' 'latest') +NET_VERSIONS=('6.0' '7.0' '8.0') + +for PG_VERSION in "${PG_VERSIONS[@]}" +do + echo Starting PostgreSQL:$PG_VERSION + docker run -d -p $BBDOX_PG_PORT:5432 --name pg_test -e POSTGRES_PASSWORD=postgres postgres:$PG_VERSION + sleep 4 + for NET_VERSION in "${NET_VERSIONS[@]}" + do + if [ "$PG_VERSION" = "latest" ]; then + echo Testing SQLite and PostgreSQL under .NET $NET_VERSION... + dotnet run -f net$NET_VERSION + else + echo Testing PostgreSQL v$PG_VERSION under .NET $NET_VERSION... + BBDOX_PG_ONLY="true" dotnet run -f net$NET_VERSION + fi + done + docker stop pg_test + sleep 2 + docker rm pg_test +done + +cd .. || exit