Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .config/dotnet-tools.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"isRoot": true,
"tools": {
"dotnet-ef": {
"version": "9.0.12",
"version": "10.0.8",
"commands": [
"dotnet-ef"
]
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/cd-localcluster.yml
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ jobs:
fi

- name: Checkout
uses: actions/checkout@v4
uses: actions/checkout@v6

- name: Load deployment settings
run: |
Expand Down Expand Up @@ -67,7 +67,7 @@ jobs:
echo "Using successful CI run: ${CI_RUN_ID}" >> "$GITHUB_STEP_SUMMARY"

- name: Login to GHCR
uses: docker/login-action@v3
uses: docker/login-action@v4
with:
registry: ghcr.io
username: ${{ github.actor }}
Expand Down
10 changes: 5 additions & 5 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ jobs:

steps:
- name: Checkout
uses: actions/checkout@v4
uses: actions/checkout@v6

- name: Deployment audit
run: bash Deployment/LocalCluster/Scripts/audit-deployment.sh
Expand All @@ -31,9 +31,9 @@ jobs:
yamllint .github Deployment/LocalCluster

- name: Setup .NET
uses: actions/setup-dotnet@v4
uses: actions/setup-dotnet@v5
with:
dotnet-version: 9.0.x
dotnet-version: 10.0.x

- name: Restore
run: dotnet restore
Expand Down Expand Up @@ -66,7 +66,7 @@ jobs:

- name: Upload migration bundle
if: github.event_name != 'pull_request' && github.ref == 'refs/heads/main'
uses: actions/upload-artifact@v4
uses: actions/upload-artifact@v7
with:
name: ${{ env.APP_NAME }}-migrate-linux-x64
path: artifacts/migrations/${{ env.MIGRATION_BUNDLE_NAME }}
Expand All @@ -80,7 +80,7 @@ jobs:

- name: Login to GHCR
if: github.event_name != 'pull_request' && github.ref == 'refs/heads/main'
uses: docker/login-action@v3
uses: docker/login-action@v4
with:
registry: ghcr.io
username: ${{ github.actor }}
Expand Down
4 changes: 2 additions & 2 deletions BlazorAutoApp.Client/BlazorAutoApp.Client.csproj
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
<Project Sdk="Microsoft.NET.Sdk.BlazorWebAssembly">

<PropertyGroup>
<TargetFramework>net9.0</TargetFramework>
<TargetFramework>net10.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
<NoDefaultLaunchSettingsFile>true</NoDefaultLaunchSettingsFile>
<StaticWebAssetProjectMode>Default</StaticWebAssetProjectMode>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Microsoft.AspNetCore.Components.WebAssembly" Version="9.0.8" />
<PackageReference Include="Microsoft.AspNetCore.Components.WebAssembly" Version="10.0.8" />
</ItemGroup>

<ItemGroup>
Expand Down
2 changes: 1 addition & 1 deletion BlazorAutoApp.Core/BlazorAutoApp.Core.csproj
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFramework>net9.0</TargetFramework>
<TargetFramework>net10.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
</PropertyGroup>
Expand Down
25 changes: 13 additions & 12 deletions BlazorAutoApp.Test/BlazorAutoApp.Test.csproj
Original file line number Diff line number Diff line change
@@ -1,26 +1,27 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFramework>net9.0</TargetFramework>
<TargetFramework>net10.0</TargetFramework>
<IsPackable>false</IsPackable>
<Nullable>enable</Nullable>
<NoWarn>$(NoWarn);xUnit1051</NoWarn>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Bogus" Version="35.6.3" />
<PackageReference Include="Microsoft.AspNetCore.Mvc.Testing" Version="9.0.12" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.11.1" />
<PackageReference Include="Respawn" Version="6.2.1" />
<PackageReference Include="Testcontainers" Version="4.7.0" />
<PackageReference Include="Testcontainers.PostgreSql" Version="4.7.0" />
<PackageReference Include="xunit" Version="2.9.2" />
<PackageReference Include="xunit.runner.visualstudio" Version="2.8.2">
<PackageReference Include="Bogus" Version="35.6.5" />
<PackageReference Include="Microsoft.AspNetCore.Mvc.Testing" Version="10.0.8" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="18.5.1" />
<PackageReference Include="Respawn" Version="7.0.0" />
<PackageReference Include="Testcontainers" Version="4.12.0" />
<PackageReference Include="Testcontainers.PostgreSql" Version="4.12.0" />
<PackageReference Include="xunit.v3" Version="3.2.2" />
<PackageReference Include="xunit.runner.visualstudio" Version="3.1.5">
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
<PrivateAssets>all</PrivateAssets>
</PackageReference>
<PackageReference Include="Microsoft.EntityFrameworkCore.Relational" Version="9.0.12" />
<PackageReference Include="Microsoft.Extensions.Caching.Hybrid" Version="9.3.0" />
<PackageReference Include="SixLabors.ImageSharp" Version="3.1.11" />
<PackageReference Include="Microsoft.EntityFrameworkCore.Relational" Version="10.0.8" />
<PackageReference Include="Microsoft.Extensions.Caching.Hybrid" Version="10.6.0" />
<PackageReference Include="SixLabors.ImageSharp" Version="3.1.12" />
</ItemGroup>

<ItemGroup>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
using Microsoft.EntityFrameworkCore;
using BlazorAutoApp.Test.TestingSetup;
using Microsoft.Extensions.DependencyInjection;
using SixLabors.ImageSharp;
using Xunit;

namespace BlazorAutoApp.Test.Features.Inspections.HullImages;
Expand Down Expand Up @@ -71,6 +72,19 @@ public async Task Tus_Upload_And_Download_Works()
var bytes = await _client.GetByteArrayAsync($"/api/hull-images/{created.Id}/original");
Assert.Equal(original, bytes);

// Generate and verify thumbnail
var thumbRes = await _client.GetAsync($"/api/hull-images/{created.Id}/thumbnail/64");
Assert.Equal(HttpStatusCode.OK, thumbRes.StatusCode);
Assert.Equal("image/jpeg", thumbRes.Content.Headers.ContentType?.MediaType);
var thumbBytes = await thumbRes.Content.ReadAsByteArrayAsync();
using (var thumbnail = Image.Load(thumbBytes))
{
Assert.True(thumbnail.Width > 0);
Assert.True(thumbnail.Height > 0);
Assert.True(thumbnail.Width <= 64);
Assert.True(thumbnail.Height <= 64);
}

// Range request
var rangeReq = new HttpRequestMessage(HttpMethod.Get, $"/api/hull-images/{created.Id}/original");
rangeReq.Headers.Range = new RangeHeaderValue(0, 9);
Expand All @@ -87,8 +101,8 @@ public async Task Tus_Upload_And_Download_Works()
Assert.Equal(HttpStatusCode.NotFound, gone.StatusCode);
}

public Task InitializeAsync() => Task.CompletedTask;
public Task DisposeAsync() => _resetDatabase();
public ValueTask InitializeAsync() => ValueTask.CompletedTask;
public async ValueTask DisposeAsync() => await _resetDatabase();
public void Dispose()
{
// factory is container-owned; no disposal required here
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ public async Task GetById_Returns_404_When_NotFound()
Assert.Equal(HttpStatusCode.NotFound, res.StatusCode);
}

public Task InitializeAsync() => Task.CompletedTask;
public Task DisposeAsync() => _reset();
public ValueTask InitializeAsync() => ValueTask.CompletedTask;
public async ValueTask DisposeAsync() => await _reset();
}

Original file line number Diff line number Diff line change
Expand Up @@ -64,8 +64,8 @@ public async Task List_Returns_Items_After_Tus_Upload()
Assert.Contains(list.Items, i => i.OriginalFileName == "test-image.PNG");
}

public Task InitializeAsync() => Task.CompletedTask;
public Task DisposeAsync() => _resetDatabase();
public ValueTask InitializeAsync() => ValueTask.CompletedTask;
public async ValueTask DisposeAsync() => await _resetDatabase();
public void Dispose() => GC.SuppressFinalize(this);
}

Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ public async Task Tus_Upload_And_Download_Matches()
Assert.Equal(all, bytes);
}

public Task InitializeAsync() => Task.CompletedTask;
public Task DisposeAsync() => _resetDatabase();
public ValueTask InitializeAsync() => ValueTask.CompletedTask;
public async ValueTask DisposeAsync() => await _resetDatabase();
}

4 changes: 2 additions & 2 deletions BlazorAutoApp.Test/Features/Movies/CreateMovieTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -73,9 +73,9 @@ public async Task Create_InvalidRating_ReturnsBadRequest()
Assert.Equal(HttpStatusCode.BadRequest, response.StatusCode);
}

public Task InitializeAsync() => Task.CompletedTask;
public ValueTask InitializeAsync() => ValueTask.CompletedTask;

public Task DisposeAsync() => _resetDatabase();
public async ValueTask DisposeAsync() => await _resetDatabase();

public void Dispose() => GC.SuppressFinalize(this);
}
4 changes: 2 additions & 2 deletions BlazorAutoApp.Test/Features/Movies/DeleteMovieTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -52,9 +52,9 @@ public async Task Delete_NotFound_Returns404()
Assert.Equal(HttpStatusCode.NotFound, response.StatusCode);
}

public Task InitializeAsync() => Task.CompletedTask;
public ValueTask InitializeAsync() => ValueTask.CompletedTask;

public Task DisposeAsync() => _resetDatabase();
public async ValueTask DisposeAsync() => await _resetDatabase();

public void Dispose() => GC.SuppressFinalize(this);
}
4 changes: 2 additions & 2 deletions BlazorAutoApp.Test/Features/Movies/GetMovieTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -53,9 +53,9 @@ public async Task GetById_NotFound_Returns404()
Assert.Equal(HttpStatusCode.NotFound, response.StatusCode);
}

public Task InitializeAsync() => Task.CompletedTask;
public ValueTask InitializeAsync() => ValueTask.CompletedTask;

public Task DisposeAsync() => _resetDatabase();
public async ValueTask DisposeAsync() => await _resetDatabase();

public void Dispose() => GC.SuppressFinalize(this);
}
4 changes: 2 additions & 2 deletions BlazorAutoApp.Test/Features/Movies/GetMoviesTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -54,9 +54,9 @@ public async Task GetAll_WithData_ReturnsOkWithAllItems()
Assert.Equal(10, payload!.Movies.Count);
}

public Task InitializeAsync() => Task.CompletedTask;
public ValueTask InitializeAsync() => ValueTask.CompletedTask;

public Task DisposeAsync() => _resetDatabase();
public async ValueTask DisposeAsync() => await _resetDatabase();

public void Dispose() => GC.SuppressFinalize(this);
}
4 changes: 2 additions & 2 deletions BlazorAutoApp.Test/Features/Movies/MoviesCachingTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -29,9 +29,9 @@ public MoviesCachingTests(WebAppFactory factory)
_dbFactory = scope.ServiceProvider.GetRequiredService<IDbContextFactory<AppDbContext>>();
}

public Task InitializeAsync() => Task.CompletedTask;
public ValueTask InitializeAsync() => ValueTask.CompletedTask;

public Task DisposeAsync() => _resetDatabase();
public async ValueTask DisposeAsync() => await _resetDatabase();

public void Dispose() => GC.SuppressFinalize(this);

Expand Down
4 changes: 2 additions & 2 deletions BlazorAutoApp.Test/Features/Movies/UpdateMovieTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -117,9 +117,9 @@ public async Task Update_InvalidBody_ReturnsBadRequest()
Assert.Equal(HttpStatusCode.BadRequest, response.StatusCode);
}

public Task InitializeAsync() => Task.CompletedTask;
public ValueTask InitializeAsync() => ValueTask.CompletedTask;

public Task DisposeAsync() => _resetDatabase();
public async ValueTask DisposeAsync() => await _resetDatabase();

public void Dispose() => GC.SuppressFinalize(this);
}
19 changes: 14 additions & 5 deletions BlazorAutoApp.Test/TestingSetup/WebAppFactory.cs
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,18 @@ namespace BlazorAutoApp.Test.TestingSetup;
public class WebAppFactory : WebApplicationFactory<Program>, IAsyncLifetime
{
private const int MaxWaitTimeMinutes = 5;
private const string RyukImageEnvironmentVariable = "TESTCONTAINERS_RYUK_CONTAINER_IMAGE";
private const string RyukImage = "testcontainers/ryuk:0.12.0";

private readonly PostgreSqlContainer _dbContainer = new PostgreSqlBuilder()
.WithImage("postgres:16-alpine")
static WebAppFactory()
{
if (string.IsNullOrWhiteSpace(Environment.GetEnvironmentVariable(RyukImageEnvironmentVariable)))
{
Environment.SetEnvironmentVariable(RyukImageEnvironmentVariable, RyukImage);
}
}

private readonly PostgreSqlContainer _dbContainer = new PostgreSqlBuilder("postgres:16-alpine")
.Build();

//Default! cause we are not initializing it here, but in the InitializeAsync method
Expand Down Expand Up @@ -92,7 +101,7 @@ public async Task ResetDatabaseAsync()
}
}

public async Task InitializeAsync()
public async ValueTask InitializeAsync()
{
await _dbContainer.StartAsync();

Expand Down Expand Up @@ -128,8 +137,8 @@ private async Task InitializeRespawner()
}

//"New": to tell compiler that this is a new DisposeAsync method
public new Task DisposeAsync()
public new async ValueTask DisposeAsync()
{
return _dbContainer.StopAsync();
await _dbContainer.StopAsync();
}
}
55 changes: 31 additions & 24 deletions BlazorAutoApp/BlazorAutoApp.csproj
Original file line number Diff line number Diff line change
@@ -1,48 +1,55 @@
<Project Sdk="Microsoft.NET.Sdk.Web">
<PropertyGroup>
<TargetFramework>net9.0</TargetFramework>
<TargetFramework>net10.0</TargetFramework>
<RuntimeIdentifiers>linux-x64</RuntimeIdentifiers>
<Nullable>enable</Nullable>
<ImplicitUsings>enable</ImplicitUsings>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Microsoft.AspNetCore.Identity.EntityFrameworkCore" Version="9.0.12" />
<PackageReference Include="Microsoft.AspNetCore.Identity.UI" Version="9.0.12" />
<PackageReference Include="Microsoft.AspNetCore.Authentication.Google" Version="9.0.12" />
<PackageReference Include="Microsoft.EntityFrameworkCore.Sqlite" Version="9.0.12" />
<PackageReference Include="Microsoft.EntityFrameworkCore.SqlServer" Version="9.0.12" />
<PackageReference Include="Microsoft.VisualStudio.Web.CodeGeneration.Design" Version="9.0.12" />
<PackageReference Include="SixLabors.ImageSharp" Version="3.1.11" />
<ProjectReference Include="..\BlazorAutoApp.Client\BlazorAutoApp.Client.csproj" />
<PackageReference Include="Microsoft.AspNetCore.Components.WebAssembly.Server" Version="9.0.8" />
<PackageReference Include="Microsoft.AspNetCore.Identity.EntityFrameworkCore" Version="10.0.8" />
<PackageReference Include="Microsoft.AspNetCore.Identity.UI" Version="10.0.8" />
<PackageReference Include="Microsoft.AspNetCore.Authentication.Google" Version="10.0.8" />
<PackageReference Include="Microsoft.VisualStudio.Web.CodeGeneration.Design" Version="10.0.2">
<PrivateAssets>all</PrivateAssets>
</PackageReference>
<PackageReference Include="NuGet.Packaging" Version="7.6.0">
<PrivateAssets>all</PrivateAssets>
</PackageReference>
<PackageReference Include="NuGet.Protocol" Version="7.6.0">
<PrivateAssets>all</PrivateAssets>
</PackageReference>
<PackageReference Include="SixLabors.ImageSharp" Version="3.1.12" />
<ProjectReference Include="..\BlazorAutoApp.Client\BlazorAutoApp.Client.csproj" GlobalPropertiesToRemove="RuntimeIdentifier;SelfContained" />
<PackageReference Include="Microsoft.AspNetCore.Components.WebAssembly.Server" Version="10.0.8" />
<ProjectReference Include="..\BlazorAutoApp.Core\BlazorAutoApp.Core.csproj" />
<PackageReference Include="Microsoft.EntityFrameworkCore" Version="9.0.12" />
<PackageReference Include="Microsoft.EntityFrameworkCore.Design" Version="9.0.12">
<PackageReference Include="Microsoft.EntityFrameworkCore" Version="10.0.8" />
<PackageReference Include="Microsoft.EntityFrameworkCore.Design" Version="10.0.8">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
<PackageReference Include="Npgsql.EntityFrameworkCore.PostgreSQL" Version="9.0.4" />
<PackageReference Include="Microsoft.EntityFrameworkCore.Tools" Version="9.0.12">
<PackageReference Include="Npgsql.EntityFrameworkCore.PostgreSQL" Version="10.0.1" />
<PackageReference Include="Microsoft.EntityFrameworkCore.Tools" Version="10.0.8">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
<PackageReference Include="Microsoft.Extensions.Caching.Hybrid" Version="9.3.0" />
<PackageReference Include="Microsoft.Extensions.Caching.StackExchangeRedis" Version="9.0.8" />
<PackageReference Include="Microsoft.AspNetCore.DataProtection.StackExchangeRedis" Version="9.0.12" />
<PackageReference Include="tusdotnet" Version="2.10.0" />
<PackageReference Include="Microsoft.Extensions.Caching.Hybrid" Version="10.6.0" />
<PackageReference Include="Microsoft.Extensions.Caching.StackExchangeRedis" Version="10.0.8" />
<PackageReference Include="Microsoft.AspNetCore.DataProtection.StackExchangeRedis" Version="10.0.8" />
<PackageReference Include="tusdotnet" Version="2.11.1" />
<Content Update="settings.defaults.json">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
<CopyToPublishDirectory>PreserveNewest</CopyToPublishDirectory>
</Content>
</ItemGroup>
<ItemGroup>
<PackageReference Include="Serilog.AspNetCore" Version="9.0.0" />
<PackageReference Include="Serilog.Settings.Configuration" Version="9.0.0" />
<PackageReference Include="Serilog.AspNetCore" Version="10.0.0" />
<PackageReference Include="Serilog.Settings.Configuration" Version="10.0.0" />
<PackageReference Include="Serilog.Enrichers.Environment" Version="3.0.1" />
<PackageReference Include="Serilog.Sinks.Console" Version="6.0.0" />
<PackageReference Include="Serilog.Sinks.Seq" Version="9.0.0" />
<PackageReference Include="Serilog.Sinks.Console" Version="6.1.1" />
<PackageReference Include="Serilog.Sinks.Seq" Version="9.1.0" />
</ItemGroup>
<ItemGroup>
<!-- Pin EFCore.Relational to 9.0.8 for dependency unification -->
<PackageReference Include="Microsoft.EntityFrameworkCore.Relational" Version="9.0.12" />
<!-- Pin EFCore.Relational for dependency unification -->
<PackageReference Include="Microsoft.EntityFrameworkCore.Relational" Version="10.0.8" />
</ItemGroup>
</Project>
Loading