Skip to content

Commit

Permalink
ci: create dotnet-build.yml (#1)
Browse files Browse the repository at this point in the history
+semver: none
  • Loading branch information
ewingjm authored Mar 8, 2024
1 parent fa62b55 commit 094d111
Show file tree
Hide file tree
Showing 18 changed files with 113 additions and 26 deletions.
6 changes: 5 additions & 1 deletion .editorconfig
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,8 @@
dotnet_diagnostic.SA1633.severity = silent

[**/GlobalUsings.cs]
csharp_using_directive_placement = outside_namespace:silent
csharp_using_directive_placement = outside_namespace:silent


[**/*Event.cs]
dotnet_diagnostic.cs0649.severity = none
79 changes: 79 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,79 @@
name: ci

on:
push:
branches: [ "main" ]
paths: [ "src/**/*.cs" ]

defaults:
run:
shell: pwsh

env:
DOTNET_SKIP_FIRST_TIME_EXPERIENCE: 1
DOTNET_NOLOGO: true
BUILD_NUGET_OUTPUTDIRECTORY: ${{ github.workspace}}/nuget

jobs:
build:
runs-on: ubuntu-latest
outputs:
fullSemVer: ${{ steps.gitversion.outputs.fullSemVer }}
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Install GitVersion
uses: gittools/actions/gitversion/setup@v0
with:
versionSpec: '5.x'
- name: Run GitVersion
id: gitversion
uses: gittools/actions/gitversion/execute@v0
with:
useConfigFile: true
- name: Setup .NET
uses: actions/setup-dotnet@v4
with:
dotnet-version: 6.0.x
- name: Restore dependencies
run: dotnet restore
- name: Build
run: dotnet build --configuration Release --no-restore
- name: Test
run: dotnet test --configuration Release --no-build --verbosity normal
- name: Pack
run: dotnet pack --configuration Release --no-restore --output ${{ env.BUILD_NUGET_OUTPUTDIRECTORY }}
- name: Upload artifact
uses: actions/upload-artifact@v4
with:
name: package
if-no-files-found: error
retention-days: 0
path: ${{ env.BUILD_NUGET_OUTPUTDIRECTORY }}/**.*nupkg
deploy:
runs-on: ubuntu-latest
permissions:
contents: write
needs: [ build ]
steps:
- uses: actions/download-artifact@v4
with:
name: package
path: ${{ env.BUILD_NUGET_OUTPUTDIRECTORY }}
- name: Setup .NET
uses: actions/setup-dotnet@v4
with:
dotnet-version: 6.0.x
- name: Publish
run: |
Get-ChildItem "${{ env.BUILD_NUGET_OUTPUTDIRECTORY }}" -Recurse -Include *.nupkg | ForEach-Object {
dotnet nuget push $_ --api-key "${{ secrets.NUGET_APIKEY }}" --source https://api.nuget.org/v3/index.json --skip-duplicate
}
- name: Create release
env:
CREATERELEASE_FULLSEMVER: ${{ needs.build.outputs.fullSemVer }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
gh release create "v$env:CREATERELEASE_FULLSEMVER" --generate-notes --repo="$env:GITHUB_REPOSITORY"
2 changes: 1 addition & 1 deletion ScenarioBuilder.sln
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "ScenarioBuilder.UnitTests",
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "ScenarioBuilder.IntegrationTests", "test\ScenarioBuilder.IntegrationTests\ScenarioBuilder.IntegrationTests.csproj", "{FF4899F1-1AE8-43B6-8B94-23BDFF5E2913}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "ScenarioBuilder.TestHarness", "test\ScenarioBuilder.TestHarness\ScenarioBuilder.TestHarness.csproj", "{37AC9876-7FC2-408E-ADB3-43D9F2FD21A1}"
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "ScenarioBuilder.TestImplementation", "test\ScenarioBuilder.TestImplementation\ScenarioBuilder.TestImplementation.csproj", "{37AC9876-7FC2-408E-ADB3-43D9F2FD21A1}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{FCC7B6D7-531D-442C-A7E9-E87FEDB9AC4A}"
ProjectSection(SolutionItems) = preProject
Expand Down
1 change: 0 additions & 1 deletion src/ScenarioBuilder/Event.cs
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
namespace ScenarioBuilder
{
using System.Threading.Tasks;
using System.Xml.Serialization;
using AutoMapper;

/// <summary>
Expand Down
4 changes: 4 additions & 0 deletions src/ScenarioBuilder/ScenarioBuilder.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,10 @@

<ItemGroup>
<PackageReference Include="AutoMapper" Version="10.1.1" />
<PackageReference Include="GitVersion.MsBuild" Version="5.12.0">
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
<PrivateAssets>all</PrivateAssets>
</PackageReference>
<PackageReference Include="Microsoft.Extensions.Logging" Version="8.0.0" />
<PackageReference Include="Microsoft.SourceLink.GitHub" Version="8.0.0">
<PrivateAssets>all</PrivateAssets>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
</ItemGroup>

<ItemGroup>
<ProjectReference Include="..\ScenarioBuilder.TestHarness\ScenarioBuilder.TestHarness.csproj" />
<ProjectReference Include="..\ScenarioBuilder.TestImplementation\ScenarioBuilder.TestImplementation.csproj" />
</ItemGroup>

</Project>
4 changes: 2 additions & 2 deletions test/ScenarioBuilder.IntegrationTests/ScenarioBuilderTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@
using Microsoft.PowerPlatform.Dataverse.Client;
using Microsoft.Xrm.Sdk;
using Moq;
using ScenarioBuilder.TestHarness;
using ScenarioBuilder.TestHarness.Services;
using ScenarioBuilder.TestImplementation;
using ScenarioBuilder.TestImplementation.Services;

/// <summary>
/// Integration tests for the <see cref="ApplicationScenario.Builder"/> class.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
namespace ScenarioBuilder.TestHarness;
namespace ScenarioBuilder.TestImplementation;

using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Logging;
using ScenarioBuilder.TestHarness.Events.Caseworker;
using ScenarioBuilder.TestHarness.Events.Caseworker.Composites;
using ScenarioBuilder.TestHarness.Events.PortalUser;
using ScenarioBuilder.TestHarness.Services;
using ScenarioBuilder.TestImplementation.Events.Caseworker;
using ScenarioBuilder.TestImplementation.Events.Caseworker.Composites;
using ScenarioBuilder.TestImplementation.Events.PortalUser;
using ScenarioBuilder.TestImplementation.Services;

/// <summary>
/// An example scenario for an application.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
namespace ScenarioBuilder.TestHarness.Events.Caseworker
namespace ScenarioBuilder.TestImplementation.Events.Caseworker
{
using Microsoft.Crm.Sdk.Messages;
using Microsoft.Extensions.Logging;
using Microsoft.PowerPlatform.Dataverse.Client;
using Microsoft.Xrm.Sdk;
using ScenarioBuilder.TestHarness.Events.PortalUser;
using ScenarioBuilder.TestHarness.Services;
using ScenarioBuilder.TestImplementation.Events.PortalUser;
using ScenarioBuilder.TestImplementation.Services;

/// <summary>
/// An event for a caseworker assigning an application.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
namespace ScenarioBuilder.TestHarness.Events.Caseworker
namespace ScenarioBuilder.TestImplementation.Events.Caseworker
{
using Microsoft.Extensions.Logging;
using Microsoft.Xrm.Sdk;
using ScenarioBuilder.TestHarness.Events.Caseworker.Composites;
using ScenarioBuilder.TestHarness.Events.PortalUser;
using ScenarioBuilder.TestHarness.Services;
using ScenarioBuilder.TestImplementation.Events.Caseworker.Composites;
using ScenarioBuilder.TestImplementation.Events.PortalUser;
using ScenarioBuilder.TestImplementation.Services;

/// <summary>
/// An event for a caseworker approving an application.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
namespace ScenarioBuilder.TestHarness.Events.Caseworker.Composites
namespace ScenarioBuilder.TestImplementation.Events.Caseworker.Composites
{
/// <summary>
/// A composite event for a caseworker processing an application.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
namespace ScenarioBuilder.TestHarness.Events.PortalUser
namespace ScenarioBuilder.TestImplementation.Events.PortalUser
{
using Microsoft.Extensions.Logging;
using Microsoft.Xrm.Sdk;
using ScenarioBuilder.TestHarness.Services;
using ScenarioBuilder.TestImplementation.Services;

/// <summary>
/// An event for a portal user submitting an application.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
namespace ScenarioBuilder.TestHarness
namespace ScenarioBuilder.TestImplementation
{
/// <summary>
/// The personas involved in the scenarios.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
<TargetFramework>net8.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
<IsPackable>false</IsPackable>
<GenerateDocumentationFile>true</GenerateDocumentationFile>
<EnableNETAnalyzers>true</EnableNETAnalyzers>
</PropertyGroup>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
namespace ScenarioBuilder.TestHarness
namespace ScenarioBuilder.TestImplementation
{
/// <summary>
/// Extensions to the <see cref="ScenarioContext"/> class.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
namespace ScenarioBuilder.TestHarness.Services
namespace ScenarioBuilder.TestImplementation.Services
{
using Microsoft.PowerPlatform.Dataverse.Client;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
namespace ScenarioBuilder.UnitTests;

using ScenarioBuilder;
using ScenarioBuilder.TestHarness.Events.PortalUser;
using ScenarioBuilder.TestImplementation.Events.PortalUser;

/// <summary>
/// Tests for the <see cref="ComposeUsingAttribute"/> class.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@

<ItemGroup>
<ProjectReference Include="..\..\src\ScenarioBuilder\ScenarioBuilder.csproj" />
<ProjectReference Include="..\ScenarioBuilder.TestHarness\ScenarioBuilder.TestHarness.csproj" />
<ProjectReference Include="..\ScenarioBuilder.TestImplementation\ScenarioBuilder.TestImplementation.csproj" />
</ItemGroup>

</Project>

0 comments on commit 094d111

Please sign in to comment.