Skip to content

Commit

Permalink
Merge branch 'main' into process-unclaimed-event
Browse files Browse the repository at this point in the history
  • Loading branch information
MartinSchmidt committed Sep 30, 2024
2 parents 8d3aae7 + 5a63712 commit 379e019
Show file tree
Hide file tree
Showing 50 changed files with 139 additions and 144 deletions.
File renamed without changes.
File renamed without changes.
12 changes: 6 additions & 6 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@5f308f6499ed423ed1252156296e18be614202de
uses: project-origin/.github/.github/workflows/reusable-verify-devcontainer.yaml@e60d4e84fd4a7ccb2827046672e1bacae91712ae

verify-code:
uses: project-origin/.github/.github/workflows/reusable-verify-code.yaml@5f308f6499ed423ed1252156296e18be614202de
uses: project-origin/.github/.github/workflows/reusable-verify-code.yaml@e60d4e84fd4a7ccb2827046672e1bacae91712ae

verify-renovate-config:
uses: project-origin/.github/.github/workflows/reusable-verify-renovate.yaml@5f308f6499ed423ed1252156296e18be614202de
uses: project-origin/.github/.github/workflows/reusable-verify-renovate.yaml@e60d4e84fd4a7ccb2827046672e1bacae91712ae

verify-chart:
uses: project-origin/.github/.github/workflows/reusable-verify-chart.yaml@32ff33baaf1c9960ef1f01ef4ee554225db1972c

verify-container-build:
uses: project-origin/.github/.github/workflows/reusable-build-push-container-ghcr.yaml@5f308f6499ed423ed1252156296e18be614202de
uses: project-origin/.github/.github/workflows/reusable-build-push-container-ghcr.yaml@e60d4e84fd4a7ccb2827046672e1bacae91712ae
with:
imagename: ghcr.io/project-origin/chronicler
version: test
context: ./src
dockerfile: ./src/Chronicler.Dockerfile
context: .
dockerfile: Chronicler.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@5f308f6499ed423ed1252156296e18be614202de
uses: project-origin/.github/.github/workflows/reusable-tag-version.yaml@e60d4e84fd4a7ccb2827046672e1bacae91712ae

publish-container:
needs:
- define-version
uses: project-origin/.github/.github/workflows/reusable-build-push-container-ghcr.yaml@5f308f6499ed423ed1252156296e18be614202de
uses: project-origin/.github/.github/workflows/reusable-build-push-container-ghcr.yaml@e60d4e84fd4a7ccb2827046672e1bacae91712ae
with:
imagename: ghcr.io/project-origin/chronicler
version: ${{ needs.define-version.outputs.version }}
context: ./src
dockerfile: ./src/Chronicler.Dockerfile
context: .
dockerfile: Chronicler.Dockerfile
push: true

publish-chart:
needs:
- define-version
- publish-container
uses: project-origin/.github/.github/workflows/reusable-publish-chart.yaml@5f308f6499ed423ed1252156296e18be614202de
uses: project-origin/.github/.github/workflows/reusable-publish-chart.yaml@e60d4e84fd4a7ccb2827046672e1bacae91712ae
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@5f308f6499ed423ed1252156296e18be614202de
uses: project-origin/.github/.github/workflows/reusable-sonarcloud.yaml@e60d4e84fd4a7ccb2827046672e1bacae91712ae
secrets:
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
25 changes: 25 additions & 0 deletions Chronicler.Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
ARG PROJECT=ProjectOrigin.Chronicler

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"]

8 changes: 8 additions & 0 deletions Directory.Build.props
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
<Project>
<PropertyGroup>
<TargetFramework>net8.0</TargetFramework>
<Nullable>enable</Nullable>
<ImplicitUsings>disable</ImplicitUsings>
<WarningsAsErrors>IDE0005</WarningsAsErrors>
</PropertyGroup>
</Project>
29 changes: 14 additions & 15 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,14 +1,9 @@
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
formatting_none := \033[0m

.PHONY: help test clean build lint
.PHONY: test

.DEFAULT_GOAL := help

Expand All @@ -31,40 +26,44 @@ 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;}
helm unittest chart
chart/run_kind_test.sh

## Build the container image with tag ghcr.io/project-origin/vault:test
build-container:
docker build -f Chronicler.Dockerfile -t ghcr.io/project-origin/chronicler:test .
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@ 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.Chronicler.Server", "ProjectOrigin.Chronicler.Server\ProjectOrigin.Chronicler.Server.csproj", "{47C61EF0-D925-40D4-8F2B-7168ADBC1243}"
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ProjectOrigin.Chronicler", "src\ProjectOrigin.Chronicler\ProjectOrigin.Chronicler.csproj", "{47C61EF0-D925-40D4-8F2B-7168ADBC1243}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ProjectOrigin.Chronicler.Test", "ProjectOrigin.Chronicler.Test\ProjectOrigin.Chronicler.Test.csproj", "{C04F1F43-68E6-47F9-B67C-8D6C0D9DA0B2}"
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ProjectOrigin.Chronicler.Test", "test\ProjectOrigin.Chronicler.Test\ProjectOrigin.Chronicler.Test.csproj", "{C04F1F43-68E6-47F9-B67C-8D6C0D9DA0B2}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Expand Down
11 changes: 7 additions & 4 deletions chart/run_kind_test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -45,17 +45,20 @@ secret_filename=${temp_folder}/secret.yaml

# create kind cluster
kind delete cluster --name ${cluster_name}
kind create cluster --name ${cluster_name}
kind create cluster --name ${cluster_name} &

# build docker image
make build-container &

# wait for cluster and container to be ready
wait

# create namespace
kubectl create namespace ${namespace}

# install postgresql chart
helm install postgresql oci://registry-1.docker.io/bitnamicharts/postgresql --namespace ${namespace}

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

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

Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
24 changes: 0 additions & 24 deletions src/Chronicler.Dockerfile

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@
using Microsoft.Extensions.Hosting;
using Microsoft.Extensions.Logging;
using Microsoft.Extensions.Options;
using ProjectOrigin.Chronicler.Server.Options;
using ProjectOrigin.Chronicler.Options;

namespace ProjectOrigin.Chronicler.Server.BlockReader;
namespace ProjectOrigin.Chronicler.BlockReader;

public class BlockReaderBackgroundService : BackgroundService
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,12 @@
using System.Threading.Tasks;
using Microsoft.Extensions.Logging;
using Microsoft.Extensions.Options;
using ProjectOrigin.Chronicler.Server.Models;
using ProjectOrigin.Chronicler.Server.Options;
using ProjectOrigin.Chronicler.Server.Repositories;
using ProjectOrigin.Chronicler.Models;
using ProjectOrigin.Chronicler.Options;
using ProjectOrigin.Chronicler.Repositories;
using ProjectOrigin.ServiceCommon.Database;

namespace ProjectOrigin.Chronicler.Server.BlockReader;
namespace ProjectOrigin.Chronicler.BlockReader;

public class BlockReaderJob : IBlockReaderJob
{
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
using System.Threading;
using System.Threading.Tasks;

namespace ProjectOrigin.Chronicler.Server.BlockReader;
namespace ProjectOrigin.Chronicler.BlockReader;

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

namespace ProjectOrigin.Chronicler.Server.Exceptions
namespace ProjectOrigin.Chronicler.Exceptions
{
public class RegistryNotKnownException : Exception
{
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
using Grpc.Net.Client;

namespace ProjectOrigin.Chronicler.Server;
namespace ProjectOrigin.Chronicler;

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

namespace ProjectOrigin.Chronicler.Server;
namespace ProjectOrigin.Chronicler;

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

namespace ProjectOrigin.Chronicler.Server.Models;
namespace ProjectOrigin.Chronicler.Models;

public record CertificateInfo
{
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
using System;

namespace ProjectOrigin.Chronicler.Server.Models;
namespace ProjectOrigin.Chronicler.Models;

public record ClaimAllocation
{
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
using System;

namespace ProjectOrigin.Chronicler.Server.Models;
namespace ProjectOrigin.Chronicler.Models;

public record ClaimIntent
{
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
using System;

namespace ProjectOrigin.Chronicler.Server.Models;
namespace ProjectOrigin.Chronicler.Models;

public record ClaimRecord
{
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
using System;

namespace ProjectOrigin.Chronicler.Server.Models;
namespace ProjectOrigin.Chronicler.Models;

public record FederatedCertificateId
{
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
using System;

namespace ProjectOrigin.Chronicler.Server.Models;
namespace ProjectOrigin.Chronicler.Models;

public record LastReadBlock
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
using ProjectOrigin.HierarchicalDeterministicKeys;
using ProjectOrigin.HierarchicalDeterministicKeys.Interfaces;

namespace ProjectOrigin.Chronicler.Server.Options;
namespace ProjectOrigin.Chronicler.Options;

public record ChroniclerOptions : IValidatableObject
{
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
using System.Collections.Generic;

namespace ProjectOrigin.Chronicler.Server.Options;
namespace ProjectOrigin.Chronicler.Options;

public record NetworkOptions
{
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
using ProjectOrigin.Chronicler.Server;
using ProjectOrigin.Chronicler;
using ProjectOrigin.ServiceCommon;

await new ServiceApplication<Startup>()
Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,6 @@
<Project Sdk="Microsoft.NET.Sdk.Web">

<PropertyGroup>
<TargetFramework>net8.0</TargetFramework>
<Nullable>enable</Nullable>
<ImplicitUsings>disable</ImplicitUsings>
<GenerateDocumentationFile>true</GenerateDocumentationFile>
<NoWarn>$(NoWarn);1591</NoWarn>
<AssemblyName Condition="'$(CustomAssemblyName)' != ''">$(CustomAssemblyName)</AssemblyName>
</PropertyGroup>

Expand All @@ -27,14 +22,14 @@
</Target>

<ItemGroup>
<Protobuf Include="../Protos/chronicler.proto" GrpcServices="Both" />
<Protobuf Include="../Protos/registry.proto" Link="Protos\registry.proto">
<Protobuf Include="../../protos/chronicler.proto" GrpcServices="Both" />
<Protobuf Include="../../protos/registry.proto" Link="protos\registry.proto">
<SourceUrl>https://raw.githubusercontent.com/project-origin/registry/v2.0.2/protos/registry.proto</SourceUrl>
</Protobuf>
<Protobuf Include="../Protos/electricity.proto" Link="Protos\electricity.proto">
<Protobuf Include="../../protos/electricity.proto" Link="protos\electricity.proto">
<SourceUrl>https://raw.githubusercontent.com/project-origin/verifier_electricity/v1.3.2/protos/electricity.proto</SourceUrl>
</Protobuf>
<Protobuf Include="../Protos/common.proto" Link="Protos\common.proto">
<Protobuf Include="../../protos/common.proto" Link="protos\common.proto">
<SourceUrl>https://raw.githubusercontent.com/project-origin/registry/v2.0.2/protos/common.proto</SourceUrl>
</Protobuf>
</ItemGroup>
Expand Down
Loading

0 comments on commit 379e019

Please sign in to comment.