Skip to content
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
29 changes: 29 additions & 0 deletions .github/workflows/nuget.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
name: Release NuGet Package
on:
release:
types: [published] # Triggers when you create a GitHub Release
jobs:
deploy:
runs-on: ubuntu-latest
permissions:
id-token: write # Required for OIDC
contents: read
steps:
- uses: actions/checkout@v4
- name: Setup .NET
uses: actions/setup-dotnet@v4
with:
dotnet-version: 10.0.x
- name: Restore dependencies
run: dotnet restore
- name: Build
run: dotnet build -c Release -p:Version=${GITHUB_REF_NAME#v} --no-restore
- name: Run Tests
run: dotnet test -c Release --report-trx --results-directory=".artifacts/test-results" --no-build --no-restore
- name: Pack Nuget
run: dotnet pack -c Release -p:Version=${GITHUB_REF_NAME#v} -o .artifacts/packages --no-build --no-restore
- name: Authenticate with NuGet via OIDC
uses: NuGet/login@v1
id: nuget-login
- name: Push Nuget
run: dotnet nuget push ".artifacts/packages/**/*.nupkg" -s https://api.nuget.org/v3/index.json -k ${{ steps.nuget-login.outputs.NUGET_API_KEY }} --skip-duplicate
27 changes: 8 additions & 19 deletions .github/workflows/pr.yml
Original file line number Diff line number Diff line change
@@ -1,36 +1,25 @@
name: .NET

# Trigger build and test whenever a pull request is opened or updated against target branches
name: PR Workflow
on:
pull_request:
branches: [ "master" ]

branches: [ "master" ] # Triggers when you create a PR targeting a master branch
jobs:
build:

runs-on: ubuntu-latest

steps:

- uses: actions/checkout@v4

- name: Setup .NET
uses: actions/setup-dotnet@v4
with:
dotnet-version: 10.0.x

- name: Restore dependencies
run: dotnet restore

run: dotnet restore
- name: Build
run: dotnet build --no-restore

- name: Test
run: dotnet test --report-trx --results-directory=".artifacts/test-results" || true

- name: Test Report
run: dotnet build --no-restore
- name: Run Tests
run: dotnet test --report-trx --results-directory=".artifacts/test-results" --no-build --no-restore || true
- name: Publish Test Report
uses: dorny/test-reporter@v1
if: always()
if: always()
with:
name: .NET Core Tests
path: ".artifacts/test-results/**/*.trx"
Expand Down
24 changes: 15 additions & 9 deletions Directory.Build.props
Original file line number Diff line number Diff line change
@@ -1,9 +1,5 @@
<Project>

<PropertyGroup>
<ServiceErrorsVersion>0.0.1</ServiceErrorsVersion>
</PropertyGroup>

<PropertyGroup>
<UseArtifactsOutput>true</UseArtifactsOutput>
<ArtifactsPath>$(MSBuildThisFileDirectory).artifacts/</ArtifactsPath>
Expand All @@ -15,6 +11,11 @@
<IsPackable>false</IsPackable>
</PropertyGroup>

<PropertyGroup Condition="'$(GITHUB_ACTIONS)' == 'true'">
<ContinuousIntegrationBuild>true</ContinuousIntegrationBuild>
<EmbedUntrackedSources>true</EmbedUntrackedSources>
</PropertyGroup>

<PropertyGroup>
<IsSrcProject>false</IsSrcProject>
<IsSrcProject Condition="$([System.String]::new('$(MSBuildProjectDirectory)').ToLower().Contains('\src\'))">true</IsSrcProject>
Expand All @@ -23,22 +24,27 @@

<PropertyGroup>
<IsTestProject>false</IsTestProject>
<IsTestProject Condition="$([System.String]::Copy('$(MSBuildProjectName)').EndsWith('.UnitTests'))">true</IsTestProject>
<TestProjectBaseName Condition="'$(IsTestProject)' == 'true'">$([System.String]::Copy('$(MSBuildProjectName)').Replace('.UnitTests',''))</TestProjectBaseName>
<IsTestProject Condition="$([System.String]::new('$(MSBuildProjectDirectory)').ToLower().Contains('\tests\'))">true</IsTestProject>
<IsTestProject Condition="$([System.String]::new('$(MSBuildProjectDirectory)').ToLower().Contains('/tests/'))">true</IsTestProject>
<TestProjectBaseName Condition="'$(IsTestProject)' == 'true'">$([System.String]::Copy('$(MSBuildProjectName)').Replace('.UnitTests','').Replace('.IntegrationTests','').Replace('.Tests',''))</TestProjectBaseName>
</PropertyGroup>

<PropertyGroup Condition="'$(IsSrcProject)' == 'true'">
<IsPackable>true</IsPackable>
<PackageLicenseExpression>MIT</PackageLicenseExpression>
<Authors>Igor Sinicyn</Authors>
<Company>CodeMe</Company>
<Product>CodeMe</Product>
<PackageProjectUrl>https://github.com/ig-sinicyn/CodeMe</PackageProjectUrl>
<RepositoryUrl>https://github.com/ig-sinicyn/CodeMe.git</RepositoryUrl>
<RepositoryType>git</RepositoryType>
<PublishRepositoryUrl>true</PublishRepositoryUrl>
<IncludeSymbols>true</IncludeSymbols>
<SymbolPackageFormat>snupkg</SymbolPackageFormat>
</PropertyGroup>

<ItemGroup Condition="'$(IsSrcProject)' == 'true'">
<InternalsVisibleTo Include="$(MSBuildProjectName).Tests" />
<InternalsVisibleTo Include="$(MSBuildProjectName).UnitTests" />
<InternalsVisibleTo Include="$(MSBuildProjectName).IntegrationTests" />
</ItemGroup>

<PropertyGroup Condition="'$(IsTestProject)' == 'true'">
Expand All @@ -51,7 +57,7 @@
<PackageReference Include="AwesomeAssertions" />
<PackageReference Include="Microsoft.Testing.Extensions.TrxReport" />
<PackageReference Include="xunit.v3.mtp-v2" />
<ProjectReference Include="..\..\src\$(TestProjectBaseName)\$(TestProjectBaseName).csproj" />
<ProjectReference Include="../../src/$(TestProjectBaseName)/$(TestProjectBaseName).csproj" />
<Using Include="AwesomeAssertions" />
<Using Include="Xunit" />
</ItemGroup>
Expand Down
4 changes: 2 additions & 2 deletions cicd/cicd.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@
</PropertyGroup>

<ItemGroup>
<None Include="..\.github\**\*.*">
<Link>.github\%(RecursiveDir)%(Filename)%(Extension)</Link>
<None Include="../.github/**/*.*">
<Link>.github/%(RecursiveDir)%(Filename)%(Extension)</Link>
</None>
</ItemGroup>

Expand Down
4 changes: 2 additions & 2 deletions env/env.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,10 @@
</PropertyGroup>

<ItemGroup>
<None Include="..\*.*">
<None Include="../*.*">
<Link>%(Filename)%(Extension)</Link>
</None>
<None Remove="..\*.slnx"/>
<None Remove="../*.slnx"/>
</ItemGroup>

</Project>
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
<LangVersion>latest</LangVersion>

<Description>Library for typed service errors (Problem Details-alike DTOs)</Description>
<PackageTags>errors;typed_errors</PackageTags>
<PackageTags>errors;typed errors</PackageTags>
</PropertyGroup>

<ItemGroup>
Expand Down
6 changes: 3 additions & 3 deletions src/CodeMe.ServiceErrors/CodeMe.ServiceErrors.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<TargetFramework>net10.0</TargetFramework>

<Description>Library for typed service errors (Problem Details-alike DTOs)</Description>
<PackageTags>errors;typed_errors</PackageTags>
<PackageTags>errors;typed errors</PackageTags>

<!-- NuGet Package Properties -->
<PackageReadmeFile>README.md</PackageReadmeFile>
Expand All @@ -15,11 +15,11 @@
</ItemGroup>

<ItemGroup>
<ProjectReference Include="..\CodeMe.ServiceErrors.Abstractions\CodeMe.ServiceErrors.Abstractions.csproj" />
<ProjectReference Include="../CodeMe.ServiceErrors.Abstractions/CodeMe.ServiceErrors.Abstractions.csproj" />
</ItemGroup>

<ItemGroup>
<None Include="README.md" Pack="true" PackagePath="\" />
<None Include="README.md" Pack="true" PackagePath="/" />
</ItemGroup>

</Project>
Loading