Skip to content

Commit

Permalink
INFRASTRUCTURE: Project Initialisation and Setup
Browse files Browse the repository at this point in the history
  • Loading branch information
cjdutoit committed Oct 17, 2023
1 parent 3c3bad6 commit 338fdbb
Show file tree
Hide file tree
Showing 14 changed files with 524 additions and 36 deletions.
14 changes: 14 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
# Remove the line below if you want to inherit .editorconfig settings from higher directories

# C# or VB files
[*.{cs,vb,ts,tsx}]
guidelines = 120

#### Core EditorConfig Options ####

#Formatting - header template
file_header_template = ---------------------------------------------------------------\nCopyright (c) North East London ICB. All rights reserved.\n---------------------------------------------------------------

#sort System.* using directives alphabetically, and place them before other usings
dotnet_sort_system_directives_first = true

63 changes: 63 additions & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
###############################################################################
# Set default behavior to automatically normalize line endings.
###############################################################################
* text=auto

###############################################################################
# Set default behavior for command prompt diff.
#
# This is need for earlier builds of msysgit that does not have it on by
# default for csharp files.
# Note: This is only used by command line
###############################################################################
#*.cs diff=csharp

###############################################################################
# Set the merge driver for project and solution files
#
# Merging from the command prompt will add diff markers to the files if there
# are conflicts (Merging from VS is not affected by the settings below, in VS
# the diff markers are never inserted). Diff markers may cause the following
# file extensions to fail to load in VS. An alternative would be to treat
# these files as binary and thus will always conflict and require user
# intervention with every merge. To do so, just uncomment the entries below
###############################################################################
#*.sln merge=binary
#*.csproj merge=binary
#*.vbproj merge=binary
#*.vcxproj merge=binary
#*.vcproj merge=binary
#*.dbproj merge=binary
#*.fsproj merge=binary
#*.lsproj merge=binary
#*.wixproj merge=binary
#*.modelproj merge=binary
#*.sqlproj merge=binary
#*.wwaproj merge=binary

###############################################################################
# behavior for image files
#
# image files are treated as binary by default.
###############################################################################
#*.jpg binary
#*.png binary
#*.gif binary

###############################################################################
# diff behavior for common document formats
#
# Convert binary document formats to text before diffing them. This feature
# is only available from the command line. Turn it on by uncommenting the
# entries below.
###############################################################################
#*.doc diff=astextplain
#*.DOC diff=astextplain
#*.docx diff=astextplain
#*.DOCX diff=astextplain
#*.dot diff=astextplain
#*.DOT diff=astextplain
#*.pdf diff=astextplain
#*.PDF diff=astextplain
#*.rtf diff=astextplain
#*.RTF diff=astextplain
15 changes: 15 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
# To get started with Dependabot version updates, you'll need to specify which
# package ecosystems to update and where the package manifests are located.
# Please see the documentation for all configuration options:
# https://docs.github.com/github/administering-a-repository/configuration-options-for-dependency-updates

version: 2
updates:
- package-ecosystem: "nuget" # See documentation for possible values
directory: "/" # Location of package manifests
schedule:
interval: "weekly"
commit-message:
prefix: "CONFIG"
labels:
- "dependencies"
114 changes: 114 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,114 @@
name: Build
on:
push:
branches:
- main
pull_request:
types:
- opened
- synchronize
- reopened
- closed
branches:
- main
env:
IS_RELEASE_CANDIDATE: >-
${{
(
github.event_name == 'pull_request' &&
startsWith(github.event.pull_request.title, 'RELEASES:') &&
contains(github.event.pull_request.labels.*.name, 'RELEASES')
)
||
(
github.event_name == 'push' &&
startsWith(github.event.head_commit.message, 'RELEASES:') &&
github.ref_name == 'RELEASE'
)
}}
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Check Out
uses: actions/checkout@v3
- name: Setup Dot Net Version
uses: actions/setup-dotnet@v3
with:
dotnet-version: 7.0.201
- name: Restore
run: dotnet restore
- name: Build
run: dotnet build --no-restore
- name: Test
run: dotnet test --no-build --verbosity normal
add_tag:
runs-on: ubuntu-latest
needs:
- build
if: >
needs.build.result == 'success' &&
github.event.pull_request.merged &&
github.event.pull_request.base.ref == 'main' &&
startsWith(github.event.pull_request.title, 'RELEASES:') &&
contains(github.event.pull_request.labels.*.name, 'RELEASES')
steps:
- name: Checkout code
uses: actions/checkout@v3
- name: Extract Version Number
id: extract_version
run: |-
echo "version_number=$(grep -oP '(?<=<Version>)[^<]+' NEL.LibPostalClient.Infrastructure/NEL.LibPostalClient.Infrastructure.csproj)" >> $GITHUB_OUTPUT
echo "package_release_notes=$(grep -oP '(?<=<PackageReleaseNotes>)[^<]+' NEL.MESH/NEL.MESH.csproj)" >> $GITHUB_OUTPUT
- name: Print Version Number
run: |-
echo "Release version - ${{ steps.extract_version.outputs.version_number }}"
echo "Release notes - ${{ steps.extract_version.outputs.package_release_notes }}"
- name: Configure Git
run: |-
git config user.name "GitHub Action"
git config user.email "action@github.com"
- name: Authenticate with GitHub
uses: actions/checkout@v3
with:
token: ${{ secrets.PAT_FOR_TAGGING }}
- name: Add Release Tag
run: |-
git tag -a "v${{ steps.extract_version.outputs.version_number }}" -m "Release - v${{ steps.extract_version.outputs.version_number }}"
git push origin --tags
- name: Create release
id: create_release
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.PAT_FOR_TAGGING }}
with:
tag_name: "v${{ steps.extract_version.outputs.version_number }}"
release_name: "Release - v${{ steps.extract_version.outputs.version_number }}"
body: |
### Release - v${{ steps.extract_version.outputs.version_number }}
#### Release Notes
${{ steps.extract_version.outputs.package_release_notes }}
publish:
runs-on: ubuntu-latest
needs:
- add_tag
if: needs.add_tag.result == 'success'
steps:
- name: Check out
uses: actions/checkout@v3
- name: Setup .Net
uses: actions/setup-dotnet@v3
with:
dotnet-version: 7.0.201
- name: Restore
run: dotnet restore
- name: Build Release
run: dotnet build --no-restore --configuration Release
- name: Pack Nuget
run: dotnet pack --configuration Release
env:
NUGET_KEY: ${{ secrets.NUGET_API_KEY }}
- name: Release Task
run:
dotnet nuget push **/bin/Release/**/*.nupkg --source https://api.nuget.org/v3/index.json --api-key ${{ secrets.NUGET_API_KEY }}
49 changes: 13 additions & 36 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,14 +1,18 @@
## Ignore Visual Studio temporary files, build results, and
## files generated by popular Visual Studio add-ons.
##
## Get latest from https://github.com/github/gitignore/blob/main/VisualStudio.gitignore
## Get latest from https://github.com/github/gitignore/blob/master/VisualStudio.gitignore

# User-specific files
*.rsuser
*.suo
*.user
*.userosscache
*.sln.docstates
*.mp4

# Local Configuration Files
local.settings.json

# User-specific files (MonoDevelop/Xamarin Studio)
*.userprefs
Expand Down Expand Up @@ -90,7 +94,6 @@ StyleCopReport.xml
*.tmp_proj
*_wpftmp.csproj
*.log
*.tlog
*.vspscc
*.vssscc
.builds
Expand Down Expand Up @@ -294,17 +297,6 @@ node_modules/
# Visual Studio 6 auto-generated workspace file (contains which files were open etc.)
*.vbw

# Visual Studio 6 auto-generated project file (contains which files were open etc.)
*.vbp

# Visual Studio 6 workspace and project file (working project files containing files to include in project)
*.dsw
*.dsp

# Visual Studio 6 technical files
*.ncb
*.aps

# Visual Studio LightSwitch build output
**/*.HTMLClient/GeneratedArtifacts
**/*.DesktopClient/GeneratedArtifacts
Expand Down Expand Up @@ -361,9 +353,6 @@ ASALocalRun/
# Local History for Visual Studio
.localhistory/

# Visual Studio History (VSHistory) files
.vshistory/

# BeatPulse healthcheck temp database
healthchecksdb

Expand All @@ -376,23 +365,11 @@ MigrationBackup/
# Fody - auto-generated XML schema
FodyWeavers.xsd

# VS Code files for those working on multiple tools
.vscode/*
!.vscode/settings.json
!.vscode/tasks.json
!.vscode/launch.json
!.vscode/extensions.json
*.code-workspace

# Local History for Visual Studio Code
.history/

# Windows Installer files from build outputs
*.cab
*.msi
*.msix
*.msm
*.msp

# JetBrains Rider
*.sln.iml
# Local Settings
local.settings.json
local.appsettings.json
*/local.settings.json
*/local.appsettings.json
/NEL.MESH.Tests.Acceptance/local.appsettings.integration.json
/NEL.MESH.Tests.Integration/local.appsettings.integration.json
/NEL.MESH.Tests.Integration/local.appsettings.acceptance.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFramework>net7.0</TargetFramework>
<ImplicitUsings>disable</ImplicitUsings>
<Nullable>enable</Nullable>
<IsPackable>false</IsPackable>
<IsTestProject>true</IsTestProject>
<Configurations>Debug;Release;Test;Acceptance</Configurations>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="CompareNETObjects" Version="4.79.0" />
<PackageReference Include="DeepCloner" Version="0.10.4" />
<PackageReference Include="FluentAssertions" Version="6.10.0" />
<PackageReference Include="Microsoft.Extensions.Configuration" Version="7.0.0" />
<PackageReference Include="Microsoft.Extensions.Configuration.Json" Version="7.0.0" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.5.0" />
<PackageReference Include="Moq" Version="4.18.4" />
<PackageReference Include="Tynamix.ObjectFiller" Version="1.5.8" />
<PackageReference Include="Xeption" Version="2.5.0" />
<PackageReference Include="xunit" Version="2.4.2" />
<PackageReference Include="xunit.runner.visualstudio" Version="2.4.5">
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
<PrivateAssets>all</PrivateAssets>
</PackageReference>
<PackageReference Include="coverlet.collector" Version="3.2.0">
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
<PrivateAssets>all</PrivateAssets>
</PackageReference>
</ItemGroup>

<ItemGroup>
<ProjectReference Include="..\NEL.LibPostalClient\NEL.LibPostalClient.csproj" />
</ItemGroup>

<ItemGroup>
<None Update="local.appsettings.json">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</None>
</ItemGroup>


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

<PropertyGroup>
<TargetFramework>net7.0</TargetFramework>
<ImplicitUsings>disable</ImplicitUsings>
<Nullable>enable</Nullable>
<IsPackable>false</IsPackable>
<IsTestProject>true</IsTestProject>
<Configurations>Debug;Release;Test;Acceptance</Configurations>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="CompareNETObjects" Version="4.79.0" />
<PackageReference Include="DeepCloner" Version="0.10.4" />
<PackageReference Include="FluentAssertions" Version="6.10.0" />
<PackageReference Include="Microsoft.Extensions.Configuration" Version="7.0.0" />
<PackageReference Include="Microsoft.Extensions.Configuration.Json" Version="7.0.0" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.5.0" />
<PackageReference Include="Moq" Version="4.18.4" />
<PackageReference Include="Tynamix.ObjectFiller" Version="1.5.8" />
<PackageReference Include="Xeption" Version="2.5.0" />
<PackageReference Include="xunit" Version="2.4.2" />
<PackageReference Include="xunit.runner.visualstudio" Version="2.4.5">
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
<PrivateAssets>all</PrivateAssets>
</PackageReference>
<PackageReference Include="coverlet.collector" Version="3.2.0">
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
<PrivateAssets>all</PrivateAssets>
</PackageReference>
</ItemGroup>

<ItemGroup>
<ProjectReference Include="..\NEL.LibPostalClient\NEL.LibPostalClient.csproj" />
</ItemGroup>

<ItemGroup>
<None Update="local.appsettings.json">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</None>
</ItemGroup>

</Project>
Loading

0 comments on commit 338fdbb

Please sign in to comment.