From 8b5f667d99ecd45236d739dcac1c730f248b1a74 Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Tue, 12 Nov 2024 23:18:18 +0000 Subject: [PATCH 1/7] chore(deps): update dotnet monorepo to v9 --- LiftLog.Api/LiftLog.Api.csproj | 2 +- LiftLog.Maui/LiftLog.Maui.csproj | 6 +++--- LiftLog.Ui/LiftLog.Ui.csproj | 2 +- LiftLog.Web/LiftLog.Web.csproj | 4 ++-- tests/LiftLog.Tests.Api/LiftLog.Tests.Api.csproj | 2 +- 5 files changed, 8 insertions(+), 8 deletions(-) diff --git a/LiftLog.Api/LiftLog.Api.csproj b/LiftLog.Api/LiftLog.Api.csproj index e528ba73..11cfeee6 100644 --- a/LiftLog.Api/LiftLog.Api.csproj +++ b/LiftLog.Api/LiftLog.Api.csproj @@ -20,7 +20,7 @@ - + runtime; build; native; contentfiles; analyzers; buildtransitive all diff --git a/LiftLog.Maui/LiftLog.Maui.csproj b/LiftLog.Maui/LiftLog.Maui.csproj index fd97bd9d..31f3dfd5 100644 --- a/LiftLog.Maui/LiftLog.Maui.csproj +++ b/LiftLog.Maui/LiftLog.Maui.csproj @@ -114,13 +114,13 @@ - - + + - + diff --git a/LiftLog.Ui/LiftLog.Ui.csproj b/LiftLog.Ui/LiftLog.Ui.csproj index c1dd7227..25c982d5 100644 --- a/LiftLog.Ui/LiftLog.Ui.csproj +++ b/LiftLog.Ui/LiftLog.Ui.csproj @@ -28,7 +28,7 @@ - + diff --git a/LiftLog.Web/LiftLog.Web.csproj b/LiftLog.Web/LiftLog.Web.csproj index 4593ae90..e12c6d4d 100644 --- a/LiftLog.Web/LiftLog.Web.csproj +++ b/LiftLog.Web/LiftLog.Web.csproj @@ -17,8 +17,8 @@ - - + + runtime; build; native; contentfiles; analyzers; buildtransitive diff --git a/tests/LiftLog.Tests.Api/LiftLog.Tests.Api.csproj b/tests/LiftLog.Tests.Api/LiftLog.Tests.Api.csproj index f0cc0647..bfa075d7 100644 --- a/tests/LiftLog.Tests.Api/LiftLog.Tests.Api.csproj +++ b/tests/LiftLog.Tests.Api/LiftLog.Tests.Api.csproj @@ -11,7 +11,7 @@ - + From 8dd543d00627af57e437d3a0f9ff2c8df15a5e7b Mon Sep 17 00:00:00 2001 From: Liam Morrow Date: Wed, 13 Nov 2024 09:22:35 +1000 Subject: [PATCH 2/7] Switch to 9.0 on build --- .github/workflows/android-build.yml | 4 ++-- .github/workflows/android-publish.yml | 6 +++--- .github/workflows/ios-build.yml | 2 +- .github/workflows/ios-publish.yml | 4 ++-- .github/workflows/web-publish.yml | 6 +++--- LiftLog.Api/LiftLog.Api.csproj | 2 +- LiftLog.Lib/LiftLog.Lib.csproj | 2 +- LiftLog.Maui/LiftLog.Maui.csproj | 4 ++-- LiftLog.Maui/install.sh | 6 +++--- LiftLog.Ui/LiftLog.Ui.csproj | 2 +- LiftLog.Web/LiftLog.Web.csproj | 2 +- .../LiftLog.BackupServer/LiftLog.BackupServer.csproj | 2 +- scripts/collect-screenshots.ts | 6 +++--- tests/LiftLog.Tests.Api/LiftLog.Tests.Api.csproj | 2 +- tests/LiftLog.Tests.App/LiftLog.Tests.App.csproj | 2 +- 15 files changed, 26 insertions(+), 26 deletions(-) diff --git a/.github/workflows/android-build.yml b/.github/workflows/android-build.yml index d148089f..a3ac1677 100644 --- a/.github/workflows/android-build.yml +++ b/.github/workflows/android-build.yml @@ -26,7 +26,7 @@ jobs: - name: Setup MAUI run: dotnet workload restore - name: Restore dependencies - run: dotnet restore -p:TargetFramework=net8.0-android + run: dotnet restore -p:TargetFramework=net9.0-android - name: Setup JDK uses: actions/setup-java@v4 with: @@ -38,5 +38,5 @@ jobs: run: npm i && npm run build working-directory: ./LiftLog.Ui - name: Build - run: dotnet build -p:TargetFramework=net8.0-android -f net8.0-android -p:BuildFor=android + run: dotnet build -p:TargetFramework=net9.0-android -f net9.0-android -p:BuildFor=android working-directory: ./LiftLog.Maui diff --git a/.github/workflows/android-publish.yml b/.github/workflows/android-publish.yml index 47527006..00490b6a 100644 --- a/.github/workflows/android-publish.yml +++ b/.github/workflows/android-publish.yml @@ -26,7 +26,7 @@ jobs: - name: Setup MAUI run: dotnet workload restore - name: Restore dependencies - run: dotnet restore -p:TargetFramework=net8.0-android + run: dotnet restore -p:TargetFramework=net9.0-android - name: Put keystore env: ANDROID_KEYSTORE_BASE64: ${{ secrets.ANDROID_KEYSTORE_BASE64 }} @@ -52,7 +52,7 @@ jobs: run: dotnet build -c Release working-directory: ./LiftLog.Ui - name: Build - run: dotnet publish -p:TargetFramework=net8.0-android -f net8.0-android -c Release -p:BuildFor=android -p:AndroidKeyStore=true -p:AndroidSigningKeyStore=liftlog.keystore -p:AndroidSigningKeyAlias=liftlog -p:AndroidSigningKeyPass=env:KEYSTORE_PASS -p:AndroidSigningStorePass=env:KEYSTORE_PASS -p:UseSentryCLI=true -p:ApplicationDisplayVersion=${{ github.event.release.name }} -p:ApplicationVersion=${{ steps.buildNumber.outputs.build-number }} + run: dotnet publish -p:TargetFramework=net9.0-android -f net9.0-android -c Release -p:BuildFor=android -p:AndroidKeyStore=true -p:AndroidSigningKeyStore=liftlog.keystore -p:AndroidSigningKeyAlias=liftlog -p:AndroidSigningKeyPass=env:KEYSTORE_PASS -p:AndroidSigningStorePass=env:KEYSTORE_PASS -p:UseSentryCLI=true -p:ApplicationDisplayVersion=${{ github.event.release.name }} -p:ApplicationVersion=${{ steps.buildNumber.outputs.build-number }} working-directory: ./LiftLog.Maui env: KEYSTORE_PASS: ${{ secrets.ANDROID_KEYSTORE_PASS }} @@ -61,7 +61,7 @@ jobs: uses: r0adkll/upload-google-play@v1.1.3 with: packageName: com.limajuice.liftlog - releaseFiles: LiftLog.Maui/bin/Release/net8.0-android/publish/com.limajuice.liftlog-Signed.aab + releaseFiles: LiftLog.Maui/bin/Release/net9.0-android/publish/com.limajuice.liftlog-Signed.aab track: internal status: completed serviceAccountJsonPlainText: ${{ secrets.GOOGLE_PLAY_SERVICE_ACCOUNT_JSON }} diff --git a/.github/workflows/ios-build.yml b/.github/workflows/ios-build.yml index 3980b7d1..1804d278 100644 --- a/.github/workflows/ios-build.yml +++ b/.github/workflows/ios-build.yml @@ -47,7 +47,7 @@ jobs: run: npm i && npm run build working-directory: ./LiftLog.Ui - name: Build - run: 'dotnet publish -c Release -f:net8.0-ios -p:ArchiveOnBuild=true -p:RuntimeIdentifier=ios-arm64 -p:CodesignKey="${{ secrets.APPLE_CODESIGN_KEY_NAME }}" -p:CodesignProvision="LiftLog"' + run: 'dotnet publish -c Release -f:net9.0-ios -p:ArchiveOnBuild=true -p:RuntimeIdentifier=ios-arm64 -p:CodesignKey="${{ secrets.APPLE_CODESIGN_KEY_NAME }}" -p:CodesignProvision="LiftLog"' working-directory: ./LiftLog.Maui - name: Delete keychain if: always() # Always run this step to ensure the keychain is properly disposed of for self hosted runners diff --git a/.github/workflows/ios-publish.yml b/.github/workflows/ios-publish.yml index 7594e0ee..156e8f37 100644 --- a/.github/workflows/ios-publish.yml +++ b/.github/workflows/ios-publish.yml @@ -56,12 +56,12 @@ jobs: run: dotnet build -c Release working-directory: ./LiftLog.Ui - name: Build - run: 'dotnet publish -c Release -f:net8.0-ios -p:ArchiveOnBuild=true -p:RuntimeIdentifier=ios-arm64 -p:CodesignKey="${{ secrets.APPLE_CODESIGN_KEY_NAME }}" -p:CodesignProvision="LiftLog" -p:UseSentryCLI=true -p:ApplicationDisplayVersion=${{ github.event.release.name }} -p:ApplicationVersion=${{ steps.buildNumber.outputs.build-number }}' + run: 'dotnet publish -c Release -f:net9.0-ios -p:ArchiveOnBuild=true -p:RuntimeIdentifier=ios-arm64 -p:CodesignKey="${{ secrets.APPLE_CODESIGN_KEY_NAME }}" -p:CodesignProvision="LiftLog" -p:UseSentryCLI=true -p:ApplicationDisplayVersion=${{ github.event.release.name }} -p:ApplicationVersion=${{ steps.buildNumber.outputs.build-number }}' working-directory: ./LiftLog.Maui env: SENTRY_AUTH_TOKEN: ${{ secrets.SENTRY_AUTH_TOKEN }} - name: Upload with altool - run: xcrun altool --upload-app -f LiftLog.Maui/bin/Release/net8.0-ios/ios-arm64/publish/LiftLog.Maui.ipa -t ios -p '${{secrets.APPLE_UPLOAD_PASS}}' -u ${{secrets.APPLE_UPLOAD_USER}} + run: xcrun altool --upload-app -f LiftLog.Maui/bin/Release/net9.0-ios/ios-arm64/publish/LiftLog.Maui.ipa -t ios -p '${{secrets.APPLE_UPLOAD_PASS}}' -u ${{secrets.APPLE_UPLOAD_USER}} - name: Delete keychain if: always() # Always run this step to ensure the keychain is properly disposed of for self hosted runners run: | diff --git a/.github/workflows/web-publish.yml b/.github/workflows/web-publish.yml index c0f7e68d..68a77550 100644 --- a/.github/workflows/web-publish.yml +++ b/.github/workflows/web-publish.yml @@ -38,13 +38,13 @@ jobs: run: dotnet publish -c Release working-directory: ./LiftLog.Web - name: Copy 404 page - run: cp ./404.html ./LiftLog.Web/bin/Release/net8.0/publish/wwwroot + run: cp ./404.html ./LiftLog.Web/bin/Release/net9.0/publish/wwwroot - name: List files recusively - run: ls -R ./LiftLog.Web/bin/Release/net8.0/publish/wwwroot + run: ls -R ./LiftLog.Web/bin/Release/net9.0/publish/wwwroot - name: Upload pages uses: actions/upload-pages-artifact@v3 with: - path: ./LiftLog.Web/bin/Release/net8.0/publish/wwwroot + path: ./LiftLog.Web/bin/Release/net9.0/publish/wwwroot - name: Deploy to GitHub Pages id: deployment uses: actions/deploy-pages@v4 diff --git a/LiftLog.Api/LiftLog.Api.csproj b/LiftLog.Api/LiftLog.Api.csproj index 11cfeee6..99dcf162 100644 --- a/LiftLog.Api/LiftLog.Api.csproj +++ b/LiftLog.Api/LiftLog.Api.csproj @@ -1,7 +1,7 @@ - net8.0 + net9.0 enable enable true diff --git a/LiftLog.Lib/LiftLog.Lib.csproj b/LiftLog.Lib/LiftLog.Lib.csproj index f554de68..467ee8f6 100644 --- a/LiftLog.Lib/LiftLog.Lib.csproj +++ b/LiftLog.Lib/LiftLog.Lib.csproj @@ -1,7 +1,7 @@ - net8.0 + net9.0 enable true enable diff --git a/LiftLog.Maui/LiftLog.Maui.csproj b/LiftLog.Maui/LiftLog.Maui.csproj index 31f3dfd5..306a32da 100644 --- a/LiftLog.Maui/LiftLog.Maui.csproj +++ b/LiftLog.Maui/LiftLog.Maui.csproj @@ -1,9 +1,9 @@ - net8.0-android + net9.0-android - $(TargetFrameworks);net8.0-ios; + $(TargetFrameworks);net9.0-ios; Exe LiftLog.Maui diff --git a/LiftLog.Maui/install.sh b/LiftLog.Maui/install.sh index f4aa745c..133315fd 100755 --- a/LiftLog.Maui/install.sh +++ b/LiftLog.Maui/install.sh @@ -7,13 +7,13 @@ cd ../LiftLog.Maui # If -r we want release build if [ "$1" == "-r" ]; then echo "Release build" -dotnet build -t:Run -c Release -f net8.0-android -p:TargetFramework=net8.0-android -p:EnableLLVM=false -p:AndroidEnableProfiledAot=true -p:ExtraDefineConstants=TEST_MODE #-p:AndroidEnableProfiler=true +dotnet build -t:Run -c Release -f net9.0-android -p:TargetFramework=net9.0-android -p:EnableLLVM=false -p:AndroidEnableProfiledAot=true -p:ExtraDefineConstants=TEST_MODE #-p:AndroidEnableProfiler=true exit 0 fi if [ "$1" == "-c" ]; then dotnet clean - dotnet clean -f net8.0-android + dotnet clean -f net9.0-android fi -dotnet build -t:Run -c Debug -f net8.0-android -p:TargetFramework=net8.0-android -p:BuildFor=android -p:ExtraDefineConstants=TEST_MODE #-p:AndroidEnableProfiler=true +dotnet build -t:Run -c Debug -f net9.0-android -p:TargetFramework=net9.0-android -p:BuildFor=android -p:ExtraDefineConstants=TEST_MODE #-p:AndroidEnableProfiler=true diff --git a/LiftLog.Ui/LiftLog.Ui.csproj b/LiftLog.Ui/LiftLog.Ui.csproj index 25c982d5..5afc428e 100644 --- a/LiftLog.Ui/LiftLog.Ui.csproj +++ b/LiftLog.Ui/LiftLog.Ui.csproj @@ -1,7 +1,7 @@ - net8.0 + net9.0 enable enable true diff --git a/LiftLog.Web/LiftLog.Web.csproj b/LiftLog.Web/LiftLog.Web.csproj index e12c6d4d..9e7ea3c8 100644 --- a/LiftLog.Web/LiftLog.Web.csproj +++ b/LiftLog.Web/LiftLog.Web.csproj @@ -1,7 +1,7 @@ - net8.0 + net9.0 enable true enable diff --git a/examples/remote-backup/reference-server-implementation/LiftLog.BackupServer/LiftLog.BackupServer.csproj b/examples/remote-backup/reference-server-implementation/LiftLog.BackupServer/LiftLog.BackupServer.csproj index ddbc0039..02ad796e 100644 --- a/examples/remote-backup/reference-server-implementation/LiftLog.BackupServer/LiftLog.BackupServer.csproj +++ b/examples/remote-backup/reference-server-implementation/LiftLog.BackupServer/LiftLog.BackupServer.csproj @@ -1,7 +1,7 @@ - net8.0 + net9.0 enable enable liftlog-backupserver diff --git a/scripts/collect-screenshots.ts b/scripts/collect-screenshots.ts index 9e26cefb..7a8073ca 100755 --- a/scripts/collect-screenshots.ts +++ b/scripts/collect-screenshots.ts @@ -72,13 +72,13 @@ const androidDevices = [ "Pixel_5_API_34", ]; -await $`dotnet clean ../LiftLog.Maui -f net8.0-android`; +await $`dotnet clean ../LiftLog.Maui -f net9.0-android`; for (const device of androidDevices) { await $`mkdir -p ${getDeviceFolder(device)}`; const emulator = startEmulator(device).text(); await $`echo Press enter when emulator loaded`; await $`read`; - // await $`dotnet build ../LiftLog.Maui -t:Run -c Debug -f net8.0-android -p:TargetFramework=net8.0-android -p:BuildFor=android -p:Device=${device}`; + // await $`dotnet build ../LiftLog.Maui -t:Run -c Debug -f net9.0-android -p:TargetFramework=net9.0-android -p:BuildFor=android -p:Device=${device}`; await sleep(5000); for (const coords of screenshotCoords) { @@ -92,7 +92,7 @@ for (const device of iosDevices) { await $`mkdir -p ${getDeviceFolder(device)}`; await startSimulator(device); const simulatorId = await getIosSimulatorId(device); - // $`dotnet build ../LiftLog.Maui -t:Run -f net8.0-ios -p:RuntimeIdentifiers=iossimulator-x64 -c Debug -p:ExtraDefineConstants=DEBUG_IOSSIM -p:_DeviceName=:v2:udid=${simulatorId}`.text(); + // $`dotnet build ../LiftLog.Maui -t:Run -f net9.0-ios -p:RuntimeIdentifiers=iossimulator-x64 -c Debug -p:ExtraDefineConstants=DEBUG_IOSSIM -p:_DeviceName=:v2:udid=${simulatorId}`.text(); // await sleep(25000); for (const coords of screenshotCoords) { goToScreenshotUrlIos(coords, simulatorId); diff --git a/tests/LiftLog.Tests.Api/LiftLog.Tests.Api.csproj b/tests/LiftLog.Tests.Api/LiftLog.Tests.Api.csproj index bfa075d7..fff3ce0a 100644 --- a/tests/LiftLog.Tests.Api/LiftLog.Tests.Api.csproj +++ b/tests/LiftLog.Tests.Api/LiftLog.Tests.Api.csproj @@ -1,7 +1,7 @@ - net8.0 + net9.0 enable enable diff --git a/tests/LiftLog.Tests.App/LiftLog.Tests.App.csproj b/tests/LiftLog.Tests.App/LiftLog.Tests.App.csproj index 362a1b78..c0701c44 100644 --- a/tests/LiftLog.Tests.App/LiftLog.Tests.App.csproj +++ b/tests/LiftLog.Tests.App/LiftLog.Tests.App.csproj @@ -1,7 +1,7 @@ - net8.0 + net9.0 enable enable From efe75cf2c5f3209615b2bf57c1243925dde49617 Mon Sep 17 00:00:00 2001 From: Liam Morrow Date: Wed, 13 Nov 2024 09:23:04 +1000 Subject: [PATCH 3/7] Update dotnet setup --- .github/workflows/android-build.yml | 2 +- .github/workflows/android-publish.yml | 2 +- .github/workflows/api-build.yml | 2 +- .github/workflows/api-publish.yml | 2 +- .github/workflows/api-test.yml | 2 +- .github/workflows/backupserver-build.yml | 2 +- .github/workflows/backupserver-publish.yml | 2 +- .github/workflows/format.yml | 2 +- .github/workflows/ios-build.yml | 2 +- .github/workflows/ios-publish.yml | 2 +- .github/workflows/ui-test.yml | 2 +- .github/workflows/ui-unit-test.yml | 2 +- .github/workflows/web-publish.yml | 2 +- 13 files changed, 13 insertions(+), 13 deletions(-) diff --git a/.github/workflows/android-build.yml b/.github/workflows/android-build.yml index a3ac1677..75e22214 100644 --- a/.github/workflows/android-build.yml +++ b/.github/workflows/android-build.yml @@ -16,7 +16,7 @@ jobs: - name: Setup .NET uses: actions/setup-dotnet@v4 with: - dotnet-version: 8.0.x + dotnet-version: 9.0.x - name: Setup MAUI android run: dotnet workload install android # When running on a self hosted mac runner, the ios workload needs to be installed due to csproj configuration diff --git a/.github/workflows/android-publish.yml b/.github/workflows/android-publish.yml index 00490b6a..9185886a 100644 --- a/.github/workflows/android-publish.yml +++ b/.github/workflows/android-publish.yml @@ -16,7 +16,7 @@ jobs: - name: Setup .NET uses: actions/setup-dotnet@v4 with: - dotnet-version: 8.0.x + dotnet-version: 9.0.x - name: Setup MAUI android run: dotnet workload install android # When running on a self hosted mac runner, the ios workload needs to be installed due to csproj configuration diff --git a/.github/workflows/api-build.yml b/.github/workflows/api-build.yml index e5d2dc14..f3bb1ba2 100644 --- a/.github/workflows/api-build.yml +++ b/.github/workflows/api-build.yml @@ -13,7 +13,7 @@ jobs: - name: Setup .NET uses: actions/setup-dotnet@v4 with: - dotnet-version: 8.0.x + dotnet-version: 9.0.x - name: Build run: dotnet build working-directory: ./LiftLog.Api diff --git a/.github/workflows/api-publish.yml b/.github/workflows/api-publish.yml index b4ba0d46..3fdc22f5 100644 --- a/.github/workflows/api-publish.yml +++ b/.github/workflows/api-publish.yml @@ -22,7 +22,7 @@ jobs: - name: Setup .NET uses: actions/setup-dotnet@v4 with: - dotnet-version: 8.0.x + dotnet-version: 9.0.x - name: Log into registry ${{ env.REGISTRY }} uses: docker/login-action@v3 diff --git a/.github/workflows/api-test.yml b/.github/workflows/api-test.yml index d65b7183..c58eb879 100644 --- a/.github/workflows/api-test.yml +++ b/.github/workflows/api-test.yml @@ -35,7 +35,7 @@ jobs: - name: Setup .NET uses: actions/setup-dotnet@v4 with: - dotnet-version: 8.0.x + dotnet-version: 9.0.x - name: Restore dependencies run: dotnet restore working-directory: ./tests/LiftLog.Tests.Api diff --git a/.github/workflows/backupserver-build.yml b/.github/workflows/backupserver-build.yml index d413a4ce..bbcf4e5b 100644 --- a/.github/workflows/backupserver-build.yml +++ b/.github/workflows/backupserver-build.yml @@ -13,7 +13,7 @@ jobs: - name: Setup .NET uses: actions/setup-dotnet@v4 with: - dotnet-version: 8.0.x + dotnet-version: 9.0.x - name: Build run: dotnet build working-directory: ./examples/remote-backup/reference-server-implementation/LiftLog.BackupServer diff --git a/.github/workflows/backupserver-publish.yml b/.github/workflows/backupserver-publish.yml index 75d42270..3dee5cd8 100644 --- a/.github/workflows/backupserver-publish.yml +++ b/.github/workflows/backupserver-publish.yml @@ -22,7 +22,7 @@ jobs: - name: Setup .NET uses: actions/setup-dotnet@v4 with: - dotnet-version: 8.0.x + dotnet-version: 9.0.x - name: Log into registry ${{ env.REGISTRY }} uses: docker/login-action@v3 diff --git a/.github/workflows/format.yml b/.github/workflows/format.yml index e862b9bd..c03727eb 100644 --- a/.github/workflows/format.yml +++ b/.github/workflows/format.yml @@ -16,7 +16,7 @@ jobs: - name: Setup .NET uses: actions/setup-dotnet@v4 with: - dotnet-version: 8.0.x + dotnet-version: 9.0.x - name: Install csharpier run: dotnet tool restore - name: Format with csharpier diff --git a/.github/workflows/ios-build.yml b/.github/workflows/ios-build.yml index 1804d278..a3d20d25 100644 --- a/.github/workflows/ios-build.yml +++ b/.github/workflows/ios-build.yml @@ -19,7 +19,7 @@ jobs: - name: Setup .NET uses: actions/setup-dotnet@v4 with: - dotnet-version: 8.0.x + dotnet-version: 9.0.x - uses: maxim-lobanov/setup-xcode@v1 with: xcode-version: latest-stable diff --git a/.github/workflows/ios-publish.yml b/.github/workflows/ios-publish.yml index 156e8f37..2d1303df 100644 --- a/.github/workflows/ios-publish.yml +++ b/.github/workflows/ios-publish.yml @@ -19,7 +19,7 @@ jobs: - name: Setup .NET uses: actions/setup-dotnet@v4 with: - dotnet-version: 8.0.x + dotnet-version: 9.0.x - uses: maxim-lobanov/setup-xcode@v1 with: xcode-version: latest-stable diff --git a/.github/workflows/ui-test.yml b/.github/workflows/ui-test.yml index 1de52b4b..6cf31de9 100644 --- a/.github/workflows/ui-test.yml +++ b/.github/workflows/ui-test.yml @@ -15,7 +15,7 @@ jobs: - name: Setup .NET uses: actions/setup-dotnet@v4 with: - dotnet-version: 8.0.x + dotnet-version: 9.0.x - name: Restore dependencies run: dotnet restore working-directory: ./LiftLog.Web diff --git a/.github/workflows/ui-unit-test.yml b/.github/workflows/ui-unit-test.yml index 24ed3a42..bea14543 100644 --- a/.github/workflows/ui-unit-test.yml +++ b/.github/workflows/ui-unit-test.yml @@ -15,7 +15,7 @@ jobs: - name: Setup .NET uses: actions/setup-dotnet@v4 with: - dotnet-version: 8.0.x + dotnet-version: 9.0.x - name: Restore dependencies run: dotnet restore working-directory: ./tests/LiftLog.Tests.App diff --git a/.github/workflows/web-publish.yml b/.github/workflows/web-publish.yml index 68a77550..8e2f5f6e 100644 --- a/.github/workflows/web-publish.yml +++ b/.github/workflows/web-publish.yml @@ -27,7 +27,7 @@ jobs: - name: Setup .NET uses: actions/setup-dotnet@v4 with: - dotnet-version: 8.0.x + dotnet-version: 9.0.x - name: Build Tailwind run: npm i && npm run build working-directory: ./LiftLog.Ui From 45f9dba44f45461405ac90bdc40fb0bc03c16a34 Mon Sep 17 00:00:00 2001 From: Liam Morrow Date: Wed, 27 Nov 2024 12:41:58 +1100 Subject: [PATCH 4/7] Update npgsql --- LiftLog.Api/LiftLog.Api.csproj | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/LiftLog.Api/LiftLog.Api.csproj b/LiftLog.Api/LiftLog.Api.csproj index 61ae3285..c5351ecf 100644 --- a/LiftLog.Api/LiftLog.Api.csproj +++ b/LiftLog.Api/LiftLog.Api.csproj @@ -24,7 +24,7 @@ runtime; build; native; contentfiles; analyzers; buildtransitive all - + From 71959d3d8e047cc8b079e1fc888ab7d0ca80b94e Mon Sep 17 00:00:00 2001 From: Liam Morrow Date: Wed, 27 Nov 2024 12:55:40 +1100 Subject: [PATCH 5/7] Use manual tosnakecase --- LiftLog.Api/Db/ConversionExtensions.cs | 134 +++++++++++++++++++++++++ LiftLog.Api/Db/RateLimitContext.cs | 1 + LiftLog.Api/Db/UserDataContext.cs | 1 + LiftLog.Api/LiftLog.Api.csproj | 1 - LiftLog.Api/Program.cs | 6 +- 5 files changed, 139 insertions(+), 4 deletions(-) create mode 100644 LiftLog.Api/Db/ConversionExtensions.cs diff --git a/LiftLog.Api/Db/ConversionExtensions.cs b/LiftLog.Api/Db/ConversionExtensions.cs new file mode 100644 index 00000000..f353d8f4 --- /dev/null +++ b/LiftLog.Api/Db/ConversionExtensions.cs @@ -0,0 +1,134 @@ +namespace LiftLog.Api.Db; + +using System.Globalization; +using System.Text; +using Microsoft.EntityFrameworkCore; + +public static class ConversionExtensions +{ + private static CultureInfo _culture = CultureInfo.InvariantCulture; + + public static void ToSnakeCaseNames(this ModelBuilder modelBuilder) + { + _culture = CultureInfo.InvariantCulture; + + SetNames(modelBuilder, NamingConvention.SnakeCase); + } + + public static void ToLowerCaseNames(this ModelBuilder modelBuilder) + { + _culture = CultureInfo.InvariantCulture; + + SetNames(modelBuilder, NamingConvention.LowerCase); + } + + private static string? NameRewriter(this string name, NamingConvention naming) + { + if (string.IsNullOrEmpty(name)) + return name; + + return naming == NamingConvention.SnakeCase + ? SnakeCaseNameRewriter(name) + : LowerCaseNameRewriter(name); + } + + private enum NamingConvention + { + SnakeCase, + LowerCase, + } + + private static void SetNames(ModelBuilder modelBuilder, NamingConvention naming) + { + _culture = CultureInfo.InvariantCulture; + + foreach (var entity in modelBuilder.Model.GetEntityTypes()) + { + entity.SetViewName(entity.GetViewName()?.NameRewriter(naming)); + entity.SetSchema(entity.GetSchema()?.NameRewriter(naming)); + entity.SetTableName(entity.GetTableName()?.NameRewriter(naming)); + + foreach (var property in entity!.GetProperties()) + { + property.SetColumnName(property.GetColumnName()?.NameRewriter(naming)); + } + + foreach (var key in entity.GetKeys()) + { + key.SetName(key.GetName()?.NameRewriter(naming)); + } + + foreach (var key in entity.GetForeignKeys()) + { + key.SetConstraintName(key.GetConstraintName()?.NameRewriter(naming)); + } + + foreach (var index in entity.GetIndexes()) + { + index.SetDatabaseName(index.GetDatabaseName()?.NameRewriter(naming)); + } + } + } + + private static string? LowerCaseNameRewriter(string name) => name.ToLower(_culture); + + // https://github.com/efcore/EFCore.NamingConventions/blob/main/EFCore.NamingConventions/Internal/SnakeCaseNameRewriter.cs + private static string SnakeCaseNameRewriter(string name) + { + var builder = new StringBuilder(name.Length + Math.Min(2, name.Length / 5)); + var previousCategory = default(UnicodeCategory?); + + for (var currentIndex = 0; currentIndex < name.Length; currentIndex++) + { + var currentChar = name[currentIndex]; + if (currentChar == '_') + { + builder.Append('_'); + previousCategory = null; + continue; + } + + var currentCategory = char.GetUnicodeCategory(currentChar); + switch (currentCategory) + { + case UnicodeCategory.UppercaseLetter: + case UnicodeCategory.TitlecaseLetter: + if ( + previousCategory == UnicodeCategory.SpaceSeparator + || previousCategory == UnicodeCategory.LowercaseLetter + || previousCategory != UnicodeCategory.DecimalDigitNumber + && previousCategory != null + && currentIndex > 0 + && currentIndex + 1 < name.Length + && char.IsLower(name[currentIndex + 1]) + ) + { + builder.Append('_'); + } + + currentChar = char.ToLower(currentChar, _culture); + break; + + case UnicodeCategory.LowercaseLetter: + case UnicodeCategory.DecimalDigitNumber: + if (previousCategory == UnicodeCategory.SpaceSeparator) + { + builder.Append('_'); + } + break; + + default: + if (previousCategory != null) + { + previousCategory = UnicodeCategory.SpaceSeparator; + } + continue; + } + + builder.Append(currentChar); + previousCategory = currentCategory; + } + + return builder.ToString().ToLower(_culture); + } +} diff --git a/LiftLog.Api/Db/RateLimitContext.cs b/LiftLog.Api/Db/RateLimitContext.cs index bc3aba87..dab27c38 100644 --- a/LiftLog.Api/Db/RateLimitContext.cs +++ b/LiftLog.Api/Db/RateLimitContext.cs @@ -10,5 +10,6 @@ public class RateLimitContext(DbContextOptions options) : DbCo protected override void OnModelCreating(ModelBuilder modelBuilder) { modelBuilder.Entity().HasKey(x => x.Key); + modelBuilder.ToSnakeCaseNames(); } } diff --git a/LiftLog.Api/Db/UserDataContext.cs b/LiftLog.Api/Db/UserDataContext.cs index 48f922d9..8779f94b 100644 --- a/LiftLog.Api/Db/UserDataContext.cs +++ b/LiftLog.Api/Db/UserDataContext.cs @@ -54,5 +54,6 @@ protected override void OnModelCreating(ModelBuilder modelBuilder) modelBuilder.Entity().HasIndex(x => x.Expiry); modelBuilder.Entity().HasKey(x => new { x.UserId, x.Id }); + modelBuilder.ToSnakeCaseNames(); } } diff --git a/LiftLog.Api/LiftLog.Api.csproj b/LiftLog.Api/LiftLog.Api.csproj index c5351ecf..ae85bf32 100644 --- a/LiftLog.Api/LiftLog.Api.csproj +++ b/LiftLog.Api/LiftLog.Api.csproj @@ -19,7 +19,6 @@ - runtime; build; native; contentfiles; analyzers; buildtransitive all diff --git a/LiftLog.Api/Program.cs b/LiftLog.Api/Program.cs index ad79cf77..89c47237 100644 --- a/LiftLog.Api/Program.cs +++ b/LiftLog.Api/Program.cs @@ -24,13 +24,13 @@ options .UseNpgsql(builder.Configuration.GetConnectionString("UserDataContext")) .ReplaceService() - .UseSnakeCaseNamingConvention() +// .UseSnakeCaseNamingConvention() ); builder.Services.AddDbContext(options => options .UseNpgsql(builder.Configuration.GetConnectionString("RateLimitContext")) .ReplaceService() - .UseSnakeCaseNamingConvention() +// .UseSnakeCaseNamingConvention() ); builder.Services.AddCors(options => { @@ -71,7 +71,7 @@ builder.Configuration.GetValue("GooglePlayServiceAccountEmail") ?? throw new Exception("GooglePlayServiceAccountEmail configuration is not set."); var certificateBytes = Convert.FromBase64String(certificateBase64); - var certificate = new X509Certificate2( + var certificate = X509CertificateLoader.LoadPkcs12( certificateBytes, "notasecret", X509KeyStorageFlags.Exportable From 8be7ee46757cc060e7a0b48efda34f468310844e Mon Sep 17 00:00:00 2001 From: Liam Morrow Date: Wed, 27 Nov 2024 13:21:30 +1100 Subject: [PATCH 6/7] Remove duplicate package ref --- LiftLog.Web/LiftLog.Web.csproj | 1 - 1 file changed, 1 deletion(-) diff --git a/LiftLog.Web/LiftLog.Web.csproj b/LiftLog.Web/LiftLog.Web.csproj index 9d669ceb..d4dce2ad 100644 --- a/LiftLog.Web/LiftLog.Web.csproj +++ b/LiftLog.Web/LiftLog.Web.csproj @@ -16,7 +16,6 @@ - From b0743de8279737047121b98eb69e5615dc52ae2d Mon Sep 17 00:00:00 2001 From: Liam Morrow Date: Wed, 27 Nov 2024 13:22:15 +1100 Subject: [PATCH 7/7] Remove duplicate package ref --- LiftLog.Maui/LiftLog.Maui.csproj | 1 - 1 file changed, 1 deletion(-) diff --git a/LiftLog.Maui/LiftLog.Maui.csproj b/LiftLog.Maui/LiftLog.Maui.csproj index 306a32da..d5137216 100644 --- a/LiftLog.Maui/LiftLog.Maui.csproj +++ b/LiftLog.Maui/LiftLog.Maui.csproj @@ -109,7 +109,6 @@ -