diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml
index 841fb88..b982c13 100644
--- a/.github/workflows/ci.yml
+++ b/.github/workflows/ci.yml
@@ -10,6 +10,11 @@ jobs:
build-and-test:
runs-on: ubuntu-latest
+ env:
+ # Program.cs throws without a connection string. EF tools build the host
+ # to read the model; this value is never used to connect.
+ ConnectionStrings__Default: "Host=localhost;Database=ci;Username=ci;Password=ci"
+
steps:
- name: Checkout
uses: actions/checkout@v7
@@ -22,8 +27,23 @@ jobs:
- name: Restore
run: dotnet restore
+ - name: Check formatting
+ run: dotnet format --verify-no-changes --no-restore
+
- name: Build
run: dotnet build --no-restore --configuration Release
- name: Test
- run: dotnet test --no-build --configuration Release --verbosity normal
\ No newline at end of file
+ run: dotnet test --no-build --configuration Release --verbosity normal
+
+ - name: Install EF Core tools
+ run: dotnet tool install --global dotnet-ef
+
+ - name: Check migrations are up to date
+ run: >
+ dotnet ef migrations has-pending-model-changes
+ --project src/Modules/Identity/Infrastructure
+ --startup-project src/Host
+ --context IdentityDbContext
+ --configuration Release
+ --no-build
\ No newline at end of file
diff --git a/src/Host/Program.cs b/src/Host/Program.cs
index 8310654..fde736d 100644
--- a/src/Host/Program.cs
+++ b/src/Host/Program.cs
@@ -24,5 +24,4 @@
app.UseHttpsRedirection();
-app.Run();
-
+app.Run();
\ No newline at end of file
diff --git a/src/Modules/Identity/Api/AssemblyReference.cs b/src/Modules/Identity/Api/AssemblyReference.cs
index 783a322..84c114a 100644
--- a/src/Modules/Identity/Api/AssemblyReference.cs
+++ b/src/Modules/Identity/Api/AssemblyReference.cs
@@ -3,4 +3,4 @@ namespace Basira.Modules.Identity.Api;
/// Marker used by architecture tests to locate this assembly.
public static class AssemblyReference
{
-}
+}
\ No newline at end of file
diff --git a/src/Modules/Identity/Application/AssemblyReference.cs b/src/Modules/Identity/Application/AssemblyReference.cs
index b9f0012..5f04904 100644
--- a/src/Modules/Identity/Application/AssemblyReference.cs
+++ b/src/Modules/Identity/Application/AssemblyReference.cs
@@ -3,4 +3,4 @@ namespace Basira.Modules.Identity.Application;
/// Marker used by architecture tests to locate this assembly.
public static class AssemblyReference
{
-}
+}
\ No newline at end of file
diff --git a/src/Modules/Identity/Contracts/AssemblyReference.cs b/src/Modules/Identity/Contracts/AssemblyReference.cs
index 6c90e84..22b32c6 100644
--- a/src/Modules/Identity/Contracts/AssemblyReference.cs
+++ b/src/Modules/Identity/Contracts/AssemblyReference.cs
@@ -3,4 +3,4 @@ namespace Basira.Modules.Identity.Contracts;
/// Marker used by architecture tests to locate this assembly.
public static class AssemblyReference
{
-}
+}
\ No newline at end of file
diff --git a/src/Modules/Identity/Domain/AssemblyReference.cs b/src/Modules/Identity/Domain/AssemblyReference.cs
index 644b768..2935df9 100644
--- a/src/Modules/Identity/Domain/AssemblyReference.cs
+++ b/src/Modules/Identity/Domain/AssemblyReference.cs
@@ -3,4 +3,4 @@ namespace Basira.Modules.Identity.Domain;
/// Marker used by architecture tests to locate this assembly.
public static class AssemblyReference
{
-}
+}
\ No newline at end of file
diff --git a/src/Modules/Identity/Infrastructure/AssemblyReference.cs b/src/Modules/Identity/Infrastructure/AssemblyReference.cs
index 73650c4..6ac19e9 100644
--- a/src/Modules/Identity/Infrastructure/AssemblyReference.cs
+++ b/src/Modules/Identity/Infrastructure/AssemblyReference.cs
@@ -3,4 +3,4 @@ namespace Basira.Modules.Identity.Infrastructure;
/// Marker used by architecture tests to locate this assembly.
public static class AssemblyReference
{
-}
+}
\ No newline at end of file
diff --git a/src/Modules/Identity/Infrastructure/Persistence/Configurations/OrganizationConfiguration.cs b/src/Modules/Identity/Infrastructure/Persistence/Configurations/OrganizationConfiguration.cs
index 71a2c4b..9376bc8 100644
--- a/src/Modules/Identity/Infrastructure/Persistence/Configurations/OrganizationConfiguration.cs
+++ b/src/Modules/Identity/Infrastructure/Persistence/Configurations/OrganizationConfiguration.cs
@@ -3,6 +3,7 @@
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Metadata.Builders;
namespace Basira.Modules.Identity.Infrastructure.Persistence.Configurations;
+
internal sealed class OrganizationConfiguration : IEntityTypeConfiguration
{
public void Configure(EntityTypeBuilder builder)
diff --git a/src/Modules/Identity/Infrastructure/Persistence/Configurations/UserConfiguration.cs b/src/Modules/Identity/Infrastructure/Persistence/Configurations/UserConfiguration.cs
index 4beef9a..a131a5c 100644
--- a/src/Modules/Identity/Infrastructure/Persistence/Configurations/UserConfiguration.cs
+++ b/src/Modules/Identity/Infrastructure/Persistence/Configurations/UserConfiguration.cs
@@ -33,4 +33,4 @@ public void Configure(EntityTypeBuilder builder)
.HasForeignKey(u => u.OrganizationId).OnDelete(DeleteBehavior.Restrict);
builder.HasIndex(u => u.Email).IsUnique();
}
-}
+}
\ No newline at end of file
diff --git a/src/Modules/Identity/Infrastructure/Persistence/Migrations/20261203155554_InitialIdentity.cs b/src/Modules/Identity/Infrastructure/Persistence/Migrations/20261203155554_InitialIdentity.cs
index d00293e..8d78f8d 100644
--- a/src/Modules/Identity/Infrastructure/Persistence/Migrations/20261203155554_InitialIdentity.cs
+++ b/src/Modules/Identity/Infrastructure/Persistence/Migrations/20261203155554_InitialIdentity.cs
@@ -1,4 +1,5 @@
using System;
+
using Microsoft.EntityFrameworkCore.Migrations;
#nullable disable
@@ -74,4 +75,4 @@ protected override void Down(MigrationBuilder migrationBuilder)
schema: "identity");
}
}
-}
+}
\ No newline at end of file
diff --git a/src/Modules/Identity/Infrastructure/Persistence/Migrations/20261203205137_MakeEmailGloballyUnique.cs b/src/Modules/Identity/Infrastructure/Persistence/Migrations/20261203205137_MakeEmailGloballyUnique.cs
index 29adb08..6b1eaad 100644
--- a/src/Modules/Identity/Infrastructure/Persistence/Migrations/20261203205137_MakeEmailGloballyUnique.cs
+++ b/src/Modules/Identity/Infrastructure/Persistence/Migrations/20261203205137_MakeEmailGloballyUnique.cs
@@ -50,4 +50,4 @@ protected override void Down(MigrationBuilder migrationBuilder)
unique: true);
}
}
-}
+}
\ No newline at end of file
diff --git a/tests/Architecture.Tests/IdentityModuleTests.cs b/tests/Architecture.Tests/IdentityModuleTests.cs
index 042246a..dbd5d9d 100644
--- a/tests/Architecture.Tests/IdentityModuleTests.cs
+++ b/tests/Architecture.Tests/IdentityModuleTests.cs
@@ -1,5 +1,7 @@
using System.Reflection;
+
using NetArchTest.Rules;
+
using Xunit;
namespace Basira.Architecture.Tests;
diff --git a/tests/Identity.UnitTests/OrganizationTests.cs b/tests/Identity.UnitTests/OrganizationTests.cs
index 1dad46c..36c9179 100644
--- a/tests/Identity.UnitTests/OrganizationTests.cs
+++ b/tests/Identity.UnitTests/OrganizationTests.cs
@@ -42,7 +42,7 @@ public void Rename_with_valid_name_trims_and_updates_name()
org.Rename(" Acme2 ");
Assert.Equal("Acme2", org.Name);
-
+
}
[Theory]
[InlineData("")]
@@ -60,7 +60,7 @@ public void Rename_with_too_long_name_throws()
var org = Organization.Create(" Acme ", Now);
var name = new string('a', Organization.NameMaxLength + 1);
-
+
Assert.Throws(() => org.Rename(name));
}