diff --git a/.github/release-drafter.yml b/.github/release-drafter.yml new file mode 100644 index 00000000..5604e78a --- /dev/null +++ b/.github/release-drafter.yml @@ -0,0 +1,33 @@ +name-template: "v$RESOLVED_VERSION" +tag-template: "v$RESOLVED_VERSION" +change-template: "- [#$NUMBER] $TITLE - Thanks to @$AUTHOR!" +exclude-labels: + - automated +categories: + - title: "🚀 Features" + labels: + - "feature" + - "enhancement" + - title: "🐛 Bug Fixes" + labels: + - "bug" + - "fix" + - title: "📄 Documentation" + labels: + - "docs" + - "documentation" +version-resolver: + major: + labels: + - 'major' + minor: + labels: + - 'minor' + patch: + labels: + - 'patch' + default: patch +template: | + ## Changes + + $CHANGES diff --git a/.github/workflows/_test.yml b/.github/workflows/_test.yml new file mode 100644 index 00000000..01b90e60 --- /dev/null +++ b/.github/workflows/_test.yml @@ -0,0 +1,94 @@ +name: Workflow Test + +on: + workflow_call: + +env: + DOTNET_VERSION: '8.0' + +jobs: + build: + name: Build & Test + runs-on: ubuntu-latest + permissions: + pull-requests: write + contents: read + issues: read + checks: write + steps: + - name: Checkout + uses: actions/checkout@a5ac7e51b41094c92402da3b24376905380afc29 # v4 + + - name: Setup .NET + uses: actions/setup-dotnet@4d6c8fcf3c8f7a60068d26b594648e99df24cee3 # v4 + with: + dotnet-version: ${{ env.DOTNET_VERSION }} + + - name: Nuget Cache + uses: actions/cache@0c45773b623bea8c8e75f6c82b208c3cf94ea4f9 # v4 + with: + path: ~/.nuget/packages + key: ${{ runner.os }}-nuget-${{ hashFiles('**/*.csproj') }} + restore-keys: | + ${{ runner.os }}-nuget- + + - name: Restore + run: dotnet restore + + - name: Build + run: dotnet build -c Release --no-restore + + - name: Test + run: dotnet test -c Release --no-build --verbosity normal --logger trx --collect:"XPlat Code Coverage" + + - name: Combine Coverage Reports + uses: danielpalme/ReportGenerator-GitHub-Action@4924a48df5dbcdfbcbaef0cc1ad7d65d5aade7dd # 5.3.6 + with: + reports: "**/*.cobertura.xml" + targetdir: "${{ github.workspace }}" + reporttypes: "Cobertura" + verbosity: "Info" + title: "Code Coverage" + tag: "${{ github.run_number }}_${{ github.run_id }}" + customSettings: "" + toolpath: "reportgeneratortool" + + - name: Upload Combined Coverage XML + uses: actions/upload-artifact@65462800fd760344b1a7b4382951275a0abb4808 # v4 + with: + name: coverage + path: ${{ github.workspace }}/Cobertura.xml + retention-days: 5 + + - name: Publish Code Coverage Report + uses: irongut/CodeCoverageSummary@51cc3a756ddcd398d447c044c02cb6aa83fdae95 # v1.3.0 + with: + filename: "Cobertura.xml" + badge: true + fail_below_min: false + format: markdown + hide_branch_rate: false + hide_complexity: false + indicators: true + output: both + thresholds: "10 30" + + - name: Add Coverage PR Comment + uses: marocchino/sticky-pull-request-comment@331f8f5b4215f0445d3c07b4967662a32a2d3e31 # v2 + if: github.event_name == 'pull_request' + with: + recreate: true + path: code-coverage-results.md + + - name: Upload Test Result Files + uses: actions/upload-artifact@65462800fd760344b1a7b4382951275a0abb4808 # v4 + with: + name: test-results + path: ${{ github.workspace }}/**/TestResults/**/* + retention-days: 5 + + - name: Publish Test Results + uses: EnricoMi/publish-unit-test-result-action@30eadd5010312f995f0d3b3cff7fe2984f69409e # v2.16.1 + if: always() + with: + trx_files: "${{ github.workspace }}/**/*.trx" diff --git a/.github/workflows/dev.yml b/.github/workflows/dev.yml new file mode 100644 index 00000000..f0333a18 --- /dev/null +++ b/.github/workflows/dev.yml @@ -0,0 +1,60 @@ +name: Dev + +on: + push: + branches: [ dev ] + release: + types: [ published ] + workflow_dispatch: + +jobs: + build: + name: Build & Test + uses: ./.github/workflows/_test.yml + secrets: inherit + permissions: + pull-requests: write + contents: read + issues: read + checks: write + + release: + name: Push to main + runs-on: ubuntu-latest + needs: build + if: github.event_name == 'release' + permissions: + contents: write + pull-requests: write + steps: + - name: Checkout + uses: actions/checkout@a5ac7e51b41094c92402da3b24376905380afc29 # v4 + with: + ref: dev + + - name: Get Release Version + id: releaseVersion + run: | + arrTag=(${GITHUB_REF//\// }) + VERSION="${arrTag[2]}" + echo Version: $VERSION + VERSION="${VERSION:1}" + echo Clean Version: $VERSION + echo "version=$VERSION" >> ${GITHUB_OUTPUT} + + - name: Create Pull Request + id: cpr + env: + GH_TOKEN: ${{ secrets.PAT }} + run: | + git fetch origin main + pr_number=$(gh pr create --base main --head dev --assignee pingu2k4 --fill --label automated --label release --title "Merge v${{ steps.releaseVersion.outputs.version }}" | grep -o 'https://github.com/[^/]\+/[^/]\+/pull/\([0-9]\+\)' | awk -F '/' '{print $NF}') + echo PR Number: $pr_number + echo "prNumber=$pr_number" >> ${GITHUB_OUTPUT} + + - name: Merge Pull Request + if: ${{ steps.cpr.outputs.prNumber }} + env: + GH_TOKEN: ${{ secrets.PAT }} + run: | + gh pr merge ${{ steps.cpr.outputs.prNumber }} --auto --merge diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml new file mode 100644 index 00000000..31160743 --- /dev/null +++ b/.github/workflows/main.yml @@ -0,0 +1,98 @@ +name: Main + +on: + push: + branches: [ main ] + workflow_dispatch: + +env: + CLIENT_PROJECT_NAME: PinguApps.Appwrite.Client + SERVER_PROJECT_NAME: PinguApps.Appwrite.Server + DOTNET_VERSION: '8.0' + NUGET_FEED: https://api.nuget.org/v3/index.json + NUGET_KEY: ${{ secrets.NUGET_KEY }} + +jobs: + build: + name: Build & Test + uses: ./.github/workflows/_test.yml + secrets: inherit + permissions: + pull-requests: write + contents: read + issues: read + checks: write + + push-nugets: + needs: build + name: Push Nuget's + runs-on: ubuntu-latest + permissions: + pull-requests: read + steps: + - name: Checkout + uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4 + + - name: Setup .NET + uses: actions/setup-dotnet@4d6c8fcf3c8f7a60068d26b594648e99df24cee3 # v4 + with: + dotnet-version: ${{ env.DOTNET_VERSION }} + + - name: Get PR title + id: pr-title + env: + GH_TOKEN: ${{ secrets.PAT }} + run: | + PR_NUMBER=$(gh pr list --base main --state merged --limit 1 --json number --jq '.[0].number') + echo "PR Number: ${PR_NUMBER}" + PR_TITLE=$(gh pr view $PR_NUMBER --json title --jq '.title') + echo "PR Title: ${PR_TITLE}" + echo "PR_TITLE=${PR_TITLE}" >> $GITHUB_ENV + + - name: Extract version from PR title + id: extract-version + run: | + VERSION=$(echo "${PR_TITLE}" | grep -oP 'v[0-9]+\.[0-9]+\.[0-9]+(-[a-zA-Z0-9]+)?') + echo "Version: ${VERSION}" + VERSION_WITHOUT_V=${VERSION#v} + echo "Version -v: ${VERSION_WITHOUT_V}" + echo "VERSION=${VERSION_WITHOUT_V}" >> $GITHUB_ENV + + - name: Create Nuget Packages + run: | + dotnet pack -c Release --verbosity normal --include-symbols --include-source -p:PackageVersion=$VERSION -o nupkg src/$CLIENT_PROJECT_NAME/$CLIENT_PROJECT_NAME.csproj + dotnet pack -c Release --verbosity normal --include-symbols --include-source -p:PackageVersion=$VERSION -o nupkg src/$SERVER_PROJECT_NAME/$SERVER_PROJECT_NAME.csproj + + - name: Push to NuGet Feed + run: dotnet nuget push ./nupkg/*.{nupkg,snupkg} --source $NUGET_FEED --api-key $NUGET_KEY --skip-duplicate + + sync: + name: Sync back to dev + runs-on: ubuntu-latest + needs: build + if: github.event_name == 'push' + permissions: + contents: write + pull-requests: write + steps: + - name: Checkout + uses: actions/checkout@a5ac7e51b41094c92402da3b24376905380afc29 # v4 + with: + ref: main + + - name: Create Pull Request + id: cpr + env: + GH_TOKEN: ${{ secrets.PAT }} + run: | + git fetch origin dev + pr_number=$(gh pr create --base dev --head main --assignee pingu2k4 --fill --label automated --label sync | grep -o 'https://github.com/[^/]\+/[^/]\+/pull/\([0-9]\+\)' | awk -F '/' '{print $NF}') + echo PR Number: $pr_number + echo "prNumber=$pr_number" >> ${GITHUB_OUTPUT} + + - name: Merge Pull Request + if: ${{ steps.cpr.outputs.prNumber }} + env: + GH_TOKEN: ${{ secrets.PAT }} + run: | + gh pr merge ${{ steps.cpr.outputs.prNumber }} --auto --merge diff --git a/.github/workflows/pr.yml b/.github/workflows/pr.yml new file mode 100644 index 00000000..476d6f7e --- /dev/null +++ b/.github/workflows/pr.yml @@ -0,0 +1,17 @@ +name: PR + +on: + pull_request: + branches: + - dev + +jobs: + build: + name: Build & Test + uses: ./.github/workflows/_test.yml + secrets: inherit + permissions: + pull-requests: write + contents: read + issues: read + checks: write diff --git a/.github/workflows/release-drafter.yml b/.github/workflows/release-drafter.yml new file mode 100644 index 00000000..e5e26dba --- /dev/null +++ b/.github/workflows/release-drafter.yml @@ -0,0 +1,17 @@ +name: Release Drafter + +on: + push: + branches: [ dev ] + +permissions: + contents: write + pull-requests: write + +jobs: + update_release_draft: + runs-on: ubuntu-latest + steps: + - uses: release-drafter/release-drafter@3f0f87098bd6b5c5b9a36d49c41d998ea58f9348 # v6 + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} diff --git a/PinguApps.Appwrite.sln b/PinguApps.Appwrite.sln index 2c15698c..6ef20be7 100644 --- a/PinguApps.Appwrite.sln +++ b/PinguApps.Appwrite.sln @@ -5,9 +5,9 @@ VisualStudioVersion = 17.9.34616.47 MinimumVisualStudioVersion = 10.0.40219.1 Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "src", "src", "{6F37E87C-BABE-4727-ADF5-157E65C583ED}" EndProject -Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "PinguApps.Appwrite.Client", "src\Appwrite.Client\PinguApps.Appwrite.Client.csproj", "{0B05C1CC-1D37-4BAB-B133-E8638F6C6439}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "PinguApps.Appwrite.Client", "src\PinguApps.Appwrite.Client\PinguApps.Appwrite.Client.csproj", "{0B05C1CC-1D37-4BAB-B133-E8638F6C6439}" EndProject -Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "PinguApps.Appwrite.Playground", "src\Appwrite.Playground\PinguApps.Appwrite.Playground.csproj", "{EEB648E0-2054-4204-A0C1-CDC29FC63F4B}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "PinguApps.Appwrite.Playground", "src\PinguApps.Appwrite.Playground\PinguApps.Appwrite.Playground.csproj", "{EEB648E0-2054-4204-A0C1-CDC29FC63F4B}" EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "PinguApps.Appwrite.Server", "src\PinguApps.Appwrite.Server\PinguApps.Appwrite.Server.csproj", "{1E8A9E01-1E1A-4FA6-93AB-E1FA31500DF6}" EndProject @@ -15,11 +15,11 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "PinguApps.Appwrite.Shared", EndProject Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "tests", "tests", "{187EBB4D-6799-492C-AAA7-518B2811D800}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "PinguApps.Appwrite.Server.Tests", "tests\PinguApps.Appwrite.Server.Tests\PinguApps.Appwrite.Server.Tests.csproj", "{11D16276-FCD0-404D-BA8A-5CBEAF494CB0}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "PinguApps.Appwrite.Server.Tests", "tests\PinguApps.Appwrite.Server.Tests\PinguApps.Appwrite.Server.Tests.csproj", "{11D16276-FCD0-404D-BA8A-5CBEAF494CB0}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "PinguApps.Appwrite.Client.Tests", "tests\PinguApps.Appwrite.Client.Tests\PinguApps.Appwrite.Client.Tests.csproj", "{71C1431E-8098-4B9B-9CFA-A49F77242C79}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "PinguApps.Appwrite.Client.Tests", "tests\PinguApps.Appwrite.Client.Tests\PinguApps.Appwrite.Client.Tests.csproj", "{71C1431E-8098-4B9B-9CFA-A49F77242C79}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "PinguApps.Appwrite.Tests.Shared", "tests\PinguApps.Appwrite.Tests.Shared\PinguApps.Appwrite.Tests.Shared.csproj", "{5AED345C-1E3E-4397-807C-8EFC22B786FA}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "PinguApps.Appwrite.Tests.Shared", "tests\PinguApps.Appwrite.Tests.Shared\PinguApps.Appwrite.Tests.Shared.csproj", "{5AED345C-1E3E-4397-807C-8EFC22B786FA}" EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution @@ -34,7 +34,6 @@ Global {EEB648E0-2054-4204-A0C1-CDC29FC63F4B}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {EEB648E0-2054-4204-A0C1-CDC29FC63F4B}.Debug|Any CPU.Build.0 = Debug|Any CPU {EEB648E0-2054-4204-A0C1-CDC29FC63F4B}.Release|Any CPU.ActiveCfg = Release|Any CPU - {EEB648E0-2054-4204-A0C1-CDC29FC63F4B}.Release|Any CPU.Build.0 = Release|Any CPU {1E8A9E01-1E1A-4FA6-93AB-E1FA31500DF6}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {1E8A9E01-1E1A-4FA6-93AB-E1FA31500DF6}.Debug|Any CPU.Build.0 = Debug|Any CPU {1E8A9E01-1E1A-4FA6-93AB-E1FA31500DF6}.Release|Any CPU.ActiveCfg = Release|Any CPU diff --git a/icon.png b/icon.png new file mode 100644 index 00000000..5231665b Binary files /dev/null and b/icon.png differ diff --git a/src/Appwrite.Client/PinguApps.Appwrite.Client.csproj b/src/Appwrite.Client/PinguApps.Appwrite.Client.csproj deleted file mode 100644 index 97752f2f..00000000 --- a/src/Appwrite.Client/PinguApps.Appwrite.Client.csproj +++ /dev/null @@ -1,18 +0,0 @@ - - - - netstandard2.1 - enable - latest - - - - - - - - - - - - diff --git a/src/Appwrite.Client/Clients/AccountClient.cs b/src/PinguApps.Appwrite.Client/Clients/AccountClient.cs similarity index 100% rename from src/Appwrite.Client/Clients/AccountClient.cs rename to src/PinguApps.Appwrite.Client/Clients/AccountClient.cs diff --git a/src/Appwrite.Client/Clients/AppwriteClient.cs b/src/PinguApps.Appwrite.Client/Clients/AppwriteClient.cs similarity index 100% rename from src/Appwrite.Client/Clients/AppwriteClient.cs rename to src/PinguApps.Appwrite.Client/Clients/AppwriteClient.cs diff --git a/src/Appwrite.Client/Clients/IAccountClient.cs b/src/PinguApps.Appwrite.Client/Clients/IAccountClient.cs similarity index 100% rename from src/Appwrite.Client/Clients/IAccountClient.cs rename to src/PinguApps.Appwrite.Client/Clients/IAccountClient.cs diff --git a/src/Appwrite.Client/Clients/IAppwriteClient.cs b/src/PinguApps.Appwrite.Client/Clients/IAppwriteClient.cs similarity index 100% rename from src/Appwrite.Client/Clients/IAppwriteClient.cs rename to src/PinguApps.Appwrite.Client/Clients/IAppwriteClient.cs diff --git a/src/Appwrite.Client/Clients/ISessionAware.cs b/src/PinguApps.Appwrite.Client/Clients/ISessionAware.cs similarity index 100% rename from src/Appwrite.Client/Clients/ISessionAware.cs rename to src/PinguApps.Appwrite.Client/Clients/ISessionAware.cs diff --git a/src/Appwrite.Client/Handlers/HeaderHandler.cs b/src/PinguApps.Appwrite.Client/Handlers/HeaderHandler.cs similarity index 100% rename from src/Appwrite.Client/Handlers/HeaderHandler.cs rename to src/PinguApps.Appwrite.Client/Handlers/HeaderHandler.cs diff --git a/src/Appwrite.Client/Internals/IAccountApi.cs b/src/PinguApps.Appwrite.Client/Internals/IAccountApi.cs similarity index 100% rename from src/Appwrite.Client/Internals/IAccountApi.cs rename to src/PinguApps.Appwrite.Client/Internals/IAccountApi.cs diff --git a/src/Appwrite.Client/Internals/IBaseApi.cs b/src/PinguApps.Appwrite.Client/Internals/IBaseApi.cs similarity index 100% rename from src/Appwrite.Client/Internals/IBaseApi.cs rename to src/PinguApps.Appwrite.Client/Internals/IBaseApi.cs diff --git a/src/PinguApps.Appwrite.Client/PinguApps.Appwrite.Client.csproj b/src/PinguApps.Appwrite.Client/PinguApps.Appwrite.Client.csproj new file mode 100644 index 00000000..2a3b5101 --- /dev/null +++ b/src/PinguApps.Appwrite.Client/PinguApps.Appwrite.Client.csproj @@ -0,0 +1,39 @@ + + + + netstandard2.1 + enable + latest + + PinguApps.Appwrite.Client + Appwrite;Pingu;PinguApps;Pingu Apps;CSharp;Sdk;Client; + icon.png + README.md + true + snupkg + true + MIT + https://github.com/PinguApps/AppwriteClient + git + true + Pingu + PinguApps + A .NET implementation of the Appwrite SDK for client-side consumption. Ideal for developers looking to leverage Appwrite's powerful backend capabilities in their .NET applications. + Copyright 2024 (c) Pingu. All rights reserved. + + + + + + + + + + + + + + + + + diff --git a/src/Appwrite.Client/ServiceCollectionExtensions.cs b/src/PinguApps.Appwrite.Client/ServiceCollectionExtensions.cs similarity index 100% rename from src/Appwrite.Client/ServiceCollectionExtensions.cs rename to src/PinguApps.Appwrite.Client/ServiceCollectionExtensions.cs diff --git a/src/Appwrite.Client/Utils/ResponseUtils.cs b/src/PinguApps.Appwrite.Client/Utils/ResponseUtils.cs similarity index 100% rename from src/Appwrite.Client/Utils/ResponseUtils.cs rename to src/PinguApps.Appwrite.Client/Utils/ResponseUtils.cs diff --git a/src/Appwrite.Playground/App.cs b/src/PinguApps.Appwrite.Playground/App.cs similarity index 100% rename from src/Appwrite.Playground/App.cs rename to src/PinguApps.Appwrite.Playground/App.cs diff --git a/src/Appwrite.Playground/PinguApps.Appwrite.Playground.csproj b/src/PinguApps.Appwrite.Playground/PinguApps.Appwrite.Playground.csproj similarity index 87% rename from src/Appwrite.Playground/PinguApps.Appwrite.Playground.csproj rename to src/PinguApps.Appwrite.Playground/PinguApps.Appwrite.Playground.csproj index 481aec4d..8978c78d 100644 --- a/src/Appwrite.Playground/PinguApps.Appwrite.Playground.csproj +++ b/src/PinguApps.Appwrite.Playground/PinguApps.Appwrite.Playground.csproj @@ -22,7 +22,7 @@ - + diff --git a/src/Appwrite.Playground/Program.cs b/src/PinguApps.Appwrite.Playground/Program.cs similarity index 100% rename from src/Appwrite.Playground/Program.cs rename to src/PinguApps.Appwrite.Playground/Program.cs diff --git a/src/PinguApps.Appwrite.Server/PinguApps.Appwrite.Server.csproj b/src/PinguApps.Appwrite.Server/PinguApps.Appwrite.Server.csproj index 97752f2f..e075a563 100644 --- a/src/PinguApps.Appwrite.Server/PinguApps.Appwrite.Server.csproj +++ b/src/PinguApps.Appwrite.Server/PinguApps.Appwrite.Server.csproj @@ -4,6 +4,22 @@ netstandard2.1 enable latest + + PinguApps.Appwrite.Server + Appwrite;Pingu;PinguApps;Pingu Apps;CSharp;Sdk;Server; + icon.png + README.md + true + snupkg + true + MIT + https://github.com/PinguApps/AppwriteClient + git + true + Pingu + PinguApps + A .NET implementation of the Appwrite SDK for server-side consumption. Ideal for developers looking to leverage Appwrite's powerful backend capabilities in their .NET applications. + Copyright 2024 (c) Pingu. All rights reserved. diff --git a/tests/PinguApps.Appwrite.Client.Tests/PinguApps.Appwrite.Client.Tests.csproj b/tests/PinguApps.Appwrite.Client.Tests/PinguApps.Appwrite.Client.Tests.csproj index 15c64b23..3ff0562d 100644 --- a/tests/PinguApps.Appwrite.Client.Tests/PinguApps.Appwrite.Client.Tests.csproj +++ b/tests/PinguApps.Appwrite.Client.Tests/PinguApps.Appwrite.Client.Tests.csproj @@ -18,7 +18,7 @@ - +