Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

MTTL 1117 #1

Open
wants to merge 20 commits into
base: main
Choose a base branch
from
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
45 changes: 45 additions & 0 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
name: publish-nuget-package
on:
push:
branches:
- main
- feature/**

jobs:
calculate-version:
name: Calculate Version
runs-on: ubuntu-latest
outputs:
version: ${{ steps.gitversion.outputs.nuGetVersionV2 }}
steps:
- name: Checkout
uses: actions/checkout@v2
with:
fetch-depth: 0
- name: Install GitVersion
uses: gittools/actions/gitversion/[email protected]
with:
versionSpec: '5.x'
- name: Determine package version
id: gitversion
uses: gittools/actions/gitversion/[email protected]
with:
useConfigFile: true
- name: Display package version
run: |
echo "Version: $GITVERSION_NUGETVERSIONV2"
publish-package:
name: Publish Package
runs-on: ubuntu-latest
needs: calculate-version
env:
VERSION: ${{ needs.calculate-version.outputs.version }}
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Build the Package
run: dotnet pack Hackney.Shared.ContactDetails -p:PackageVersion=$VERSION --configuration Release
- name: Publish the Package
run: |
cd Hackney.Shared.ContactDetails/bin/Release
dotnet nuget push Hackney.Shared.ContactDetails.*.nupkg -s https://nuget.pkg.github.com/LBHackney-IT/index.json --api-key ${{secrets.NUGET_KEY }}
68 changes: 68 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
#Junk Files
*.DS_Store
[Tt]humbs.db

#Visual Studio Files
[Oo]bj
[Bb]in
[Dd]ebug
[Bb]uild/
*.user
*.suo
*.exe
*.pdb
*.aps
*_i.c
*_p.c
*.ncb
*.tlb
*.tlh
*.[Cc]ache
*.bak
*.ncb
*.ilk
*.log
*.lib
*.sbr
*.sdf
ipch/
*.dbmdl
*.csproj.user
*.cache
*.swp
*.vspscc
*.vssscc
*.bak.*
*.bak

#Tools
_ReSharper.*
_ReSharper*/
*.resharper
*.resharper.user
[Nn][Dd]epend[Oo]ut*/
Ankh.NoLoad

#Other
.svn

# Include DLLs if they're in the NuGet packages directory
!/packages/*/lib/*.dll
!/packages/*/lib/*/*.dll

# Ignore master key for decrypting credentials and more.
/config/master.key

obj/
out/
bin/
.idea/
tmp/
.vs/
/Hackney.Shared.ContactDetails.Tests/Properties/launchSettings.json

.fake
.ionide

*.nupkg
testresults/
8 changes: 8 additions & 0 deletions CODEOWNERS
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
# doc for this file https://help.github.com/articles/about-code-owners/

# These owners will be the default owners for everything in
# the repo. Unless a later match takes precedence,
# @global-owner1 and @global-owner2 will be requested for
# review when someone opens a pull request.

* @LBHMGeorgieva @LBHMKeyworth @LBHSPreston @LBHRShetty @mtfh-manage-my-home
23 changes: 23 additions & 0 deletions GitVersion.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
assembly-versioning-scheme: MajorMinorPatch
mode: Mainline
branches:
master:
regex: ^master$|^main$
tag: ''
increment: Minor
prevent-increment-of-merged-branch-version: true
track-merge-target: false
tracks-release-branches: false
is-source-branch-for: ['feature']
is-release-branch: false
feature:
tag: preview
increment: Inherit
source-branches: ['master', 'main']
prevent-increment-of-merged-branch-version: false
track-merge-target: false
tracks-release-branches: false
is-release-branch: false
ignore:
sha: []
merge-message-formats: {}
21 changes: 21 additions & 0 deletions Hackney.Shared.ContactDetails.Tests/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
FROM mcr.microsoft.com/dotnet/core/sdk:3.1

# disable microsoft telematry
ENV DOTNET_CLI_TELEMETRY_OPTOUT = 'true'

WORKDIR /app

# Copy csproj and restore as distinct layers
COPY ./Hackney.Shared.ContactDetails.sln./
COPY./Hackney.Shared.ContactDetails/Hackney.Shared.ContactDetails.csproj./Hackney.Shared.ContactDetails/
COPY./Hackney.Shared.ContactDetails.Tests/Hackney.Shared.ContactDetails.Tests.csproj./Hackney.Shared.ContactDetails.Tests/

RUN dotnet restore./Hackney.Shared.ContactDetails/Hackney.Shared.ContactDetails.csproj
RUN dotnet restore ./Hackney.Shared.ContactDetails.Tests/Hackney.Shared.ContactDetails.Tests.csproj

# Copy everything else and build
COPY . .

RUN dotnet build -c debug -o out Hackney.Shared.ContactDetails.Tests/Hackney.Shared.ContactDetails.Tests.csproj

CMD dotnet test
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFramework>netcoreapp3.1</TargetFramework>

<IsPackable>false</IsPackable>
<NoWarn>CA1303;CA1305;CA1001;CA1062;CA1307</NoWarn>
</PropertyGroup>

<ItemGroup>
<Compile Remove="TestResults\**" />
<EmbeddedResource Remove="TestResults\**" />
<None Remove="TestResults\**" />
</ItemGroup>

<ItemGroup>
<None Remove="Dockerfile" />
</ItemGroup>

<ItemGroup>
<Compile Include="Dockerfile" />
</ItemGroup>

<ItemGroup>
<PackageReference Include="AutoFixture" Version="4.17.0" />
<PackageReference Include="coverlet.collector" Version="1.2.0" />
<PackageReference Include="coverlet.msbuild" Version="3.0.3">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers</IncludeAssets>
</PackageReference>
<PackageReference Include="FluentAssertions" Version="5.10.3" />
<PackageReference Include="Microsoft.CodeAnalysis.FxCopAnalyzers" Version="3.0.0" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="16.5.0" />
<PackageReference Include="Moq" Version="4.16.1" />
<PackageReference Include="xunit" Version="2.4.0" />
<PackageReference Include="xunit.runner.visualstudio" Version="2.4.0" />
</ItemGroup>

<ItemGroup>
<ProjectReference Include="..\Hackney.Shared.ContactDetails\Hackney.Shared.ContactDetails.csproj" />
</ItemGroup>

</Project>
41 changes: 41 additions & 0 deletions Hackney.Shared.ContactDetails.sln
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio Version 16
VisualStudioVersion = 16.0.31205.134
MinimumVisualStudioVersion = 10.0.40219.1
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Hackney.Shared.ContactDetails", "Hackney.Shared.ContactDetails\Hackney.Shared.ContactDetails.csproj", "{80E95461-42B3-4719-B820-DF96B45D43D5}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "circleci", "circleci", "{0A55072D-69E0-4564-ABB5-98D0F015B2B1}"
ProjectSection(SolutionItems) = preProject
.circleci\config.yml = .circleci\config.yml
EndProjectSection
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Hackney.Shared.ContactDetails.Tests", "Hackney.Shared.ContactDetails.Tests\Hackney.Shared.ContactDetails.Tests.csproj", "{DEF1BB30-0394-40D8-8FA8-C0CCCC468C2E}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{5DA9B664-ED4E-4C15-AB14-D4330FAE6ABD}"
ProjectSection(SolutionItems) = preProject
nuget.config = nuget.config
README.md = README.md
EndProjectSection
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Release|Any CPU = Release|Any CPU
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{80E95461-42B3-4719-B820-DF96B45D43D5}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{80E95461-42B3-4719-B820-DF96B45D43D5}.Debug|Any CPU.Build.0 = Debug|Any CPU
{80E95461-42B3-4719-B820-DF96B45D43D5}.Release|Any CPU.ActiveCfg = Release|Any CPU
{80E95461-42B3-4719-B820-DF96B45D43D5}.Release|Any CPU.Build.0 = Release|Any CPU
{DEF1BB30-0394-40D8-8FA8-C0CCCC468C2E}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{DEF1BB30-0394-40D8-8FA8-C0CCCC468C2E}.Debug|Any CPU.Build.0 = Debug|Any CPU
{DEF1BB30-0394-40D8-8FA8-C0CCCC468C2E}.Release|Any CPU.ActiveCfg = Release|Any CPU
{DEF1BB30-0394-40D8-8FA8-C0CCCC468C2E}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {FCCBF31A-6CF1-4F17-B2FB-BFC803B3155D}
EndGlobalSection
EndGlobal
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
namespace Hackney.Shared.ContactDetails.Sns
{
public static class ContactDetailsConstants
{
public const string CREATED = "ContactDetailAddedEvent";
public const string DELETED = "ContactDetailDeletedEvent";
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>netstandard2.1</TargetFramework>
<RepositoryUrl>https://github.com/LBHackney-IT/contact-details-shared</RepositoryUrl>
<Version>1.0.3</Version>
<Authors>London Borough of Hackney</Authors>
<Company>London Borough of Hackney</Company>
<Copyright>2021</Copyright>
<Description>Shared Library for Contact Details service</Description>
<GeneratePackageOnBuild>false</GeneratePackageOnBuild>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="AWSSDK.SimpleNotificationService" Version="3.7.2.7" />
<PackageReference Include="System.Text.Json" Version="5.0.2" />

</ItemGroup>
</Project>
13 changes: 13 additions & 0 deletions Hackney.Shared.ContactDetails/NuGet.config
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<packageSources>
<clear />
<add key="github" value="https://api.nuget.org/v3/index.json" />
</packageSources>
<packageSourceCredentials>
<github>
<add key="Username" value="%USERNAME%" />
<add key="ClearTextPassword" value= "%NUGET_KEY%" />
</github>
</packageSourceCredentials>
</configuration>
35 changes: 34 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1 +1,34 @@
# Hackney.Shared.ContactDetails
# Hackney.Shared.ContactDetails
At Hackney, we have created the NuGet Package to prevent the duplication of common code when implementing our APIs.
Hence this NuGet package will store the shared contact details code that can then be used in the relevant projects.

#### CircleCI Pipeline - Versioning
At present the pipeline does not automatically update the package version number.

**This means that for the NuGet Push command to work when code is merged to the release branch
you must change the version number in the .csproj file according to the type of change you are making.**

The new version number should use the following format.

A specific version number is in the form Major.Minor.Patch[-Suffix], where the components have the following meanings:

Major: Breaking changes
Minor: New features, but backward compatible
Patch: Backwards compatible bug fixes only
Suffix (optional): a hyphen followed by a string denoting a pre-release version

## Using the package
For full details on how to use the package(s) within this repository please read
[this wiki page](https://github.com/LBHackney-IT/lbh-core/wiki/Using-the-package(s)-from-the-Hackney.Core-repository).

## Features

The following features are implemented within this package.
* [Sns](#Sns)
* [Sns Gateway](#Sns-Gateway)

### Sns
#### Sns Gateway
The `SnsGateway` implementation of the `ISnsGateway` interface allows the easy publishing of an event message to an Sns topic.
The `ISnsGateway` interface is made available by using the `AddSnsGateway()` extension method during your application start-up.

9 changes: 9 additions & 0 deletions docker-compose.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
version: "3.2"

services:

hackney-shared-contact-details-test:
image: hackney-shared-contact-details-test
build:
context: .
dockerfile: Hackney.Shared.ContactDetails.Tests/Dockerfile
26 changes: 26 additions & 0 deletions pull_request_template.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
## Link to JIRA ticket

Add a link to the JIRA ticket that the changes in this PR describe.

## Describe this PR

### *What is the problem we're trying to solve*

Add a summary of the problem and any additional context that helps explain what the issue we're trying to solve is.

### *What changes have we introduced*

Add descriptions of what changes were made to address the problem and provide a solution.

Include any links to commits that introduce significant additions of code if they help explain the process of coming to the solution. e.g Addition of test database setup, addition of first test and production class, removal of buggy code, etc.

#### _Checklist_

- [ ] Added tests to cover all new production code
- [ ] Added comments to the README or updated relevant documentation _(add link to documentation)_, where necessary.
- [ ] Checked all code for possible refactoring
- [ ] Code pipeline builds correctly

### *Follow up actions after merging PR*

Are there any next steps that need to addressed after merging this PR? Add them here.