feat(monad): add implicit conversions and sample project #35
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: CI for FluentUtils | |
on: | |
workflow_dispatch: | |
push: | |
branches: | |
- main | |
paths: | |
- "src/**" | |
- "!**/*.md" | |
jobs: | |
build-and-test: | |
name: Build solution and run tests | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v4 | |
- name: Setup .NET Core latest | |
uses: actions/setup-dotnet@v4 | |
with: | |
source-url: https://nuget.pkg.github.com/draekien/index.json | |
dotnet-version: "8.0.x" | |
env: | |
NUGET_AUTH_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
- name: Install dependencies | |
run: dotnet restore | |
- name: Build solution | |
run: dotnet build --configuration Release --no-restore | |
- name: Run all tests | |
run: dotnet test --no-restore --verbosity normal /p:CollectCoverage=true /p:CoverletOutputFormat=opencover | |
- name: Upload test results to Codecov | |
uses: codecov/codecov-action@v2 | |
with: | |
token: ${{ secrets.CODECOV_TOKEN }} | |
calculate-version: | |
name: Calculate version | |
needs: build-and-test | |
runs-on: ubuntu-latest | |
outputs: | |
semVer: ${{ steps.gitversion.outputs.semVer }} | |
nuGetVersionV2: ${{ steps.gitversion.outputs.nuGetVersionV2 }} | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
- name: Install GitVersion | |
uses: gittools/actions/gitversion/setup@v0.9.7 | |
with: | |
versionSpec: "5.x" | |
- name: Determine Version | |
id: gitversion | |
uses: gittools/actions/gitversion/execute@v0.9.7 | |
changes: | |
name: Check for valid changes | |
needs: build-and-test | |
runs-on: ubuntu-latest | |
outputs: | |
autoMapper: ${{ steps.filter.outputs.autoMapper }} | |
autoMapperExtensions: ${{ steps.filter.outputs.autoMapperExtensions }} | |
mediatr: ${{ steps.filter.outputs.mediatr }} | |
mediatrAspNetCore: ${{ steps.filter.outputs.mediatrAspNetCore }} | |
valueObject: ${{ steps.filter.outputs.valueObject }} | |
enumExtensions: ${{ steps.filter.outputs.enumExtensions }} | |
fromCompositeAttribute: ${{ steps.filter.outputs.fromCompositeAttribute }} | |
endpointDefinitions: ${{ steps.filter.outputs.endpointDefinitions }} | |
pipelineBehaviours: ${{ steps.filter.outputs.pipelineBehaviours }} | |
domainDrivenEnums: ${{ steps.filters.outputs.domainDrivenEnums }} | |
monad: ${{ steps.filters.outputs.monad }} | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v4 | |
- name: Execute filter | |
uses: dorny/paths-filter@v3 | |
id: filter | |
with: | |
filters: | | |
autoMapper: | |
- 'src/FluentUtils.AutoMapper/**' | |
autoMapperExtensions: | |
- 'src/FluentUtils.AutoMapper.Extensions.Microsoft.DependencyInjection/**' | |
mediatr: | |
- 'src/FluentUtils.MediatR.Pagination/**' | |
mediatrAspNetCore: | |
- 'src/FluentUtils.MediatR.Pagination.AspNetCore/**' | |
valueObject: | |
- 'src/FluentUtils.ValueObject/**' | |
enumExtensions: | |
- 'src/FluentUtils.EnumExtensions/**' | |
fromCompositeAttribute: | |
- 'src/FluentUtils.FromCompositeAttribute/**' | |
endpointDefinitions: | |
- 'src/FluentUtils.MinimalApis.EndpointDefinitions/**' | |
pipelineBehaviours: | |
- 'src/FluentUtils.MediatR.PipelineBehaviours/**' | |
domainDrivenEnums: | |
- 'src/FluentUtils.DomainDrivenEnums/**' | |
monad: | |
- 'src/FluentUtils.Monad/**' | |
publish-monad: | |
runs-on: ubuntu-latest | |
needs: | |
- calculate-version | |
- changes | |
name: Publish Monad NuGet Package | |
if: ${{ needs.changes.outputs.monad == 'true' }} | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
- name: Setup .NET Core Latest | |
uses: actions/setup-dotnet@v4 | |
with: | |
source-url: https://nuget.pkg.github.com/draekien/index.json | |
dotnet-version: "8.0.x" | |
env: | |
NUGET_AUTH_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
- name: Build and pack | |
run: cd src/FluentUtils.Monad && dotnet pack -c Release -o out -p:PackageVersion=${{ needs.calculate-version.outputs.nuGetVersionV2 }} | |
- name: Publish | |
run: | | |
dotnet nuget push ./src/FluentUtils.Monad/out/*.nupkg --skip-duplicate --api-key ${{ secrets.GITHUB_TOKEN }} | |
dotnet nuget push ./src/FluentUtils.Monad/out/*.nupkg --skip-duplicate --api-key ${{ secrets.NUGET_API_KEY }} --source https://api.nuget.org/v3/index.json | |
publish-pipeline-behaviours: | |
runs-on: ubuntu-latest | |
needs: | |
- calculate-version | |
- changes | |
name: Publish PipelineBehaviours NuGet Package | |
if: ${{ needs.changes.outputs.pipelineBehaviours == 'true' }} | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
- name: Setup .NET Core Latest | |
uses: actions/setup-dotnet@v4 | |
with: | |
source-url: https://nuget.pkg.github.com/draekien/index.json | |
dotnet-version: "8.0.x" | |
env: | |
NUGET_AUTH_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
- name: Build and pack | |
run: cd src/FluentUtils.MediatR.PipelineBehaviours && dotnet pack -c Release -o out -p:PackageVersion=${{ needs.calculate-version.outputs.nuGetVersionV2 }} | |
- name: Publish | |
run: | | |
dotnet nuget push ./src/FluentUtils.MediatR.PipelineBehaviours/out/*.nupkg --skip-duplicate --api-key ${{ secrets.GITHUB_TOKEN }} | |
dotnet nuget push ./src/FluentUtils.MediatR.PipelineBehaviours/out/*.nupkg --skip-duplicate --api-key ${{ secrets.NUGET_API_KEY }} --source https://api.nuget.org/v3/index.json | |
publish-endpoint-definitions: | |
runs-on: ubuntu-latest | |
needs: | |
- calculate-version | |
- changes | |
name: Publish EndpointDefinitions NuGet Package | |
if: ${{ needs.changes.outputs.endpointDefinitions == 'true' }} | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
- name: Setup .NET Core Latest | |
uses: actions/setup-dotnet@v4 | |
with: | |
source-url: https://nuget.pkg.github.com/draekien/index.json | |
dotnet-version: "8.0.x" | |
env: | |
NUGET_AUTH_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
- name: Build and pack | |
run: cd src/FluentUtils.MinimalApis.EndpointDefinitions && dotnet pack -c Release -o out -p:PackageVersion=${{ needs.calculate-version.outputs.nuGetVersionV2 }} | |
- name: Publish | |
run: | | |
dotnet nuget push ./src/FluentUtils.MinimalApis.EndpointDefinitions/out/*.nupkg --skip-duplicate --api-key ${{ secrets.GITHUB_TOKEN }} | |
dotnet nuget push ./src/FluentUtils.MinimalApis.EndpointDefinitions/out/*.nupkg --skip-duplicate --api-key ${{ secrets.NUGET_API_KEY }} --source https://api.nuget.org/v3/index.json | |
publish-from-composite-attribute: | |
runs-on: ubuntu-latest | |
needs: | |
- calculate-version | |
- changes | |
name: Publish FromCompositeAttribute NuGet Package | |
if: ${{ needs.changes.outputs.fromCompositeAttribute == 'true' }} | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
- name: Setup .NET Core Latest | |
uses: actions/setup-dotnet@v4 | |
with: | |
source-url: https://nuget.pkg.github.com/draekien/index.json | |
dotnet-version: "8.0.x" | |
env: | |
NUGET_AUTH_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
- name: Build and pack | |
run: cd src/FluentUtils.FromCompositeAttribute && dotnet pack -c Release -o out -p:PackageVersion=${{ needs.calculate-version.outputs.nuGetVersionV2 }} | |
- name: Publish | |
run: | | |
dotnet nuget push ./src/FluentUtils.FromCompositeAttribute/out/*.nupkg --skip-duplicate --api-key ${{ secrets.GITHUB_TOKEN }} | |
dotnet nuget push ./src/FluentUtils.FromCompositeAttribute/out/*.nupkg --skip-duplicate --api-key ${{ secrets.NUGET_API_KEY }} --source https://api.nuget.org/v3/index.json | |
publish-valueObject: | |
runs-on: ubuntu-latest | |
needs: | |
- calculate-version | |
- changes | |
name: Publish ValueObject NuGet Package | |
if: ${{ needs.changes.outputs.valueObject == 'true' }} | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
- name: Setup .NET Core Latest | |
uses: actions/setup-dotnet@v4 | |
with: | |
source-url: https://nuget.pkg.github.com/draekien/index.json | |
dotnet-version: "8.0.x" | |
env: | |
NUGET_AUTH_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
- name: Build and pack | |
run: cd src/FluentUtils.ValueObject && dotnet pack -c Release -o out -p:PackageVersion=${{ needs.calculate-version.outputs.nuGetVersionV2 }} | |
- name: Publish | |
run: | | |
dotnet nuget push ./src/FluentUtils.ValueObject/out/*.nupkg --skip-duplicate --api-key ${{ secrets.GITHUB_TOKEN }} | |
dotnet nuget push ./src/FluentUtils.ValueObject/out/*.nupkg --skip-duplicate --api-key ${{ secrets.NUGET_API_KEY }} --source https://api.nuget.org/v3/index.json | |
publish-autoMapper: | |
runs-on: ubuntu-latest | |
needs: | |
- calculate-version | |
- changes | |
name: Publish AutoMapper NuGet Package | |
if: ${{ needs.changes.outputs.autoMapper == 'true' }} | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
- name: Setup .NET Core Latest | |
uses: actions/setup-dotnet@v4 | |
with: | |
source-url: https://nuget.pkg.github.com/draekien/index.json | |
dotnet-version: "8.0.x" | |
env: | |
NUGET_AUTH_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
- name: Build and pack | |
run: cd src/FluentUtils.AutoMapper && dotnet pack -c Release -o out -p:PackageVersion=${{ needs.calculate-version.outputs.nuGetVersionV2 }} | |
- name: Publish | |
run: | | |
dotnet nuget push ./src/FluentUtils.AutoMapper/out/*.nupkg --skip-duplicate --api-key ${{ secrets.GITHUB_TOKEN }} | |
dotnet nuget push ./src/FluentUtils.AutoMapper/out/*.nupkg --skip-duplicate --api-key ${{ secrets.NUGET_API_KEY }} --source https://api.nuget.org/v3/index.json | |
publish-autoMapper-Extensions: | |
runs-on: ubuntu-latest | |
needs: | |
- calculate-version | |
- changes | |
name: Publish AutoMapper Extensions NuGet Package | |
if: ${{ needs.changes.outputs.autoMapperExtensions == 'true' }} | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
- name: Setup .NET Core Latest | |
uses: actions/setup-dotnet@v4 | |
with: | |
source-url: https://nuget.pkg.github.com/draekien/index.json | |
dotnet-version: "8.0.x" | |
env: | |
NUGET_AUTH_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
- name: Build and pack | |
run: cd src/FluentUtils.AutoMapper.Extensions.Microsoft.DependencyInjection && dotnet pack -c Release -o out -p:PackageVersion=${{ needs.calculate-version.outputs.nuGetVersionV2 }} | |
- name: Publish | |
run: | | |
dotnet nuget push ./src/FluentUtils.AutoMapper.Extensions.Microsoft.DependencyInjection/out/*.nupkg --skip-duplicate --api-key ${{ secrets.GITHUB_TOKEN }} | |
dotnet nuget push ./src/FluentUtils.AutoMapper.Extensions.Microsoft.DependencyInjection/out/*.nupkg --skip-duplicate --api-key ${{ secrets.NUGET_API_KEY }} --source https://api.nuget.org/v3/index.json | |
publish-mediatr-pagination: | |
runs-on: ubuntu-latest | |
needs: | |
- calculate-version | |
- changes | |
name: Publish MediatR Pagination NuGet Package | |
if: ${{ needs.changes.outputs.mediatr == 'true' }} | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
- name: Setup .NET Core Latest | |
uses: actions/setup-dotnet@v4 | |
with: | |
source-url: https://nuget.pkg.github.com/draekien/index.json | |
dotnet-version: "8.0.x" | |
env: | |
NUGET_AUTH_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
- name: Build and pack | |
run: cd src/FluentUtils.MediatR.Pagination && dotnet pack -c Release -o out -p:PackageVersion=${{ needs.calculate-version.outputs.nuGetVersionV2 }} | |
- name: Publish | |
run: | | |
dotnet nuget push ./src/FluentUtils.MediatR.Pagination/out/*.nupkg --skip-duplicate --api-key ${{ secrets.GITHUB_TOKEN }} | |
dotnet nuget push ./src/FluentUtils.MediatR.Pagination/out/*.nupkg --skip-duplicate --api-key ${{ secrets.NUGET_API_KEY }} --source https://api.nuget.org/v3/index.json | |
publish-mediatr-pagination-aspnetcore: | |
runs-on: ubuntu-latest | |
needs: | |
- calculate-version | |
- changes | |
name: Publish MediatR Pagination AspNetCore NuGet Package | |
if: ${{ needs.changes.outputs.mediatrAspNetCore == 'true' }} | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
- name: Setup .NET Core Latest | |
uses: actions/setup-dotnet@v4 | |
with: | |
source-url: https://nuget.pkg.github.com/draekien/index.json | |
dotnet-version: "8.0.x" | |
env: | |
NUGET_AUTH_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
- name: Build and pack | |
run: cd src/FluentUtils.MediatR.Pagination.AspNetCore && dotnet pack -c Release -o out -p:PackageVersion=${{ needs.calculate-version.outputs.nuGetVersionV2 }} | |
- name: Publish | |
run: | | |
dotnet nuget push ./src/FluentUtils.MediatR.Pagination.AspNetCore/out/*.nupkg --skip-duplicate --api-key ${{ secrets.GITHUB_TOKEN }} | |
dotnet nuget push ./src/FluentUtils.MediatR.Pagination.AspNetCore/out/*.nupkg --skip-duplicate --api-key ${{ secrets.NUGET_API_KEY }} --source https://api.nuget.org/v3/index.json | |
publish-enum-extensions: | |
runs-on: ubuntu-latest | |
needs: | |
- calculate-version | |
- changes | |
name: Publish enum extensions NuGet package | |
if: ${{ needs.changes.outputs.enumExtensions == 'true' }} | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
- name: Setup .NET Core Latest | |
uses: actions/setup-dotnet@v4 | |
with: | |
source-url: https://nuget.pkg.github.com/draekien/index.json | |
dotnet-version: "8.0.x" | |
env: | |
NUGET_AUTH_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
- name: Build and pack | |
run: cd src/FluentUtils.EnumExtensions && dotnet pack -c Release -o out -p:PackageVersion=${{ needs.calculate-version.outputs.nuGetVersionV2 }} | |
- name: Publish | |
run: | | |
dotnet nuget push ./src/FluentUtils.EnumExtensions/out/*.nupkg --skip-duplicate --api-key ${{ secrets.GITHUB_TOKEN }} | |
dotnet nuget push ./src/FluentUtils.EnumExtensions/out/*.nupkg --skip-duplicate --api-key ${{ secrets.NUGET_API_KEY }} --source https://api.nuget.org/v3/index.json | |
publish-domain-driven-enums: | |
runs-on: ubuntu-latest | |
needs: | |
- calculate-version | |
- changes | |
name: Publish domain driven enums NuGet package | |
if: ${{ needs.changes.outputs.domainDrivenEnums == 'true' }} | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
- name: Setup .NET Core Latest | |
uses: actions/setup-dotnet@v4 | |
with: | |
source-url: https://nuget.pkg.github.com/draekien/index.json | |
dotnet-version: "8.0.x" | |
env: | |
NUGET_AUTH_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
- name: Build and pack | |
run: cd src/FluentUtils.DomainDrivenEnums && dotnet pack -c Release -o out -p:PackageVersion=${{ needs.calculate-version.outputs.nuGetVersionV2 }} | |
- name: Publish | |
run: | | |
dotnet nuget push ./src/FluentUtils.DomainDrivenEnums/out/*.nupkg --skip-duplicate --api-key ${{ secrets.GITHUB_TOKEN }} | |
dotnet nuget push ./src/FluentUtils.DomainDrivenEnums/out/*.nupkg --skip-duplicate --api-key ${{ secrets.NUGET_API_KEY }} --source https://api.nuget.org/v3/index.json | |
create-release: | |
name: Create GitHub Release | |
runs-on: ubuntu-latest | |
if: ${{ always() }} | |
needs: | |
- calculate-version | |
- changes | |
- publish-valueObject | |
- publish-autoMapper | |
- publish-autoMapper-Extensions | |
- publish-mediatr-pagination | |
- publish-mediatr-pagination-aspnetcore | |
- publish-enum-extensions | |
- publish-from-composite-attribute | |
- publish-endpoint-definitions | |
- publish-pipeline-behaviours | |
- publish-domain-driven-enums | |
- publish-monad | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
- name: Bump version and push tag | |
id: tag_version | |
uses: mathieudutour/github-tag-action@v6.0 | |
with: | |
github_token: ${{ secrets.GITHUB_TOKEN }} | |
custom_tag: ${{ needs.calculate-version.outputs.nuGetVersionV2 }} | |
- name: Create release | |
uses: ncipollo/release-action@v1 | |
with: | |
tag: ${{ steps.tag_version.outputs.new_tag }} | |
name: Release ${{ steps.tag_version.outputs.new_tag }} | |
body: ${{ steps.tag_version.outputs.changelog }} |