diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 00fd38644..8ef40aada 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -105,7 +105,7 @@ jobs: if: runner.os == 'Windows' && success() with: name: webapp - path: ./artifacts/publish + path: ./artifacts/publish/LondonTravel.Site/release_${{ env.PUBLISH_RUNTIME }} if-no-files-found: error - name: Publish screenshots diff --git a/.github/workflows/lighthouse.yml b/.github/workflows/lighthouse.yml index 291f11019..e906e5a48 100644 --- a/.github/workflows/lighthouse.yml +++ b/.github/workflows/lighthouse.yml @@ -62,7 +62,7 @@ jobs: If ($StatusCode -ne 200) { throw "Failed to successfully connect to website after $Attempts attempts." } - New-Item -Path "${env:GITHUB_WORKSPACE}/artifacts" -ItemType Directory | Out-Null + New-Item -Path "${env:GITHUB_WORKSPACE}/artifacts/lighthouse" -ItemType Directory | Out-Null - name: Lighthouse uses: foo-software/lighthouse-check-action@f78f162ef0ecd48a18244c427959f0b79ef4d553 # v10.0.0 @@ -70,7 +70,7 @@ jobs: with: device: 'all' gitHubAccessToken: ${{ secrets.LIGHTHOUSE_ACCESS_TOKEN }} - outputDirectory: ${{ github.workspace }}/artifacts + outputDirectory: ${{ github.workspace }}/artifacts/lighthouse prCommentEnabled: true urls: 'https://localhost:5001' wait: true @@ -90,5 +90,5 @@ jobs: if: ${{ always() }} with: name: lighthouse - path: ${{ github.workspace }}/artifacts + path: ${{ github.workspace }}/artifacts/lighthouse if-no-files-found: ignore diff --git a/.vscode/launch.json b/.vscode/launch.json index 861149af1..4723ce951 100644 --- a/.vscode/launch.json +++ b/.vscode/launch.json @@ -6,7 +6,7 @@ "type": "coreclr", "request": "launch", "preLaunchTask": "build", - "program": "${workspaceFolder}/src/LondonTravel.Site/bin/Debug/net7.0/LondonTravel.Site.dll", + "program": "${workspaceFolder}/src/LondonTravel.Site/bin/Debug/net8.0/LondonTravel.Site.dll", "args": [], "cwd": "${workspaceFolder}/src/LondonTravel.Site", "stopAtEntry": false, diff --git a/.vsconfig b/.vsconfig index 8e4ff0d81..f09db9040 100644 --- a/.vsconfig +++ b/.vsconfig @@ -3,7 +3,7 @@ "components": [ "Microsoft.VisualStudio.Component.CoreEditor", "Microsoft.VisualStudio.Workload.CoreEditor", - "Microsoft.NetCore.Component.Runtime.7.0", + "Microsoft.NetCore.Component.Runtime.8.0", "Microsoft.NetCore.Component.SDK", "Microsoft.VisualStudio.Component.Roslyn.Compiler", "Microsoft.VisualStudio.Component.Roslyn.LanguageServices", diff --git a/Directory.Build.props b/Directory.Build.props index 9335a8b10..6c6521776 100644 --- a/Directory.Build.props +++ b/Directory.Build.props @@ -34,8 +34,9 @@ git $(PackageProjectUrl).git true - 7.0.0 + 8.0.0 + true true diff --git a/Directory.Build.targets b/Directory.Build.targets index 55b086efc..0603f5e1e 100644 --- a/Directory.Build.targets +++ b/Directory.Build.targets @@ -33,11 +33,11 @@ - $([System.IO.Path]::Combine($(OutputPath), 'coverage', 'coverage')) + $([System.IO.Path]::Combine($(ArtifactsPath), 'coverage', 'coverage')) true HTML $(ReportGeneratorReportTypes);MarkdownSummaryGitHub - $([System.IO.Path]::Combine($(OutputPath), 'coverage')) + $([System.IO.Path]::Combine($(ArtifactsPath), 'coverage')) <_MarkdownSummaryPrefix><details><summary>:chart_with_upwards_trend: <b>$(AssemblyName) Code Coverage report</b></summary> <_MarkdownSummarySuffix></details> diff --git a/Directory.Packages.props b/Directory.Packages.props index de9711ee9..8c2222261 100644 --- a/Directory.Packages.props +++ b/Directory.Packages.props @@ -1,7 +1,6 @@ 7.0.4 - 3.1.9 6.5.0 @@ -17,22 +16,19 @@ - - - - - - + + + + + + - + - - - @@ -50,7 +46,6 @@ - diff --git a/build.ps1 b/build.ps1 index b798d8d32..56c956463 100755 --- a/build.ps1 +++ b/build.ps1 @@ -1,7 +1,5 @@ #! /usr/bin/env pwsh param( - [Parameter(Mandatory = $false)][string] $Configuration = "Release", - [Parameter(Mandatory = $false)][string] $OutputPath = "", [Parameter(Mandatory = $false)][switch] $SkipTests, [Parameter(Mandatory = $false)][string] $Runtime = "" ) @@ -14,10 +12,6 @@ $sdkFile = Join-Path $solutionPath "global.json" $dotnetVersion = (Get-Content $sdkFile | Out-String | ConvertFrom-Json).sdk.version -if ($OutputPath -eq "") { - $OutputPath = Join-Path $PSScriptRoot "artifacts" -} - $installDotNetSdk = $false; if (($null -eq (Get-Command "dotnet" -ErrorAction SilentlyContinue)) -and ($null -eq (Get-Command "dotnet.exe" -ErrorAction SilentlyContinue))) { @@ -82,7 +76,7 @@ function DotNetTest { $additionalArgs += "GitHubActions;report-warnings=false" } - & $dotnet test $Project --output $OutputPath --configuration $Configuration $additionalArgs + & $dotnet test $Project --configuration "Release" $additionalArgs if ($LASTEXITCODE -ne 0) { throw "dotnet test failed with exit code $LASTEXITCODE" @@ -92,8 +86,6 @@ function DotNetTest { function DotNetPublish { param([string]$Project) - $publishPath = (Join-Path $OutputPath "publish") - $additionalArgs = @() if (![string]::IsNullOrEmpty($Runtime)) { @@ -102,7 +94,7 @@ function DotNetPublish { $additionalArgs += $Runtime } - & $dotnet publish $Project --output $publishPath --configuration $Configuration $additionalArgs + & $dotnet publish $Project $additionalArgs if ($LASTEXITCODE -ne 0) { throw "dotnet publish failed with exit code $LASTEXITCODE" @@ -128,4 +120,3 @@ if ($SkipTests -eq $false) { DotNetTest $project } } - diff --git a/global.json b/global.json index 01254ddc7..442b2e334 100644 --- a/global.json +++ b/global.json @@ -1,6 +1,6 @@ { "sdk": { - "version": "7.0.401", + "version": "8.0.100-preview.7.23376.3", "allowPrerelease": false, "rollForward": "latestMajor" } diff --git a/src/LondonTravel.Site/Controllers/AccountController.cs b/src/LondonTravel.Site/Controllers/AccountController.cs index 647689020..6de924716 100644 --- a/src/LondonTravel.Site/Controllers/AccountController.cs +++ b/src/LondonTravel.Site/Controllers/AccountController.cs @@ -9,7 +9,6 @@ using Microsoft.AspNetCore.Authorization; using Microsoft.AspNetCore.Identity; using Microsoft.AspNetCore.Mvc; -using NodaTime; namespace MartinCostello.LondonTravel.Site.Controllers; @@ -26,7 +25,7 @@ public partial class AccountController : Controller private readonly UserManager _userManager; private readonly SignInManager _signInManager; private readonly ISiteTelemetry _telemetry; - private readonly IClock _clock; + private readonly TimeProvider _timeProvider; private readonly bool _isEnabled; private readonly ILogger _logger; @@ -34,14 +33,14 @@ public AccountController( UserManager userManager, SignInManager signInManager, ISiteTelemetry telemetry, - IClock clock, + TimeProvider timeProvider, SiteOptions siteOptions, ILogger logger) { _userManager = userManager; _signInManager = signInManager; _telemetry = telemetry; - _clock = clock; + _timeProvider = timeProvider; _logger = logger; _isEnabled = @@ -289,7 +288,7 @@ private IActionResult RedirectToLocal(string? returnUrl) var user = new LondonTravelUser() { - CreatedAt = _clock.GetCurrentInstant().ToDateTimeUtc(), + CreatedAt = _timeProvider.GetUtcNow().UtcDateTime, Email = email, GivenName = givenName, Surname = surname, diff --git a/src/LondonTravel.Site/Identity/AuthenticationBuilderExtensions.cs b/src/LondonTravel.Site/Identity/AuthenticationBuilderExtensions.cs index a66ba970d..d6d954b8b 100644 --- a/src/LondonTravel.Site/Identity/AuthenticationBuilderExtensions.cs +++ b/src/LondonTravel.Site/Identity/AuthenticationBuilderExtensions.cs @@ -75,12 +75,7 @@ public static AuthenticationBuilder TryAddFacebook( if (IsProviderEnabled(name, options)) { - builder.AddFacebook((p) => - { - p.AuthorizationEndpoint = "https://www.facebook.com/v14.0/dialog/oauth"; - p.TokenEndpoint = "https://graph.facebook.com/v14.0/oauth/access_token"; - p.UserInformationEndpoint = "https://graph.facebook.com/v14.0/me"; - }) + builder.AddFacebook() .Configure(name); } @@ -261,9 +256,9 @@ private static void Configure( options.Events.OnTicketReceived = (context) => { - var clock = context.HttpContext.RequestServices.GetRequiredService(); + var provider = context.HttpContext.RequestServices.GetRequiredService(); - context.Properties!.ExpiresUtc = clock.UtcNow.AddDays(150); + context.Properties!.ExpiresUtc = provider.GetUtcNow().AddDays(150); context.Properties.IsPersistent = true; return Task.CompletedTask; diff --git a/src/LondonTravel.Site/LondonTravel.Site.csproj b/src/LondonTravel.Site/LondonTravel.Site.csproj index 1af50673f..12b6a97c1 100644 --- a/src/LondonTravel.Site/LondonTravel.Site.csproj +++ b/src/LondonTravel.Site/LondonTravel.Site.csproj @@ -2,6 +2,16 @@ InProcess https://londontravel.martincostello.com/ + + + true true $(NoWarn);CA1716 Exe @@ -9,7 +19,7 @@ MartinCostello.LondonTravel.Site en,en-GB,en-US,qps-Ploc Website for the London Travel Amazon Alexa skill. - net7.0 + net8.0 true latest londontravel.martincostello.com @@ -39,7 +49,6 @@ - diff --git a/src/LondonTravel.Site/Pages/Technology/Index.cshtml b/src/LondonTravel.Site/Pages/Technology/Index.cshtml index e092b3750..150995235 100644 --- a/src/LondonTravel.Site/Pages/Technology/Index.cshtml +++ b/src/LondonTravel.Site/Pages/Technology/Index.cshtml @@ -106,7 +106,6 @@
  • jquery.lazyload
  • Microsoft Accounts
  • Moment.js
  • -
  • NodaTime
  • npm
  • NSubstitute
  • NuGet
  • diff --git a/src/LondonTravel.Site/Program.cs b/src/LondonTravel.Site/Program.cs index 1def4371e..7ab6387a2 100644 --- a/src/LondonTravel.Site/Program.cs +++ b/src/LondonTravel.Site/Program.cs @@ -2,7 +2,6 @@ // Licensed under the Apache 2.0 license. See the LICENSE file in the project root for full license information. using System.IO.Compression; -using System.Text.Json.Serialization.Metadata; using MartinCostello.LondonTravel.Site; using MartinCostello.LondonTravel.Site.Extensions; using MartinCostello.LondonTravel.Site.Options; @@ -20,7 +19,6 @@ using Microsoft.AspNetCore.StaticFiles; using Microsoft.Extensions.DependencyInjection.Extensions; using Microsoft.Extensions.Options; -using NodaTime; var builder = WebApplication.CreateBuilder(args); @@ -134,9 +132,7 @@ options.SerializerOptions.DefaultIgnoreCondition = System.Text.Json.Serialization.JsonIgnoreCondition.WhenWritingNull; options.SerializerOptions.PropertyNameCaseInsensitive = false; options.SerializerOptions.WriteIndented = true; - options.SerializerOptions.TypeInfoResolver = JsonTypeInfoResolver.Combine( - ApplicationJsonSerializerContext.Default, - new DefaultJsonTypeInfoResolver()); + options.SerializerOptions.TypeInfoResolverChain.Add(ApplicationJsonSerializerContext.Default); }); builder.Services.Configure((options) => @@ -172,7 +168,7 @@ }; }); -builder.Services.AddSingleton((_) => SystemClock.Instance); +builder.Services.AddSingleton(TimeProvider.System); builder.Services.AddSingleton(); builder.Services.AddSingleton(); builder.Services.AddSingleton(); diff --git a/src/LondonTravel.Site/package-lock.json b/src/LondonTravel.Site/package-lock.json index 4b339f346..75d9c1429 100644 --- a/src/LondonTravel.Site/package-lock.json +++ b/src/LondonTravel.Site/package-lock.json @@ -1,6 +1,6 @@ { "name": "london-travel-site", - "version": "7.0.0", + "version": "8.0.0", "lockfileVersion": 3, "requires": true, "packages": { diff --git a/src/LondonTravel.Site/package.json b/src/LondonTravel.Site/package.json index 63363393f..4969cb9e3 100644 --- a/src/LondonTravel.Site/package.json +++ b/src/LondonTravel.Site/package.json @@ -1,7 +1,7 @@ { "name": "london-travel-site", "private": true, - "version": "7.0.0", + "version": "8.0.0", "description": "The companion site for the London Travel Amazon Alexa skill", "scripts": { "build": "npm run compile && npm run format && npm run lint", diff --git a/tests/LondonTravel.Site.Tests/BrowserFixture.cs b/tests/LondonTravel.Site.Tests/BrowserFixture.cs index 9b3c77c27..d59d6d2bf 100644 --- a/tests/LondonTravel.Site.Tests/BrowserFixture.cs +++ b/tests/LondonTravel.Site.Tests/BrowserFixture.cs @@ -9,7 +9,7 @@ namespace MartinCostello.LondonTravel.Site; public class BrowserFixture { private const string VideosDirectory = "videos"; - private const string AssetsDirectory = "."; + private static readonly string AssetsDirectory = Path.Combine("..", "..", ".."); public BrowserFixture( BrowserFixtureOptions options, diff --git a/tests/LondonTravel.Site.Tests/Integration/oauth-http-bundle.json b/tests/LondonTravel.Site.Tests/Integration/oauth-http-bundle.json index 3cad381c0..637320b4d 100644 --- a/tests/LondonTravel.Site.Tests/Integration/oauth-http-bundle.json +++ b/tests/LondonTravel.Site.Tests/Integration/oauth-http-bundle.json @@ -178,7 +178,7 @@ }, { "comment": "User information resource for Google login", - "uri": "https://www.googleapis.com/oauth2/v2/userinfo", + "uri": "https://www.googleapis.com/oauth2/v3/userinfo", "contentFormat": "json", "contentJson": { "id": "c91599d6-ab86-452c-96d3-6e8eb45585f2", diff --git a/tests/LondonTravel.Site.Tests/LondonTravel.Site.Tests.csproj b/tests/LondonTravel.Site.Tests/LondonTravel.Site.Tests.csproj index 7d81c1387..83f753c42 100644 --- a/tests/LondonTravel.Site.Tests/LondonTravel.Site.Tests.csproj +++ b/tests/LondonTravel.Site.Tests/LondonTravel.Site.Tests.csproj @@ -6,7 +6,7 @@ true MartinCostello.LondonTravel.Site Tests for the London Travel website - net7.0 + net8.0