Skip to content

Commit

Permalink
Initial implementation (#1)
Browse files Browse the repository at this point in the history
Initial solution and tests
  • Loading branch information
winromulus committed Jun 15, 2024
1 parent a3ca865 commit f26be7b
Show file tree
Hide file tree
Showing 111 changed files with 4,274 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/**
60 changes: 60 additions & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
# Set default behavior to automatically normalize line endings.
* text=auto

# Collapse these files in PRs by default
*.xlf linguist-generated=true
*.lcl linguist-generated=true

*.jpg binary
*.png binary
*.gif binary

# Force bash scripts to always use lf line endings so that if a repo is accessed
# in Unix via a file share from Windows, the scripts will work.
*.in text eol=lf
*.sh text eol=lf

# Likewise, force cmd and batch scripts to always use crlf
*.cmd text eol=crlf
*.bat text eol=crlf

*.cs text=auto diff=csharp
*.vb text=auto
*.resx text=auto
*.c text=auto
*.cpp text=auto
*.cxx text=auto
*.h text=auto
*.hxx text=auto
*.py text=auto
*.rb text=auto
*.java text=auto
*.html text=auto
*.htm text=auto
*.css text=auto
*.scss text=auto
*.sass text=auto
*.less text=auto
*.js text=auto
*.lisp text=auto
*.clj text=auto
*.sql text=auto
*.php text=auto
*.lua text=auto
*.m text=auto
*.asm text=auto
*.erl text=auto
*.fs text=auto
*.fsx text=auto
*.hs text=auto

*.csproj text=auto
*.vbproj text=auto
*.fsproj text=auto
*.dbproj text=auto
*.sln text=auto eol=crlf

# Set linguist language for .h files explicitly based on
# https://github.com/github/linguist/issues/1626#issuecomment-401442069
# this only affects the repo's language statistics
*.h linguist-language=C
30 changes: 30 additions & 0 deletions .github/dependabot.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
version: 2
registries:
public-nuget:
type: nuget-feed
url: https://api.nuget.org/v3/index.json
updates:
- package-ecosystem: nuget
directory: "/"
registries:
- public-nuget
schedule:
interval: daily
open-pull-requests-limit: 15
labels:
- "area-dependencies"
groups:
all-dependencies:
patterns:
- "*"
- package-ecosystem: "github-actions"
directory: "/"
schedule:
interval: daily
open-pull-requests-limit: 5
labels:
- "area-dependencies"
groups:
all-dependencies:
patterns:
- "*"
159 changes: 159 additions & 0 deletions .github/workflows/main.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,159 @@
name: Main Workflow

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

jobs:
ci:
name: CI
runs-on: ubuntu-latest
permissions:
pull-requests: read
id-token: write
contents: read
checks: write
env:
build: false
outputs:
change_detection_src: ${{ steps.change_detection.outputs.src }}
build: ${{ env.build }}
semVer: ${{env.GitVersion_SemVer}}
steps:

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

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

- name: tools - gitversion - install
uses: gittools/actions/gitversion/[email protected]
with:
versionSpec: '5.x'
preferLatestVersion: true

- name: tools - gitversion - execute
uses: gittools/actions/gitversion/[email protected]
with:
useConfigFile: true
configFilePath: GitVersion.yaml

- name: tools - detect changes
id: change_detection
uses: dorny/paths-filter@v3
with:
base: ${{ github.ref }}
filters: |
src:
- 'src/**'
- 'ES.FX.sln'
- 'Directory.Build.props'
build:
- 'src/**'
- 'playground/**'
- 'tests/**'
- 'ES.FX.sln'
- 'Directory.Build.props'
- name: tools - evaluate build flag
if: steps.change_detection.outputs.build == 'true' ||
github.event_name == 'pull_request'
run: echo "build=true" >> $GITHUB_ENV


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

- name: dotnet build
if: ${{ env.build == 'true' }}
run: dotnet build --no-restore --configuration Release /p:Version=${{env.GitVersion_SemVer}} /p:AssemblyVersion=${{env.GitVersion_AssemblySemFileVer}} /p:NuGetVersion=${{env.GitVersion_SemVer}}

- name: dotnet test
if: ${{ env.build == 'true' }}
run: dotnet test --no-build --configuration Release --verbosity normal

- name: test-reporter
uses: dorny/test-reporter@v1
if: ${{ env.build == 'true' }}
with:
name: Test Results
path: .artifacts/TestResults/*.trx
reporter: dotnet-trx

- name: artifacts - nuget - gather
if: ${{ env.build == 'true' }}
run: |
mkdir -p .artifacts/nuget
find . -name "*.nupkg" -exec cp {} .artifacts/nuget/ \;
- name: artifacts - nuget - upload
if: ${{ env.build == 'true' }}
uses: actions/upload-artifact@v4
with:
name: artifacts-nuget-${{env.GitVersion_SemVer}}
path: .artifacts/nuget/*.nupkg

cd:
name: CD
runs-on: ubuntu-latest
needs: ci
if: >
needs.ci.outputs.change_detection_src == 'true' &&
github.event.workflow_run.conclusion == 'success' &&
github.event.workflow_run.event == 'push' &&
(github.ref == 'refs/heads/main' ||
github.ref == 'refs/heads/develop' ||
startsWith(github.ref, 'refs/heads/feature/') ||
startsWith(github.ref, 'refs/heads/releases/') ||
startsWith(github.ref, 'refs/heads/hotfix/'))
env:
build: ${{ needs.ci.outputs.build }}
semVer: ${{ needs.ci.outputs.semVer }}
changes_src: ${{ needs.ci.outputs.change_detection_src }}
steps:
- name: artifacts - nuget - download
uses: actions/download-artifact@v4
with:
name: artifacts-nuget-${{env.semVer}}
path: .artifacts/nuget

- name: dotnet nuget add source
if: ${{ env.changes_src == 'true' }}
run: dotnet nuget add source --username USERNAME --password ${{ secrets.GITHUB_TOKEN }} --store-password-in-clear-text --name github "https://nuget.pkg.github.com/emberstack/index.json"

- name: dotnet nuget push
if: ${{ env.changes_src == 'true' }}
run: |
for pkg in .artifacts/nuget/*.nupkg; do
dotnet nuget push "$pkg" --source "github" --api-key ${{ secrets.ES_GITHUB_PAT }}
done
- name: checkout
uses: actions/checkout@v4
with:
fetch-depth: 0

- name: git - tag
if: ${{ env.changes_src == 'true' }}
run: |
git config --global user.name 'github-actions'
git config --global user.email '[email protected]'
git tag version/v${{env.GitVersion_SemVer}}
git push version/origin v${{env.GitVersion_SemVer}}
44 changes: 44 additions & 0 deletions Directory.Build.props
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
<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>
<!-- Don't warn about "A stable release of a package should not have a prerelease dependency." -->
<NoWarn>$(NoWarn);NU5104</NoWarn>
</PropertyGroup>

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

<!-- ES.FX Projects should build packages -->
<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 f26be7b

Please sign in to comment.