Skip to content

Commit

Permalink
Initial implementation
Browse files Browse the repository at this point in the history
Initial solution and tests
  • Loading branch information
winromulus committed Jun 13, 2024
1 parent a3ca865 commit 450b60b
Show file tree
Hide file tree
Showing 100 changed files with 3,447 additions and 0 deletions.
30 changes: 30 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
**/.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
!**/.gitignore
!.git/HEAD
!.git/config
!.git/packed-refs
!.git/refs/heads/**
57 changes: 57 additions & 0 deletions .github/actions/build/action.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
name: Build
description: 'Build steps'
inputs:
useVersioning:
description: 'Apply versioning to the build'
required: true
default: 'false'
configuration:
description: 'Build configuration'
required: true
default: 'Debug'
runs:
using: 'composite'
steps:


- name: tools - dotnet - install
uses: actions/setup-dotnet@v4
with:
dotnet-version: '8.x'

- name: tools - gitversion - install
if: ${{ inputs.useVersioning == 'true' }}
uses: gittools/actions/gitversion/[email protected]
with:
versionSpec: '5.x'
preferLatestVersion: true

- name: tools - gitversion - execute
if: ${{ inputs.useVersioning == 'true' }}
uses: gittools/actions/gitversion/[email protected]
# with:
# useConfigFile: true
# configFilePath: GitVersion.yaml

- name: cache - nuget
uses: actions/cache@v4
with:
path: ~/.nuget/packages
key: ${{ runner.os }}-nuget-${{ hashFiles('**/*.csproj') }}
restore-keys: |
${{ runner.os }}-nuget-
- name: dotnet restore
shell: bash
run: dotnet restore


- name: dotnet build
if: ${{ inputs.useVersioning != 'true' }}
shell: bash
run: dotnet build --no-restore --configuration ${{ inputs.configuration }}

- name: dotnet build
if: ${{ inputs.useVersioning == 'true' }}
shell: bash
run: dotnet build --no-restore --configuration ${{ inputs.configuration }} /p:Version=${{env.GitVersion_SemVer}} /p:AssemblyVersion=${{env.GitVersion_AssemblySemFileVer}} /p:NuGetVersion=${{env.GitVersion_SemVer}}
16 changes: 16 additions & 0 deletions .github/actions/test/action.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
name: Test
description: 'Test steps'
runs:
using: 'composite'
steps:
- name: dotnet test
shell: bash
run: dotnet test --no-build --verbosity normal

- name: test-reporter
uses: dorny/test-reporter@v1
if: always()
with:
name: Test Results
path: .artifacts/TestResults/*.trx
reporter: dotnet-trx
74 changes: 74 additions & 0 deletions .github/workflows/main.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
name: Main

on:
push:
branches:
- '**' # Matches all branches

jobs:
ci:
name: CI
runs-on: ubuntu-latest
steps:

- name: checkout
uses: actions/checkout@v4
with:
fetch-depth: 1

- name: build
uses: ./.github/actions/build
with:
configuration: Debug
useVersioning: false

- name: test
uses: ./.github/actions/test

cd:
name: CD
needs: ci
runs-on: ubuntu-latest
if: >
github.ref == 'refs/heads/main' ||
github.ref == 'refs/heads/develop' ||
startsWith(github.ref, 'refs/heads/feature/') ||
startsWith(github.ref, 'refs/heads/release/') ||
startsWith(github.ref, 'refs/heads/hotfix/')
steps:
- name: checkout
uses: actions/checkout@v4
with:
fetch-depth: 0

- name: build
uses: ./.github/actions/build
with:
configuration: Release
useVersioning: true

- name: artifacts - nuget - gather
run: |
mkdir -p .artifacts/nuget
find . -name "*.nupkg" -exec cp {} .artifacts/nuget/ \;
- name: artifacts - nuget - upload
uses: actions/upload-artifact@v4
with:
name: artifacts-nuget
path: .artifacts/nuget/*.nupkg

- name: git - tag
if: >
github.ref == 'refs/heads/main' ||
startsWith(github.ref, 'refs/heads/release/') ||
startsWith(github.ref, 'refs/heads/hotfix/')
run: |
git config --global user.name 'github-actions'
git config --global user.email '[email protected]'
git tag ${{env.GitVersion_SemVer}}
git push origin ${{env.GitVersion_SemVer}}
24 changes: 24 additions & 0 deletions .github/workflows/pr.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
name: Pull Request

on:
pull_request:

jobs:
ci:
name: CI - Build and Test
runs-on: ubuntu-latest
steps:

- name: checkout
uses: actions/checkout@v4
with:
fetch-depth: 1

- name: build
uses: ./.github/actions/build
with:
configuration: Debug
useVersioning: false

- name: test
uses: ./.github/actions/test
43 changes: 43 additions & 0 deletions Directory.Build.props
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
<Project>
<PropertyGroup>
<TreatWarningsAsErrors>true</TreatWarningsAsErrors>
<Nullable>enable</Nullable>
<ImplicitUsings>enable</ImplicitUsings>
<!--Generate debug symbols and embed them in the build output.-->
<DebugType>embedded</DebugType>
<DebugSymbols>true</DebugSymbols>
<!--Set the solution directory to the parent directory of the build file.-->
<SolutionDir Condition="'$(SolutionDir)' == ''">$(MSBuildThisFileDirectory)..\</SolutionDir>
</PropertyGroup>
<PropertyGroup>
<PackageOutputDir>$(SolutionDir).artifacts/nuget</PackageOutputDir>
<Authors>emberstack</Authors>
<Company>EmberStack</Company>
<RepositoryUrl>https://github.com/emberstack/ES.FX</RepositoryUrl>
<PackageLicenseExpression>MIT</PackageLicenseExpression>
<!--<PackageOutputPath>$(PackageOutputDir)</PackageOutputPath>-->
</PropertyGroup>

<PropertyGroup>
<NoWarn>$(NoWarn);NU5104</NoWarn>
</PropertyGroup>

<PropertyGroup>
<!-- Default to false; specific projects will override to true -->
<GeneratePackageOnBuild>false</GeneratePackageOnBuild>
</PropertyGroup>

<PropertyGroup Condition="'$(MSBuildProjectName)' == '' Or $(MSBuildProjectName.StartsWith('ES.FX'))">
<GeneratePackageOnBuild>true</GeneratePackageOnBuild>
</PropertyGroup>

<!--Test projects-->
<ItemGroup Condition="'$(MSBuildProjectName)' == '' Or $(MSBuildProjectName.EndsWith('.Tests'))">
<AssemblyAttribute Include="System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverageAttribute" />
</ItemGroup>
<PropertyGroup Condition="'$(MSBuildProjectName)' == '' Or $(MSBuildProjectName.EndsWith('.Tests'))">
<VSTestLogger>trx%3bLogFileName=$(MSBuildProjectName).trx</VSTestLogger>
<VSTestResultsDirectory>$(MSBuildThisFileDirectory)/.artifacts/TestResults</VSTestResultsDirectory>
</PropertyGroup>
</Project>

Loading

0 comments on commit 450b60b

Please sign in to comment.