From ed9fc3a8a020df754e5a6761e58b0c06676c0ece Mon Sep 17 00:00:00 2001
From: Andy Pack <andy@sarsoo.xyz>
Date: Sat, 15 Mar 2025 14:33:27 +0000
Subject: [PATCH] upgrading to .net 9, adding arm images

---
 .gitea/workflows/ci.yml                       |  2 +-
 .github/workflows/ci.yml                      | 49 ++++++++++---------
 Dockerfile                                    |  6 +--
 Overflow.CLI/Overflow.CLI.csproj              |  4 +-
 Overflow.Test/Overflow.Test.csproj            | 12 ++---
 .../Overflow.Web.Client.csproj                |  8 +--
 Overflow.Web/Overflow.Web.csproj              | 22 ++++-----
 Overflow/Overflow.csproj                      | 16 +++---
 Overflow/SouthernWater/SouthernWaterApi.cs    | 16 +++---
 9 files changed, 69 insertions(+), 66 deletions(-)

diff --git a/.gitea/workflows/ci.yml b/.gitea/workflows/ci.yml
index bc9c43f..9887720 100644
--- a/.gitea/workflows/ci.yml
+++ b/.gitea/workflows/ci.yml
@@ -9,7 +9,7 @@ jobs:
     name: Build & Unit Test
     strategy:
       matrix:
-        dotnet-version: [ '8.0.x' ]
+        dotnet-version: [ '9.0.x' ]
         arch: ['ubuntu-latest', 'ubuntu-latest-arm']
 
     steps:
diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml
index 7fc04b7..33858e7 100644
--- a/.github/workflows/ci.yml
+++ b/.github/workflows/ci.yml
@@ -5,12 +5,12 @@ on: [push]
 jobs:
   build:
 
-    runs-on: ubuntu-latest
+    runs-on: ${{ matrix.arch }}
     name: Build & Unit Test
     strategy:
-      fail-fast: false
       matrix:
-        dotnet-version: [ '8.0.x' ]
+        dotnet-version: [ '9.0.x' ]
+        arch: ['ubuntu-latest', 'ubuntu-24.04-arm']
 
     steps:
       - uses: actions/checkout@v2
@@ -29,8 +29,11 @@ jobs:
 
   build-Docker:
 
-    runs-on: ubuntu-latest
+    runs-on: ${{ matrix.arch }}
     name: Build Containers
+    strategy:
+      matrix:
+        arch: ['ubuntu-latest', 'ubuntu-24.04-arm']
     needs: [build] # for ignoring bad builds
     if: github.event_name == 'push' && (github.ref == 'refs/heads/master' || startsWith(github.ref, 'refs/tags/'))
 
@@ -55,25 +58,25 @@ jobs:
             sarsoo/overflow:${{ github.ref_name }}
           file: Dockerfile
 
-  deploy:
+  # deploy:
 
-    runs-on: ubuntu-latest
-    name: Deploy
-    needs: [build-Docker] # for ignoring bad builds
-    if: github.event_name == 'push' && (github.ref == 'refs/heads/master' || startsWith(github.ref, 'refs/tags/'))
-    environment: 
-      name: prod
-      url: https://overflow.sarsoo.xyz
-    steps:
-      - uses: actions/checkout@v3
+  #   runs-on: ubuntu-latest
+  #   name: Deploy
+  #   needs: [build-Docker] # for ignoring bad builds
+  #   if: github.event_name == 'push' && (github.ref == 'refs/heads/master' || startsWith(github.ref, 'refs/tags/'))
+  #   environment: 
+  #     name: prod
+  #     url: https://overflow.sarsoo.xyz
+  #   steps:
+  #     - uses: actions/checkout@v3
 
-      - name: Tailscale
-        uses: tailscale/github-action@v2
-        with:
-          oauth-client-id: ${{ secrets.TS_OAUTH_CLIENT_ID }}
-          oauth-secret: ${{ secrets.TS_OAUTH_SECRET }}
-          tags: tag:ci
-          version: 1.68.1
+  #     - name: Tailscale
+  #       uses: tailscale/github-action@v2
+  #       with:
+  #         oauth-client-id: ${{ secrets.TS_OAUTH_CLIENT_ID }}
+  #         oauth-secret: ${{ secrets.TS_OAUTH_SECRET }}
+  #         tags: tag:ci
+  #         version: 1.68.1
 
-      - name: Deploy
-        run: ssh -o StrictHostKeyChecking=no ${{ secrets.TS_SSH }} -t "cd overflow/ && docker compose up -d --pull always"
\ No newline at end of file
+  #     - name: Deploy
+  #       run: ssh -o StrictHostKeyChecking=no ${{ secrets.TS_SSH }} -t "cd overflow/ && docker compose up -d --pull always"
\ No newline at end of file
diff --git a/Dockerfile b/Dockerfile
index 026b141..83f8e3b 100644
--- a/Dockerfile
+++ b/Dockerfile
@@ -1,4 +1,4 @@
-FROM mcr.microsoft.com/dotnet/sdk:8.0 AS base
+FROM mcr.microsoft.com/dotnet/sdk:9.0 AS base
 
 RUN dotnet workload install wasm-tools
 RUN apt update && apt install -y python3
@@ -6,7 +6,7 @@ RUN apt update && apt install -y python3
 COPY *.sln .
 COPY Overflow/*.csproj ./Overflow/
 COPY Overflow.Web/*.csproj ./Overflow.Web/
-COPY Overflow.Web.Client/*.csproj ./Overflow.Web.Clientl/
+COPY Overflow.Web.Client/*.csproj ./Overflow.Web.Client/
 RUN dotnet restore ./Overflow.Web/Overflow.Web.csproj
 
 COPY . ./
@@ -14,7 +14,7 @@ COPY . ./
 FROM base as publish
 RUN dotnet publish Overflow.Web/Overflow.Web.csproj -c Release -o /app
 
-FROM mcr.microsoft.com/dotnet/aspnet:8.0
+FROM mcr.microsoft.com/dotnet/aspnet:9.0
 EXPOSE 80
 WORKDIR /app
 COPY --from=publish /app ./
diff --git a/Overflow.CLI/Overflow.CLI.csproj b/Overflow.CLI/Overflow.CLI.csproj
index 05a83b4..06d3377 100644
--- a/Overflow.CLI/Overflow.CLI.csproj
+++ b/Overflow.CLI/Overflow.CLI.csproj
@@ -2,7 +2,7 @@
 
     <PropertyGroup>
         <OutputType>Exe</OutputType>
-        <TargetFramework>net8.0</TargetFramework>
+        <TargetFramework>net9.0</TargetFramework>
         <ImplicitUsings>enable</ImplicitUsings>
         <Nullable>enable</Nullable>
     </PropertyGroup>
@@ -12,7 +12,7 @@
     </ItemGroup>
 
     <ItemGroup>
-      <PackageReference Include="MongoDB.Driver" Version="2.29.0" />
+      <PackageReference Include="MongoDB.Driver" Version="3.2.1" />
     </ItemGroup>
 
 </Project>
diff --git a/Overflow.Test/Overflow.Test.csproj b/Overflow.Test/Overflow.Test.csproj
index e5fe097..d35aa81 100644
--- a/Overflow.Test/Overflow.Test.csproj
+++ b/Overflow.Test/Overflow.Test.csproj
@@ -1,7 +1,7 @@
 <Project Sdk="Microsoft.NET.Sdk">
 
     <PropertyGroup>
-        <TargetFramework>net8.0</TargetFramework>
+        <TargetFramework>net9.0</TargetFramework>
         <ImplicitUsings>enable</ImplicitUsings>
         <Nullable>enable</Nullable>
 
@@ -10,14 +10,14 @@
     </PropertyGroup>
 
     <ItemGroup>
-        <PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.11.1" />
-        <PackageReference Include="NUnit" Version="4.2.2" />
-        <PackageReference Include="NUnit3TestAdapter" Version="4.6.0" />
-        <PackageReference Include="NUnit.Analyzers" Version="4.3.0">
+        <PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.13.0" />
+        <PackageReference Include="NUnit" Version="4.3.2" />
+        <PackageReference Include="NUnit3TestAdapter" Version="5.0.0" />
+        <PackageReference Include="NUnit.Analyzers" Version="4.6.0">
           <PrivateAssets>all</PrivateAssets>
           <IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
         </PackageReference>
-        <PackageReference Include="coverlet.collector" Version="6.0.2">
+        <PackageReference Include="coverlet.collector" Version="6.0.4">
           <PrivateAssets>all</PrivateAssets>
           <IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
         </PackageReference>
diff --git a/Overflow.Web.Client/Overflow.Web.Client.csproj b/Overflow.Web.Client/Overflow.Web.Client.csproj
index 1d58fa1..eee8d61 100644
--- a/Overflow.Web.Client/Overflow.Web.Client.csproj
+++ b/Overflow.Web.Client/Overflow.Web.Client.csproj
@@ -1,7 +1,7 @@
 <Project Sdk="Microsoft.NET.Sdk.BlazorWebAssembly">
 
     <PropertyGroup>
-        <TargetFramework>net8.0</TargetFramework>
+        <TargetFramework>net9.0</TargetFramework>
         <Nullable>enable</Nullable>
         <ImplicitUsings>enable</ImplicitUsings>
         <RunAOTCompilation>true</RunAOTCompilation>
@@ -9,9 +9,9 @@
     </PropertyGroup>
 
     <ItemGroup>
-        <PackageReference Include="Microsoft.AspNetCore.Components.WebAssembly" Version="8.0.8" />
-        <PackageReference Include="Microsoft.AspNetCore.Components.WebAssembly.DevServer" Version="8.0.8" PrivateAssets="all" />
-        <PackageReference Include="Radzen.Blazor" Version="5.2.5" />
+        <PackageReference Include="Microsoft.AspNetCore.Components.WebAssembly" Version="9.0.3" />
+        <PackageReference Include="Microsoft.AspNetCore.Components.WebAssembly.DevServer" Version="9.0.3" PrivateAssets="all" />
+        <PackageReference Include="Radzen.Blazor" Version="6.2.7" />
     </ItemGroup>
 
     <ItemGroup>
diff --git a/Overflow.Web/Overflow.Web.csproj b/Overflow.Web/Overflow.Web.csproj
index 14e8c8b..ef6f12e 100644
--- a/Overflow.Web/Overflow.Web.csproj
+++ b/Overflow.Web/Overflow.Web.csproj
@@ -1,22 +1,22 @@
 <Project Sdk="Microsoft.NET.Sdk.Web">
 
     <PropertyGroup>
-        <TargetFramework>net8.0</TargetFramework>
+        <TargetFramework>net9.0</TargetFramework>
         <Nullable>enable</Nullable>
         <ImplicitUsings>enable</ImplicitUsings>
     </PropertyGroup>
 
     <ItemGroup>
-      <PackageReference Include="Microsoft.AspNetCore.Components.WebAssembly.Server" Version="8.0.8" />
-      <PackageReference Include="MongoDB.Driver" Version="2.29.0" />
-      <PackageReference Include="NLog" Version="5.3.4" />
-      <PackageReference Include="NLog.Extensions.Logging" Version="5.3.14" />
-      <PackageReference Include="NLog.Web.AspNetCore" Version="5.3.14" />
-      <PackageReference Include="Quartz" Version="3.13.0" />
-      <PackageReference Include="Quartz.AspNetCore" Version="3.13.0" />
-      <PackageReference Include="Quartz.Extensions.DependencyInjection" Version="3.13.0" />
-      <PackageReference Include="Quartz.Extensions.Hosting" Version="3.13.0" />
-      <PackageReference Include="Radzen.Blazor" Version="5.2.5" />
+      <PackageReference Include="Microsoft.AspNetCore.Components.WebAssembly.Server" Version="9.0.3" />
+      <PackageReference Include="MongoDB.Driver" Version="3.2.1" />
+      <PackageReference Include="NLog" Version="5.4.0" />
+      <PackageReference Include="NLog.Extensions.Logging" Version="5.4.0" />
+      <PackageReference Include="NLog.Web.AspNetCore" Version="5.4.0" />
+      <PackageReference Include="Quartz" Version="3.14.0" />
+      <PackageReference Include="Quartz.AspNetCore" Version="3.14.0" />
+      <PackageReference Include="Quartz.Extensions.DependencyInjection" Version="3.14.0" />
+      <PackageReference Include="Quartz.Extensions.Hosting" Version="3.14.0" />
+      <PackageReference Include="Radzen.Blazor" Version="6.2.7" />
     </ItemGroup>
 
     <ItemGroup>
diff --git a/Overflow/Overflow.csproj b/Overflow/Overflow.csproj
index 715848f..7d28d95 100644
--- a/Overflow/Overflow.csproj
+++ b/Overflow/Overflow.csproj
@@ -1,19 +1,19 @@
 <Project Sdk="Microsoft.NET.Sdk">
 
     <PropertyGroup>
-        <TargetFramework>net8.0</TargetFramework>
+        <TargetFramework>net9.0</TargetFramework>
         <ImplicitUsings>enable</ImplicitUsings>
         <Nullable>enable</Nullable>
     </PropertyGroup>
 
     <ItemGroup>
-      <PackageReference Include="Microsoft.Extensions.Configuration" Version="8.0.0" />
-      <PackageReference Include="Microsoft.Extensions.Configuration.FileExtensions" Version="8.0.1" />
-      <PackageReference Include="Microsoft.Extensions.Configuration.Json" Version="8.0.0" />
-      <PackageReference Include="Microsoft.Extensions.DependencyInjection.Abstractions" Version="8.0.1" />
-      <PackageReference Include="Microsoft.Extensions.Hosting.Abstractions" Version="8.0.0" />
-      <PackageReference Include="MongoDB.Driver" Version="2.29.0" />
-      <PackageReference Include="Quartz" Version="3.13.0" />
+      <PackageReference Include="Microsoft.Extensions.Configuration" Version="9.0.3" />
+      <PackageReference Include="Microsoft.Extensions.Configuration.FileExtensions" Version="9.0.3" />
+      <PackageReference Include="Microsoft.Extensions.Configuration.Json" Version="9.0.3" />
+      <PackageReference Include="Microsoft.Extensions.DependencyInjection.Abstractions" Version="9.0.3" />
+      <PackageReference Include="Microsoft.Extensions.Hosting.Abstractions" Version="9.0.3" />
+      <PackageReference Include="MongoDB.Driver" Version="3.2.1" />
+      <PackageReference Include="Quartz" Version="3.14.0" />
     </ItemGroup>
 
     <ItemGroup>
diff --git a/Overflow/SouthernWater/SouthernWaterApi.cs b/Overflow/SouthernWater/SouthernWaterApi.cs
index 8436bae..d8e6f29 100644
--- a/Overflow/SouthernWater/SouthernWaterApi.cs
+++ b/Overflow/SouthernWater/SouthernWaterApi.cs
@@ -13,7 +13,7 @@ public partial class SouthernWaterApi
 
     private static readonly string spillsEndpoint = "Spills/GetHistoricSpills";
 
-    private string baseUrl;
+    private string baseUrl = "https://dv.southernwater.co.uk/gateway/Beachbuoy/1.0/api/v1.0/";
     private string apiKey;
 
     public SouthernWaterApi(HttpClient client, ILogger<SouthernWaterApi> logger)
@@ -22,7 +22,7 @@ public partial class SouthernWaterApi
         _logger = logger;
     }
 
-    [GeneratedRegex(@".APIURL=""(?<APIURL>.*)"".*APIGWKEY=""(?<APIKEY>.*?)"".*", RegexOptions.IgnoreCase)]
+    [GeneratedRegex(@"const APIGWKEY = '(?<APIKEY>.*?)'.*", RegexOptions.IgnoreCase)]
     private static partial Regex ApiUrlAndKey();
 
     public async Task LoadApiUrl()
@@ -61,14 +61,14 @@ public partial class SouthernWaterApi
 
                 Match m = ApiUrlAndKey().Match(contentString);
 
-                var apiUrlFound = m.Groups.TryGetValue("APIURL", out var apiUrl);
+                // var apiUrlFound = m.Groups.TryGetValue("APIURL", out var apiUrl);
                 var apiKeyFound = m.Groups.TryGetValue("APIKEY", out var apiKey);
 
-                if (apiUrlFound)
-                {
-                    baseUrl = apiUrl.Value;
-                    _logger.LogInformation("API url found [{APIUrl}]", apiUrl);
-                }
+                // if (apiUrlFound)
+                // {
+                //     baseUrl = apiUrl.Value;
+                //     _logger.LogInformation("API url found [{APIUrl}]", apiUrl);
+                // }
 
                 if (apiKeyFound)
                 {