Skip to content
Merged
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
25 changes: 25 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
**/.classpath
**/.dockerignore
**/.env
**/.git
**/.gitignore
**/.project
**/.settings
**/.toolstarget
**/.vs
**/.vscode
**/*.*proj.user
**/*.dbmdl
**/*.jfm
**/azds.yaml
**/bin
**/charts
**/docker-compose*
**/Dockerfile*
**/node_modules
**/npm-debug.log
**/obj
**/secrets.dev.yaml
**/values.dev.yaml
LICENSE
README.md
13 changes: 13 additions & 0 deletions .github/release-drafter.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
categories:
- title: '🚀 Features'
labels:
- 'feature'
- title: '🐛 Bug Fixes'
labels:
- 'bug'
- title: '🧰 Maintenance'
label: 'maintenance'
change-template: '- $TITLE @$AUTHOR (#$NUMBER)'
template: |
## Changes
$CHANGES
110 changes: 110 additions & 0 deletions .github/workflows/createrelease.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,110 @@
name: Release

on:
release:
types: [published]

jobs:
build:
name: "Release"
env:
ASPNETCORE_ENVIRONMENT: "Production"

runs-on: ubuntu-16.04

steps:
- uses: actions/checkout@v1

- name: Get the version
id: get_version
run: echo ::set-output name=VERSION::${GITHUB_REF/refs\/tags\//}

- name: Setup .NET Core 3.0
uses: actions/setup-dotnet@v1
with:
dotnet-version: 3.0.100

- name: Restore Nuget Packages
run: dotnet restore TransactionProcessor.sln --source https://api.nuget.org/v3/index.json --source https://www.myget.org/F/transactionprocessing/api/v3/index.json

- name: Build Code
run: dotnet build TransactionProcessor.sln --configuration Release

- name: Build Docker Images
run: |
docker build . --file TransactionProcessor/Dockerfile --tag transactionprocessor:latest --tag stuartferguson/transactionprocessor:latest --tag stuartferguson/transactionprocessor:${{ steps.get_version.outputs.VERSION }}

- name: Publish Images to Docker Hub
run: |
docker login --username=${{ secrets.DOCKER_USERNAME }} --password=${{ secrets.DOCKER_PASSWORD }}
docker push stuartferguson/transactionprocessor:latest
docker push stuartferguson/transactionprocessor:${{ steps.get_version.outputs.VERSION }}

- name: Publish API
run: dotnet publish "TransactionProcessor\TransactionProcessor.csproj" --configuration Release --output publishOutput

- name: Setup .NET Core 2.0
uses: actions/setup-dotnet@v1
with:
dotnet-version: 2.0.0

- name: Extract Octopus Tools
run: |
mkdir /opt/octo
cd /opt/octo
wget -O /opt/octo/octopus.zip https://download.octopusdeploy.com/octopus-tools/6.12.0/OctopusTools.6.12.0.portable.zip
unzip /opt/octo/octopus.zip
chmod +x /opt/octo/Octo

- name: Pack Files for Octopus
run: >-
/opt/octo/Octo pack
--outFolder /home/runner/work/TransactionProcessor/TransactionProcessor
--basePath /home/runner/work/TransactionProcessor/TransactionProcessor/publishOutput
--id TransactionProcessor
--version ${{ steps.get_version.outputs.VERSION }}
--format zip
--verbose
--logLevel=verbose

- name: Push Package to Octopus
run: >-
/opt/octo/Octo push
--server http://sferguson.ddns.net:9001
--apiKey API-UTN58QCF8HSATACNUBY41XPUC
--package /home/runner/work/TransactionProcessor/TransactionProcessor/TransactionProcessor.${{ steps.get_version.outputs.VERSION }}.zip
--overwrite-mode IgnoreIfExists

- name: Get Release
id: getrelease
uses: octokit/request-action@v1.x
with:
route: GET /repos/StuartFerguson/TransactionProcessor/releases/tags/${{ steps.get_version.outputs.VERSION }}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

- name: Build Release Notes
id: buildreleasenotes
uses: gr2m/get-json-paths-action@v1.x
with:
json: ${{ steps.getrelease.outputs.data }}
releasenote: "body"

- name: Create & Deploy Release in Octopus
run: >-
/opt/octo/Octo create-release
--server http://sferguson.ddns.net:9001
--apiKey API-UTN58QCF8HSATACNUBY41XPUC
--project "Transaction Processor"
--version ${{ steps.get_version.outputs.VERSION }}
--channel Default
--deployTo Development
--waitfordeployment
--deploymenttimeout 00:05:00
--releasenotes "${{ steps.buildreleasenotes.outputs.releasenote }}"

- name: Setup .NET Core 3.0
uses: actions/setup-dotnet@v1
with:
dotnet-version: 3.0.100

30 changes: 30 additions & 0 deletions .github/workflows/nightlybuild.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
name: Nightly Build

on:
schedule:
- cron: "* 23 * * *"

jobs:
build:
name: "Nightly Build"
env:
ASPNETCORE_ENVIRONMENT: "Production"

runs-on: ubuntu-16.04

steps:
- uses: actions/checkout@v1

- name: Setup .NET Core
uses: actions/setup-dotnet@v1
with:
dotnet-version: 3.0.100

- name: Restore Nuget Packages
run: dotnet restore TransactionProcessor.sln --source https://api.nuget.org/v3/index.json --source https://www.myget.org/F/transactionprocessing/api/v3/index.json

- name: Build Code
run: dotnet build TransactionProcessor.sln --configuration Release

- name: Build Docker Image
run: docker build . --file TransactionProcessor/Dockerfile --tag transactionprocessor:latest
32 changes: 32 additions & 0 deletions .github/workflows/pullrequest.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
name: Build and Test Pull Requests

on:
pull_request:
branches:
- master

jobs:
build:
name: "Build and Test Pull Requests"
env:
ASPNETCORE_ENVIRONMENT: "Production"

runs-on: ubuntu-16.04

steps:
- uses: actions/checkout@v1

- name: Setup .NET Core
uses: actions/setup-dotnet@v1
with:
dotnet-version: 3.0.100

- name: Restore Nuget Packages
run: dotnet restore TransactionProcessor.sln --source https://api.nuget.org/v3/index.json --source https://www.myget.org/F/transactionprocessing/api/v3/index.json

- name: Build Code
run: dotnet build TransactionProcessor.sln --configuration Release

- name: Build Docker Image
run: docker build . --file TransactionProcessor/Dockerfile --tag transactionprocessor:latest

16 changes: 16 additions & 0 deletions .github/workflows/release-management.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
name: Release Management

on:
push:
# branches to consider in the event; optional, defaults to all
branches:
- master

jobs:
update_draft_release:
runs-on: ubuntu-latest
steps:
# Drafts your next Release notes as Pull Requests are merged into "master"
- uses: toolmantim/release-drafter@v5.2.0
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
*.user
*.userosscache
*.sln.docstates
*.[Dd]evelopment.json

# User-specific files (MonoDevelop/Xamarin Studio)
*.userprefs
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
namespace TransactionProcessor.BusinessLogic.CommandHandlers
{
using System.Threading;
using System.Threading.Tasks;
using Commands;
using Services;
using Shared.DomainDrivenDesign.CommandHandling;

/// <summary>
///
/// </summary>
/// <seealso cref="Shared.DomainDrivenDesign.CommandHandling.ICommandRouter" />
public class CommandRouter : ICommandRouter
{
#region Fields

/// <summary>
/// The transaction domain service
/// </summary>
private readonly ITransactionDomainService TransactionDomainService;

#endregion

#region Constructors

/// <summary>
/// Initializes a new instance of the <see cref="CommandRouter"/> class.
/// </summary>
/// <param name="transactionDomainService">The transaction domain service.</param>
public CommandRouter(ITransactionDomainService transactionDomainService)
{
this.TransactionDomainService = transactionDomainService;
}

#endregion

#region Methods

/// <summary>
/// Routes the specified command.
/// </summary>
/// <param name="command">The command.</param>
/// <param name="cancellationToken">The cancellation token.</param>
public async Task Route(ICommand command,
CancellationToken cancellationToken)
{
ICommandHandler commandHandler = CreateHandler((dynamic)command);

await commandHandler.Handle(command, cancellationToken);
}

/// <summary>
/// Creates the handler.
/// </summary>
/// <param name="command">The command.</param>
/// <returns></returns>
private ICommandHandler CreateHandler(ProcessLogonTransactionCommand command)
{
return new TransactionCommandHandler(this.TransactionDomainService);
}

#endregion
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
namespace TransactionProcessor.BusinessLogic.CommandHandlers
{
using System.Threading;
using System.Threading.Tasks;
using Commands;
using Models;
using Services;
using Shared.DomainDrivenDesign.CommandHandling;

/// <summary>
///
/// </summary>
/// <seealso cref="Shared.DomainDrivenDesign.CommandHandling.ICommandHandler" />
public class TransactionCommandHandler : ICommandHandler
{
#region Fields

/// <summary>
/// The transaction domain service
/// </summary>
private readonly ITransactionDomainService TransactionDomainService;

#endregion

#region Constructors

/// <summary>
/// Initializes a new instance of the <see cref="TransactionCommandHandler"/> class.
/// </summary>
/// <param name="transactionDomainService">The transaction domain service.</param>
public TransactionCommandHandler(ITransactionDomainService transactionDomainService)
{
this.TransactionDomainService = transactionDomainService;
}

#endregion

#region Methods

/// <summary>
/// Handles the specified command.
/// </summary>
/// <param name="command">The command.</param>
/// <param name="cancellationToken">The cancellation token.</param>
public async Task Handle(ICommand command,
CancellationToken cancellationToken)
{
await this.HandleCommand((dynamic)command, cancellationToken);
}

/// <summary>
/// Handles the command.
/// </summary>
/// <param name="command">The command.</param>
/// <param name="cancellationToken">The cancellation token.</param>
private async Task HandleCommand(ProcessLogonTransactionCommand command,
CancellationToken cancellationToken)
{
ProcessLogonTransactionResponse logonResponse = await this.TransactionDomainService.ProcessLogonTransaction(cancellationToken);

command.Response = logonResponse;
}

#endregion
}
}
Loading