-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #7 from Fgruntjes/beta
Beta
- Loading branch information
Showing
20 changed files
with
309 additions
and
21 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
{ | ||
"name": "serverless-personal-finance", | ||
"description": "Personal finance application build on serverless cloud functions. Keeping running cost at a minimum while using high end hosting." | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
name: Publish | ||
on: | ||
release: | ||
types: [published] | ||
|
||
jobs: | ||
build_images: | ||
runs-on: ubuntu-latest | ||
strategy: | ||
matrix: | ||
dotnet-version: [ '6.0.x' ] | ||
project: [ 'App.Function.Banktransaction.Import' ] | ||
steps: | ||
- uses: actions/checkout@v2 | ||
- uses: crazy-max/ghaction-docker-meta@v4 | ||
id: docker_meta | ||
with: | ||
images: ghcr.io/${{ github.repository }}/${{ matrix.project }} | ||
- uses: docker/[email protected] | ||
- uses: docker/login-action@v1 | ||
with: | ||
registry: ghcr.io | ||
username: ${{ github.repository_owner }} | ||
password: ${{ secrets.GITHUB_TOKEN }} | ||
- uses: docker/[email protected] | ||
with: | ||
context: . | ||
push: true | ||
tags: ${{ steps.docker_meta.outputs.tags }} | ||
cache-from: type=gha | ||
cache-to: type=gha,mode=max | ||
|
||
deploy: | ||
runs-on: ubuntu-latest | ||
if: startsWith(github.ref, 'refs/tags/v') && endsWith(github.ref, '${{ matrix.environment }}') | ||
needs: | ||
- build_images | ||
permissions: | ||
contents: 'read' | ||
id-token: 'write' | ||
strategy: | ||
matrix: | ||
project: [ 'App.Function.Banktransaction.Import' ] | ||
environment: [ 'beta' ] | ||
steps: | ||
- uses: 'actions/checkout@v3' | ||
- id: 'auth' | ||
name: 'Authenticate to Google Cloud' | ||
uses: 'google-github-actions/auth@v0' | ||
with: | ||
workload_identity_provider: ${{ secrets.GOOGLE_WORKLOAD_IDENTITY_PROVIDER }} | ||
service_account: ${{ secrets.GOOGLE_SERVICE_ACCOUNT }} | ||
- id: 'deploy' | ||
uses: 'google-github-actions/deploy-cloudrun@v0' | ||
with: | ||
metadata: '${{ matrix.project }}' | ||
env_vars: 'DEPLOY_ENV=${{ matrix.environment }}' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
name: Release | ||
on: | ||
push: | ||
branches: | ||
- main | ||
- master | ||
- alpha | ||
- beta | ||
|
||
jobs: | ||
release: | ||
runs-on: ubuntu-20.04 | ||
steps: | ||
- uses: actions/setup-node@v2 | ||
with: | ||
node-version: '14' | ||
- uses: actions/checkout@v2 | ||
with: | ||
persist-credentials: false | ||
- uses: cycjimmy/semantic-release-action@v3 | ||
with: | ||
semantic_version: 19 | ||
working_directory: "./.github" | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
name: Test | ||
on: | ||
pull_request: | ||
|
||
jobs: | ||
######################################################### | ||
# Code quality and unit tests | ||
######################################################### | ||
test_quality: | ||
runs-on: ubuntu-latest | ||
strategy: | ||
matrix: | ||
dotnet-version: [ '6.0.x' ] | ||
steps: | ||
- uses: actions/checkout@v2 | ||
- name: Setup .NET Core SDK ${{ matrix.dotnet-version }} | ||
uses: actions/setup-dotnet@v2 | ||
with: | ||
dotnet-version: ${{ matrix.dotnet-version }} | ||
- uses: kkak10/[email protected] | ||
id: PRNUMBER | ||
- run: | | ||
echo "file_name=FormatReport.${{ matrix.dotnet-version }}.${{steps.PRNUMBER.outputs.pr}}.${{github.run_number}}.json" >> $GITHUB_ENV | ||
- run: dotnet format --verify-no-changes | ||
|
||
test_integration: | ||
runs-on: ubuntu-latest | ||
strategy: | ||
matrix: | ||
dotnet-version: [ '6.0.x' ] | ||
project: [ 'App.Function.Banktransaction.Import.Tests' ] | ||
steps: | ||
- uses: actions/checkout@v2 | ||
- name: Setup .NET Core SDK ${{ matrix.dotnet-version }} | ||
uses: actions/setup-dotnet@v2 | ||
with: | ||
dotnet-version: ${{ matrix.dotnet-version }} | ||
- uses: kkak10/[email protected] | ||
id: PRNUMBER | ||
- run: | | ||
echo "title=Test Run for PR #${{steps.PRNUMBER.outputs.pr}} (${{github.run_number}})" >> $GITHUB_ENV | ||
echo "file_name=TestReport.${{ matrix.dotnet-version }}.${{ matrix.project }}.${{steps.PRNUMBER.outputs.pr}}.${{github.run_number}}.md" >> $GITHUB_ENV | ||
- run: dotnet restore ${{ matrix.project }} | ||
- run: dotnet build --no-restore ${{ matrix.project }} | ||
- run: dotnet test --no-restore --no-build --logger "liquid.md;LogFileName=${{github.workspace}}/${{env.file_name}};Title=${{env.title}};" ${{ matrix.project }} | ||
- uses: marocchino/sticky-pull-request-comment@v2 | ||
if: ${{always()}} | ||
with: | ||
path: ${{github.workspace}}/${{env.file_name}} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
TestResults/* |
28 changes: 28 additions & 0 deletions
28
App.Function.Banktransaction.Import.Tests/App.Function.Banktransaction.Import.Tests.csproj
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
<Project Sdk="Microsoft.NET.Sdk"> | ||
|
||
<PropertyGroup> | ||
<TargetFramework>net6.0</TargetFramework> | ||
<ImplicitUsings>enable</ImplicitUsings> | ||
<Nullable>enable</Nullable> | ||
|
||
<IsPackable>false</IsPackable> | ||
</PropertyGroup> | ||
|
||
<ItemGroup> | ||
<PackageReference Include="FluentAssertions" Version="6.7.0" /> | ||
<PackageReference Include="coverlet.collector" Version="3.1.2" /> | ||
<PackageReference Include="LiquidTestReports.Markdown" Version="1.0.9" /> | ||
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.3.2" /> | ||
<PackageReference Include="xunit" Version="2.4.2" /> | ||
<PackageReference Include="xunit.runner.visualstudio" Version="2.4.5"> | ||
<PrivateAssets>all</PrivateAssets> | ||
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets> | ||
</PackageReference> | ||
</ItemGroup> | ||
|
||
<ItemGroup> | ||
<ProjectReference Include="..\App.Function.Banktransaction.Import\App.Function.Banktransaction.Import.csproj" /> | ||
<ProjectReference Include="..\App.TestsLib\App.TestsLib.csproj" /> | ||
</ItemGroup> | ||
|
||
</Project> |
32 changes: 32 additions & 0 deletions
32
App.Function.Banktransaction.Import.Tests/src/Controller/AppControllerTest.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
using System.Net; | ||
using System.Net.Http.Json; | ||
using App.Lib.Dto; | ||
using App.TestsLib; | ||
|
||
namespace App.Function.Banktransaction.Import.Tests.Controller; | ||
|
||
public class AppControllerTest : IntegrationTestFixture<Program> | ||
{ | ||
public AppControllerTest(TestApplicationFactory<Program> factory) : base(factory) | ||
{ | ||
} | ||
|
||
[Fact] | ||
public async void PostAndWaitForDatabase() | ||
{ | ||
var values = new BankTransaction[] | ||
{ | ||
new() | ||
{ | ||
Account = "Some Account", | ||
Category = "Clothing", | ||
Date = new DateTime(2022, 10, 4), | ||
Payee = "SomeStore", | ||
Value = 220, | ||
CurrencyCode = "EUR", | ||
} | ||
}; | ||
using var response = await _client.PostAsJsonAsync("/", values); | ||
Assert.Equal(HttpStatusCode.Accepted, response.StatusCode); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
global using Xunit; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -6,3 +6,7 @@ | |
var app = builder.Build(); | ||
app.MapControllers(); | ||
app.Run(); | ||
|
||
public partial class Program | ||
{ | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
<Project Sdk="Microsoft.NET.Sdk"> | ||
|
||
<PropertyGroup> | ||
<TargetFramework>net6.0</TargetFramework> | ||
<ImplicitUsings>enable</ImplicitUsings> | ||
<Nullable>enable</Nullable> | ||
</PropertyGroup> | ||
|
||
<ItemGroup> | ||
<Reference Include="Microsoft.AspNetCore.Mvc.Testing"> | ||
<HintPath>..\..\..\..\..\.nuget\packages\microsoft.aspnetcore.mvc.testing\6.0.9\lib\net6.0\Microsoft.AspNetCore.Mvc.Testing.dll</HintPath> | ||
</Reference> | ||
<Reference Include="Microsoft.Extensions.Hosting.Abstractions"> | ||
<HintPath>..\..\..\..\..\.nuget\packages\microsoft.extensions.hosting.abstractions\2.2.0\lib\netstandard2.0\Microsoft.Extensions.Hosting.Abstractions.dll</HintPath> | ||
</Reference> | ||
<Reference Include="xunit.core"> | ||
<HintPath>..\..\..\..\..\.nuget\packages\xunit.extensibility.core\2.4.2\lib\netstandard1.1\xunit.core.dll</HintPath> | ||
</Reference> | ||
</ItemGroup> | ||
|
||
<ItemGroup> | ||
<PackageReference Include="Microsoft.AspNetCore.Mvc.Testing" Version="6.0.9" /> | ||
<PackageReference Include="xunit" Version="2.4.2" /> | ||
</ItemGroup> | ||
|
||
</Project> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
using Xunit; | ||
|
||
namespace App.TestsLib; | ||
|
||
public class IntegrationTestFixture<TEntryPoint> : IClassFixture<TestApplicationFactory<TEntryPoint>> where TEntryPoint : class | ||
{ | ||
protected readonly TestApplicationFactory<TEntryPoint> _factory; | ||
protected readonly HttpClient _client; | ||
|
||
public IntegrationTestFixture(TestApplicationFactory<TEntryPoint> factory) | ||
{ | ||
_factory = factory; | ||
_client = factory.CreateClient(); | ||
} | ||
} |
Oops, something went wrong.