Skip to content
Closed
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
51 changes: 51 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
name: CI

on:
push:
branches: ["main"]
tags: ["v*"]
pull_request:
branches: ["main"]

jobs:
build-and-test:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v4

- uses: actions/setup-dotnet@v4
with:
dotnet-version: "10.0.x"

- name: Restore
run: dotnet restore AndreGoepel.AppFoundation/AndreGoepel.AppFoundation.slnx

- name: Build
run: dotnet build AndreGoepel.AppFoundation/AndreGoepel.AppFoundation.slnx --no-restore -c Release

- name: Test
run: dotnet test AndreGoepel.AppFoundation/AndreGoepel.AppFoundation.slnx --no-build -c Release

pack-and-push:
needs: build-and-test
runs-on: ubuntu-latest
if: startsWith(github.ref, 'refs/tags/v')

steps:
- uses: actions/checkout@v4

- uses: actions/setup-dotnet@v4
with:
dotnet-version: "10.0.x"

- name: Pack
run: |
VERSION="${GITHUB_REF_NAME#v}"
dotnet pack AndreGoepel.AppFoundation/AndreGoepel.Marten.Identity/AndreGoepel.Marten.Identity.csproj \
-c Release -p:Version=$VERSION -o nupkgs
dotnet pack AndreGoepel.AppFoundation/AndreGoepel.Marten.Identity.Blazor/AndreGoepel.Marten.Identity.Blazor.csproj \
-c Release -p:Version=$VERSION -o nupkgs

- name: Push to NuGet
run: dotnet nuget push "nupkgs/*.nupkg" --api-key ${{ secrets.NUGET_API_KEY }} --source https://api.nuget.org/v3/index.json
2 changes: 1 addition & 1 deletion .github/workflows/docker-image.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,4 +15,4 @@ jobs:
steps:
- uses: actions/checkout@v4
- name: Build the Docker image
run: docker build ./AndreGoepel.MembersArea --file ./AndreGoepel.MembersArea/AndreGoepel.MembersArea/Dockerfile --tag membersarea:$(date +%s)
run: docker build ./AndreGoepel.AppFoundation --file ./AndreGoepel.AppFoundation/AndreGoepel.AppFoundation/Dockerfile --tag appfoundation:$(date +%s)
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"appHostPath": "../AndreGoepel.AppFoundation.AppHost.csproj"
}
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,6 @@
</ItemGroup>

<ItemGroup>
<ProjectReference Include="..\AndreGoepel.MembersArea\AndreGoepel.MembersArea.csproj" />
<ProjectReference Include="..\AndreGoepel.AppFoundation\AndreGoepel.AppFoundation.csproj" />
</ItemGroup>
</Project>
Original file line number Diff line number Diff line change
Expand Up @@ -13,18 +13,18 @@
.WithLifetime(ContainerLifetime.Persistent)
.WithHostPort(5432)
.WithDataVolume();
var membersAreaDb = postgresServer.AddDatabase("members-area-database");
var appFoundationDb = postgresServer.AddDatabase("appfoundation-database");

builder
.AddProject<Projects.AndreGoepel_MembersArea>("andregoepel-membersarea")
.WithReference(membersAreaDb)
.WithEnvironment("EmailSender__SenderName", "André Göpel - Member Area")
.AddProject<Projects.AndreGoepel_AppFoundation>("andregoepel-appfoundation")
.WithReference(appFoundationDb)
.WithEnvironment("EmailSender__SenderName", "André Göpel - App Foundation")
.WithEnvironment("EmailSender__SenderEmail", "no-reply@localhost.dev")
.WithEnvironment("EmailSender__Username", "test-mail")
.WithEnvironment("EmailSender__Password", "12345678")
.WithEnvironment("EmailSender__Port", () => mailhog.GetEndpoint("smtp").Port.ToString())
.WithEnvironment("EmailSender__Server", () => mailhog.GetEndpoint("smtp").Host)
.WaitFor(membersAreaDb) // TODO: remove if startup don't need db
.WaitFor(appFoundationDb) // TODO: remove if startup don't need db
.PublishAsDockerFile();

builder.Build().Run();
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,6 @@
</ItemGroup>

<ItemGroup>
<ProjectReference Include="..\AndreGoepel.MembersArea.MailService\AndreGoepel.MembersArea.MailService.csproj" />
<ProjectReference Include="..\AndreGoepel.AppFoundation.MailService\AndreGoepel.AppFoundation.MailService.csproj" />
</ItemGroup>
</Project>
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
using AndreGoepel.MembersArea.MailService;
using AndreGoepel.AppFoundation.MailService;
using NSubstitute;

namespace AndreGoepel.MembersArea.MailService.Tests;
namespace AndreGoepel.AppFoundation.MailService.Tests;

public class SendEmailMessageHandlerTests
{
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
using Microsoft.Extensions.Options;
using MimeKit;

namespace AndreGoepel.MembersArea.MailService.Tests;
namespace AndreGoepel.AppFoundation.MailService.Tests;

public class SmtpEmailSenderTests
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
</ItemGroup>

<ItemGroup>
<InternalsVisibleTo Include="AndreGoepel.MembersArea.MailService.Tests" />
<InternalsVisibleTo Include="AndreGoepel.AppFoundation.MailService.Tests" />
</ItemGroup>

<ItemGroup>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
namespace AndreGoepel.MembersArea.MailService;
namespace AndreGoepel.AppFoundation.MailService;

public interface IEmailSender
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.DependencyInjection;

namespace AndreGoepel.MembersArea.MailService;
namespace AndreGoepel.AppFoundation.MailService;

public static class InitializerExtension
{
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
using System.ComponentModel.DataAnnotations;

namespace AndreGoepel.MembersArea.MailService;
namespace AndreGoepel.AppFoundation.MailService;

internal record MailConfiguration
{
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
namespace AndreGoepel.MembersArea.MailService;
namespace AndreGoepel.AppFoundation.MailService;

public record MailMessage(string Recipient, string Subject, string Body);
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
using Wolverine.Attributes;

namespace AndreGoepel.MembersArea.MailService;
namespace AndreGoepel.AppFoundation.MailService;

[WolverineHandler]
public class SendEmailMessageHandler(IEmailSender EmailSender)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
using Microsoft.Extensions.Options;
using MimeKit;

namespace AndreGoepel.MembersArea.MailService;
namespace AndreGoepel.AppFoundation.MailService;

internal class SmtpEmailSender(IOptions<MailConfiguration> configuration) : IEmailSender
{
Expand Down
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
using AndreGoepel.Marten.Identity.Users;
using AndreGoepel.MembersArea.Components.Account;
using AndreGoepel.Marten.Identity.Http;
using Microsoft.AspNetCore.Authentication;
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Identity;
using Microsoft.Extensions.Logging;
using Microsoft.Extensions.Options;
using NSubstitute;

namespace AndreGoepel.MembersArea.Tests.Account;
namespace AndreGoepel.AppFoundation.Tests.Account;

public class CookieLoginMiddlewareTests
{
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
using AndreGoepel.Marten.Identity.Users;
using AndreGoepel.MembersArea.Components.Account;
using AndreGoepel.MembersArea.MailService;
using AndreGoepel.AppFoundation.Components.Account;
using AndreGoepel.AppFoundation.MailService;
using NSubstitute;
using Wolverine;

namespace AndreGoepel.MembersArea.Tests.Account;
namespace AndreGoepel.AppFoundation.Tests.Account;

public class IdentityEmailSenderTests
{
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
using System.Text;
using AndreGoepel.Marten.Identity.Users;
using AndreGoepel.MembersArea.Components.Account.Pages;
using AndreGoepel.Marten.Identity.Blazor.Components.Account.Pages;
using Bunit;
using Microsoft.AspNetCore.Components;
using Microsoft.AspNetCore.Http;
Expand All @@ -9,7 +9,7 @@
using Microsoft.Extensions.DependencyInjection;
using NSubstitute;

namespace AndreGoepel.MembersArea.Tests.Account.Pages;
namespace AndreGoepel.AppFoundation.Tests.Account.Pages;

public class ConfirmEmailTests : BunitContext
{
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
using System.Text;
using AndreGoepel.Marten.Identity.Users;
using AndreGoepel.MembersArea.Components.Account.Pages;
using AndreGoepel.Marten.Identity.Blazor.Components.Account.Pages;
using Bunit;
using Microsoft.AspNetCore.Authentication;
using Microsoft.AspNetCore.Components;
Expand All @@ -12,7 +12,7 @@
using Microsoft.Extensions.Options;
using NSubstitute;

namespace AndreGoepel.MembersArea.Tests.Account.Pages;
namespace AndreGoepel.AppFoundation.Tests.Account.Pages;

public class ConfirmEmailChangeTests : BunitContext
{
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
using AndreGoepel.MembersArea.Components.Account.Pages;
using AndreGoepel.Marten.Identity.Blazor.Components.Account.Pages;
using Bunit;
using Microsoft.AspNetCore.Components;
using Microsoft.Extensions.DependencyInjection;
using Radzen;

namespace AndreGoepel.MembersArea.Tests.Account.Pages;
namespace AndreGoepel.AppFoundation.Tests.Account.Pages;

public class LoginWith2faTests : BunitContext
{
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
using AndreGoepel.MembersArea.Components.Account.Pages;
using AndreGoepel.Marten.Identity.Blazor.Components.Account.Pages;
using Bunit;
using Microsoft.AspNetCore.Components;
using Microsoft.Extensions.DependencyInjection;
using Radzen;

namespace AndreGoepel.MembersArea.Tests.Account.Pages;
namespace AndreGoepel.AppFoundation.Tests.Account.Pages;

public class LoginWithRecoveryCodeTests : BunitContext
{
Expand Down
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
using AndreGoepel.Marten.Identity.Users;
using AndreGoepel.MembersArea.Components.Account.Pages;
using AndreGoepel.Marten.Identity.Blazor.Components.Account.Pages;
using Bunit;
using Microsoft.AspNetCore.Components;
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Identity;
using Microsoft.Extensions.DependencyInjection;
using NSubstitute;

namespace AndreGoepel.MembersArea.Tests.Account.Pages;
namespace AndreGoepel.AppFoundation.Tests.Account.Pages;

public class RegisterConfirmationTests : BunitContext
{
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
using System.Text;
using AndreGoepel.Marten.Identity.Users;
using AndreGoepel.MembersArea.Components.Account.Pages;
using AndreGoepel.Marten.Identity.Blazor.Components.Account.Pages;
using Bunit;
using Microsoft.AspNetCore.Components;
using Microsoft.AspNetCore.Identity;
Expand All @@ -9,7 +9,7 @@
using NSubstitute;
using Radzen;

namespace AndreGoepel.MembersArea.Tests.Account.Pages;
namespace AndreGoepel.AppFoundation.Tests.Account.Pages;

public class ResetPasswordTests : BunitContext
{
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
using AndreGoepel.MembersArea.Components.Account.Pages;
using AndreGoepel.Marten.Identity.Blazor.Components.Account.Pages;
using Bunit;
using Microsoft.AspNetCore.Components;
using Microsoft.Extensions.DependencyInjection;

namespace AndreGoepel.MembersArea.Tests.Account.Pages;
namespace AndreGoepel.AppFoundation.Tests.Account.Pages;

public class StaticPagesTests : BunitContext
{
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
using AndreGoepel.MembersArea.Components.Account.Shared;
using AndreGoepel.Marten.Identity.Blazor.Components.Account.Shared;
using Bunit;
using Microsoft.AspNetCore.Components;
using Microsoft.Extensions.DependencyInjection;

namespace AndreGoepel.MembersArea.Tests.Account.Shared;
namespace AndreGoepel.AppFoundation.Tests.Account.Shared;

public class RedirectToLoginTests : BunitContext
{
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
using AndreGoepel.MembersArea.Components.Account.Shared;
using AndreGoepel.Marten.Identity.Blazor.Components.Account.Shared;
using Bunit;

namespace AndreGoepel.MembersArea.Tests.Account.Shared;
namespace AndreGoepel.AppFoundation.Tests.Account.Shared;

public class ShowRecoveryCodesTests : BunitContext
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
</ItemGroup>

<ItemGroup>
<ProjectReference Include="..\AndreGoepel.MembersArea\AndreGoepel.MembersArea.csproj" />
<ProjectReference Include="..\AndreGoepel.AppFoundation\AndreGoepel.AppFoundation.csproj" />
<ProjectReference Include="..\AndreGoepel.Marten.Identity.Blazor\AndreGoepel.Marten.Identity.Blazor.csproj" />
</ItemGroup>
</Project>
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
using AndreGoepel.MembersArea.Components.Shared;
using AndreGoepel.Marten.Identity.Blazor.Components.Shared;
using Bunit;
using Microsoft.AspNetCore.Components;
using Microsoft.Extensions.DependencyInjection;

namespace AndreGoepel.MembersArea.Tests.Shared;
namespace AndreGoepel.AppFoundation.Tests.Shared;

public class LinkButtonTests : BunitContext
{
Expand Down
17 changes: 17 additions & 0 deletions AndreGoepel.AppFoundation/AndreGoepel.AppFoundation.slnx
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
<Solution>
<Project Path="AndreGoepel.Marten.Identity.Tests/AndreGoepel.Marten.Identity.Tests.csproj" />
<Project
Path="AndreGoepel.Marten.Identity/AndreGoepel.Marten.Identity.csproj"
Id="7a1ef732-e167-4703-a4c5-69845d3fc9fe"
/>
<Project Path="AndreGoepel.AppFoundation.AppHost/AndreGoepel.AppFoundation.AppHost.csproj" />
<Project Path="AndreGoepel.AppFoundation.MailService.Tests/AndreGoepel.AppFoundation.MailService.Tests.csproj" />
<Project Path="AndreGoepel.AppFoundation.MailService/AndreGoepel.AppFoundation.MailService.csproj" />
<Project Path="AndreGoepel.Marten.Identity.Blazor/AndreGoepel.Marten.Identity.Blazor.csproj" />
<Project Path="AndreGoepel.AppFoundation.ServiceDefaults/AndreGoepel.AppFoundation.ServiceDefaults.csproj" />
<Project Path="AndreGoepel.AppFoundation.Tests/AndreGoepel.AppFoundation.Tests.csproj" />
<Project Path="AndreGoepel.AppFoundation/AndreGoepel.AppFoundation.csproj" />
<Project Path="docker-compose.dcproj">
<Build />
</Project>
</Solution>
Loading