Skip to content
Open
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
File renamed without changes.
8 changes: 8 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
.devcontainer/
.github/
.vscode/
chart/
doc/
src/*/bin/
src/*/obj/
test/
14 changes: 7 additions & 7 deletions .github/workflows/pullrequest-verify.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,22 +7,22 @@ on:

jobs:
verify-devcontainer:
uses: project-origin/.github/.github/workflows/reusable-verify-devcontainer.yaml@b1a1034591b6f491085a0d9d259ae3b486487701
uses: project-origin/.github/.github/workflows/reusable-verify-devcontainer.yaml@99575e8d3eda336ce2a339cc8c9f9235d26233bd

verify-code:
uses: project-origin/.github/.github/workflows/reusable-verify-code.yaml@b1a1034591b6f491085a0d9d259ae3b486487701
uses: project-origin/.github/.github/workflows/reusable-verify-code.yaml@99575e8d3eda336ce2a339cc8c9f9235d26233bd

verify-renovate-config:
uses: project-origin/.github/.github/workflows/reusable-verify-renovate.yaml@b1a1034591b6f491085a0d9d259ae3b486487701
uses: project-origin/.github/.github/workflows/reusable-verify-renovate.yaml@99575e8d3eda336ce2a339cc8c9f9235d26233bd

verify-chart:
uses: project-origin/.github/.github/workflows/reusable-verify-chart.yaml@b1a1034591b6f491085a0d9d259ae3b486487701
uses: project-origin/.github/.github/workflows/reusable-verify-chart.yaml@99575e8d3eda336ce2a339cc8c9f9235d26233bd

verify-container-build:
uses: project-origin/.github/.github/workflows/reusable-build-push-container-ghcr.yaml@b1a1034591b6f491085a0d9d259ae3b486487701
uses: project-origin/.github/.github/workflows/reusable-build-push-container-ghcr.yaml@99575e8d3eda336ce2a339cc8c9f9235d26233bd
with:
imagename: ghcr.io/project-origin/stamp
version: test
context: ./src
dockerfile: ./src/Stamp.Dockerfile
context: .
dockerfile: Stamp.Dockerfile
push: false
10 changes: 5 additions & 5 deletions .github/workflows/release-published.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,24 +6,24 @@ on:

jobs:
define-version:
uses: project-origin/.github/.github/workflows/reusable-tag-version.yaml@b1a1034591b6f491085a0d9d259ae3b486487701
uses: project-origin/.github/.github/workflows/reusable-tag-version.yaml@99575e8d3eda336ce2a339cc8c9f9235d26233bd

publish-container:
needs:
- define-version
uses: project-origin/.github/.github/workflows/reusable-build-push-container-ghcr.yaml@b1a1034591b6f491085a0d9d259ae3b486487701
uses: project-origin/.github/.github/workflows/reusable-build-push-container-ghcr.yaml@99575e8d3eda336ce2a339cc8c9f9235d26233bd
with:
imagename: ghcr.io/project-origin/stamp
version: ${{ needs.define-version.outputs.version }}
context: ./src
dockerfile: ./src/Stamp.Dockerfile
context: .
dockerfile: Stamp.Dockerfile
push: true

publish-chart:
needs:
- define-version
- publish-container
uses: project-origin/.github/.github/workflows/reusable-publish-chart.yaml@b1a1034591b6f491085a0d9d259ae3b486487701
uses: project-origin/.github/.github/workflows/reusable-publish-chart.yaml@99575e8d3eda336ce2a339cc8c9f9235d26233bd
with:
version: ${{ needs.define-version.outputs.version }}
chart_folder: chart
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/sonarcloud.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,6 @@ on:

jobs:
analyse:
uses: project-origin/.github/.github/workflows/reusable-sonarcloud.yaml@b1a1034591b6f491085a0d9d259ae3b486487701
uses: project-origin/.github/.github/workflows/reusable-sonarcloud.yaml@99575e8d3eda336ce2a339cc8c9f9235d26233bd
secrets:
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
7 changes: 7 additions & 0 deletions Directory.Build.props
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
<Project>
<PropertyGroup>
<TargetFramework>net8.0</TargetFramework>
<Nullable>enable</Nullable>
<WarningsAsErrors>IDE0005</WarningsAsErrors>
</PropertyGroup>
</Project>
27 changes: 13 additions & 14 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,8 +1,3 @@
src_path := src

docfx_config := doc/docfx.json
docfx_site_dir := doc/_site

formatting_header := \033[1m
formatting_command := \033[1;34m
formatting_desc := \033[0;32m
Expand Down Expand Up @@ -31,39 +26,43 @@ info:
## Lint the dotnet code
lint:
@echo "Verifying code formatting..."
dotnet format $(src_path) --verify-no-changes
dotnet format --verify-no-changes

## Does a dotnet clean
clean:
dotnet clean $(src_path)
dotnet clean

## Restores all dotnet projects
restore:
dotnet tool restore --tool-manifest src/.config/dotnet-tools.json
dotnet restore $(src_path)
dotnet tool restore
dotnet restore

## Builds all the code
build: restore
dotnet build --no-restore $(src_path)
dotnet build --no-restore

## Formats files using dotnet format
format:
dotnet format $(src_path)
dotnet format

## Run all tests
test: build
dotnet test --no-build $(src_path)
dotnet test --no-build

## Tests run with the sonarcloud analyser
sonarcloud-test:
dotnet test --no-build $(src_path)
dotnet test --no-build

## Run all Unit-tests
unit-test:
dotnet test $(src_path) --filter 'FullyQualifiedName!~IntegrationTests'
dotnet test --filter 'FullyQualifiedName!~IntegrationTests'

## Builds the local container, creates kind cluster and installs chart, and verifies it works
verify-chart:
@kind version >/dev/null 2>&1 || { echo >&2 "kind not installed! kind is required to use recipe, please install or use devcontainer"; exit 1;}
@helm version >/dev/null 2>&1 || { echo >&2 "helm not installed! helm is required to use recipe, please install or use devcontainer"; exit 1;}
chart/run_kind_test.sh

## Build the container image with tag ghcr.io/project-origin/stamp:test
build-container:
docker build -f Stamp.Dockerfile -t ghcr.io/project-origin/stamp:test .
62 changes: 31 additions & 31 deletions src/ProjectOrigin.Stamp.Server.sln → ProjectOrigin.Stamp.sln
Original file line number Diff line number Diff line change
@@ -1,31 +1,31 @@

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio Version 17
VisualStudioVersion = 17.9.34728.123
MinimumVisualStudioVersion = 10.0.40219.1
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ProjectOrigin.Stamp.Server", "ProjectOrigin.Stamp.Server\ProjectOrigin.Stamp.Server.csproj", "{47C61EF0-D925-40D4-8F2B-7168ADBC1243}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ProjectOrigin.Stamp.Test", "ProjectOrigin.Stamp.Test\ProjectOrigin.Stamp.Test.csproj", "{C04F1F43-68E6-47F9-B67C-8D6C0D9DA0B2}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Release|Any CPU = Release|Any CPU
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{47C61EF0-D925-40D4-8F2B-7168ADBC1243}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{47C61EF0-D925-40D4-8F2B-7168ADBC1243}.Debug|Any CPU.Build.0 = Debug|Any CPU
{47C61EF0-D925-40D4-8F2B-7168ADBC1243}.Release|Any CPU.ActiveCfg = Release|Any CPU
{47C61EF0-D925-40D4-8F2B-7168ADBC1243}.Release|Any CPU.Build.0 = Release|Any CPU
{C04F1F43-68E6-47F9-B67C-8D6C0D9DA0B2}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{C04F1F43-68E6-47F9-B67C-8D6C0D9DA0B2}.Debug|Any CPU.Build.0 = Debug|Any CPU
{C04F1F43-68E6-47F9-B67C-8D6C0D9DA0B2}.Release|Any CPU.ActiveCfg = Release|Any CPU
{C04F1F43-68E6-47F9-B67C-8D6C0D9DA0B2}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {B492A83E-C978-4BD5-BA69-80E159A70A75}
EndGlobalSection
EndGlobal

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio Version 17
VisualStudioVersion = 17.9.34728.123
MinimumVisualStudioVersion = 10.0.40219.1
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ProjectOrigin.Stamp", "src\ProjectOrigin.Stamp\ProjectOrigin.Stamp.csproj", "{47C61EF0-D925-40D4-8F2B-7168ADBC1243}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ProjectOrigin.Stamp.Test", "test\ProjectOrigin.Stamp.Test\ProjectOrigin.Stamp.Test.csproj", "{C04F1F43-68E6-47F9-B67C-8D6C0D9DA0B2}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Release|Any CPU = Release|Any CPU
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{47C61EF0-D925-40D4-8F2B-7168ADBC1243}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{47C61EF0-D925-40D4-8F2B-7168ADBC1243}.Debug|Any CPU.Build.0 = Debug|Any CPU
{47C61EF0-D925-40D4-8F2B-7168ADBC1243}.Release|Any CPU.ActiveCfg = Release|Any CPU
{47C61EF0-D925-40D4-8F2B-7168ADBC1243}.Release|Any CPU.Build.0 = Release|Any CPU
{C04F1F43-68E6-47F9-B67C-8D6C0D9DA0B2}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{C04F1F43-68E6-47F9-B67C-8D6C0D9DA0B2}.Debug|Any CPU.Build.0 = Debug|Any CPU
{C04F1F43-68E6-47F9-B67C-8D6C0D9DA0B2}.Release|Any CPU.ActiveCfg = Release|Any CPU
{C04F1F43-68E6-47F9-B67C-8D6C0D9DA0B2}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {B492A83E-C978-4BD5-BA69-80E159A70A75}
EndGlobalSection
EndGlobal
24 changes: 24 additions & 0 deletions Stamp.Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
ARG PROJECT=ProjectOrigin.Stamp

FROM --platform=$BUILDPLATFORM mcr.microsoft.com/dotnet/sdk:8.0.402 AS build
ARG PROJECT

WORKDIR /builddir

COPY .config .config
COPY Directory.Build.props Directory.Build.props
COPY protos protos
COPY src src

RUN dotnet tool restore
RUN dotnet publish src/${PROJECT} -c Release -p:CustomAssemblyName=App -o /app/publish

# ------- production image -------
FROM mcr.microsoft.com/dotnet/aspnet:8.0.8-jammy-chiseled-extra AS production

WORKDIR /app
COPY --from=build /app/publish .

EXPOSE 5000

ENTRYPOINT ["dotnet", "App.dll"]
14 changes: 9 additions & 5 deletions chart/run_kind_test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -41,19 +41,23 @@ trap 'debug; cleanup' ERR
temp_folder=$(mktemp -d)
values_filename=${temp_folder}/values.yaml

# create kind cluster

# create kind cluster - async
kind delete cluster -n ${cluster_name}
kind create cluster -n ${cluster_name}
kind create cluster -n ${cluster_name} &

# build docker image - async
make build-container &

# wait for cluster and container to be ready
wait

# install rabbitmq-operator
kubectl apply -f "https://github.com/rabbitmq/cluster-operator/releases/download/v2.5.0/cluster-operator.yml"

# install cnpg-operator
helm install cnpg-operator cloudnative-pg --repo https://cloudnative-pg.io/charts --version 0.18.0 --namespace cnpg --create-namespace --wait

# build docker image
docker build -f src/Stamp.Dockerfile -t ghcr.io/project-origin/stamp:test src/

# load docker image into cluster
kind load -n ${cluster_name} docker-image ghcr.io/project-origin/stamp:test

Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
2 changes: 0 additions & 2 deletions src/.dockerignore

This file was deleted.

13 changes: 0 additions & 13 deletions src/ProjectOrigin.Stamp.Test/Extensions/MappingExtensions.cs

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Hosting;
using Microsoft.Extensions.Logging;
using ProjectOrigin.Stamp.Server.Database;
using ProjectOrigin.Stamp.Database;

namespace ProjectOrigin.Stamp.Server.BackgroundServices;
namespace ProjectOrigin.Stamp.BackgroundServices;

public class OutboxPollingWorker : BackgroundService
{
Expand Down Expand Up @@ -36,7 +36,7 @@ protected override async Task ExecuteAsync(CancellationToken stoppingToken)
try
{
_logger.LogInformation("Processing outbox message {msgId}.", msg.Id);
var type = Type.GetType($"{msg.MessageType}, ProjectOrigin.Stamp.Server");
var type = Type.GetType($"{msg.MessageType}, ProjectOrigin.Stamp");
var loadedObject = JsonSerializer.Deserialize(msg.JsonPayload, type!);

await bus.Publish(loadedObject!, stoppingToken);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
using System.Data;

namespace ProjectOrigin.Stamp.Server.Database;
namespace ProjectOrigin.Stamp.Database;

public interface IDbConnectionFactory
{
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
using System.Threading.Tasks;

namespace ProjectOrigin.Stamp.Server.Database;
namespace ProjectOrigin.Stamp.Database;

public interface IRepositoryUpgrader
{
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
using ProjectOrigin.Stamp.Server.Repositories;
using ProjectOrigin.Stamp.Repositories;

namespace ProjectOrigin.Stamp.Server.Database;
namespace ProjectOrigin.Stamp.Database;

public interface IUnitOfWork
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
using Microsoft.Extensions.DependencyInjection;
using ProjectOrigin.HierarchicalDeterministicKeys.Interfaces;

namespace ProjectOrigin.Stamp.Server.Database.Mapping;
namespace ProjectOrigin.Stamp.Database.Mapping;

public static class ApplicationBuilderExtension
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
using Dapper;
using ProjectOrigin.HierarchicalDeterministicKeys.Interfaces;

namespace ProjectOrigin.Stamp.Server.Database.Mapping;
namespace ProjectOrigin.Stamp.Database.Mapping;

public class HDPrivateKeyTypeHandler : SqlMapper.TypeHandler<IHDPrivateKey>
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
using Dapper;
using ProjectOrigin.HierarchicalDeterministicKeys.Interfaces;

namespace ProjectOrigin.Stamp.Server.Database.Mapping;
namespace ProjectOrigin.Stamp.Database.Mapping;

public class HDPublicKeyTypeHandler : SqlMapper.TypeHandler<IHDPublicKey>
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
using Microsoft.Extensions.Options;
using Npgsql;

namespace ProjectOrigin.Stamp.Server.Database.Postgres;
namespace ProjectOrigin.Stamp.Database.Postgres;

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

namespace ProjectOrigin.Stamp.Server.Database.Postgres;
namespace ProjectOrigin.Stamp.Database.Postgres;

public sealed class PostgresOptions
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
using Microsoft.Extensions.Logging;
using Microsoft.Extensions.Options;

namespace ProjectOrigin.Stamp.Server.Database.Postgres;
namespace ProjectOrigin.Stamp.Database.Postgres;

public class PostgresUpgrader : IRepositoryUpgrader
{
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
using System;
using System.Data;
using ProjectOrigin.Stamp.Server.Repositories;
using ProjectOrigin.Stamp.Repositories;

namespace ProjectOrigin.Stamp.Server.Database;
namespace ProjectOrigin.Stamp.Database;

public class UnitOfWork : IUnitOfWork, IDisposable
{
Expand Down
Loading
Loading