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

Initial release #7

Merged
merged 17 commits into from
Jun 15, 2024
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
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:
- "*"
156 changes: 156 additions & 0 deletions .github/workflows/main.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,156 @@
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
outputs:
change_detection_src: ${{ steps.change_detection.outputs.src }}
steps:

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

- 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 - dotnet - install
if: ${{ steps.change_detection.outputs.build == 'true' }}
uses: actions/setup-dotnet@v4
with:
dotnet-version: '8.x'

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

- name: tools - gitversion - execute
if: ${{ steps.change_detection.outputs.build == 'true' }}
uses: gittools/actions/gitversion/[email protected]
with:
useConfigFile: true
configFilePath: GitVersion.yaml

- name: cache - nuget
if: ${{ steps.change_detection.outputs.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: ${{ steps.change_detection.outputs.build == 'true' }}
shell: bash
run: dotnet restore

- name: dotnet build
if: ${{ steps.change_detection.outputs.build == 'true' }}
shell: bash
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: ${{ steps.change_detection.outputs.build == 'true' }}
shell: bash
run: dotnet test --no-build --configuration Release --verbosity normal

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

- name: artifacts - nuget - gather
if: ${{ steps.change_detection.outputs.build == 'true' }}
run: |
mkdir -p .artifacts/nuget
find . -name "*.nupkg" -exec cp {} .artifacts/nuget/ \;

- name: artifacts - nuget - upload
if: ${{ steps.change_detection.outputs.build == 'true' }}
uses: actions/upload-artifact@v4
with:
name: artifacts-nuget
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/release/') ||
startsWith(github.ref, 'refs/heads/hotfix/'))

steps:

- name: artifacts - nuget - download
uses: actions/download-artifact@v4
with:
name: artifacts-nuget
path: .artifacts/nuget

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

- 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 version/v${{env.GitVersion_SemVer}}
git push version/origin v${{env.GitVersion_SemVer}}

- name: dotnet nuget add source
shell: bash
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
run: |
for pkg in .artifacts/nuget/*.nupkg; do
dotnet nuget push "$pkg" --source "github" --api-key ${{ secrets.ES_GITHUB_PAT }}
done
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>

<!-- 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
Loading