Skip to content

Commit

Permalink
switch from dorny/test-reporter to test-summary/action (#211)
Browse files Browse the repository at this point in the history
* switch from dorny/test-reporter to test-summary/action
- test results will be included in the job summary
- simplifies actions
- requires use of junit output test-summary/action#1
- added publish and upload artifact steps
- committing with failing test to ensure it works when tests fail

* try to fix test results output

* workflows - revert to run on main push

* codeql - update checkout action

* nuspec - include some github workflows

* Excluded unneeded template files from project.

* nuspec - include all github settings except the ones that are specific to the template

* Update CleanArchitecture version to 0.7.0

The version number in CleanArchitecture.nuspec has been downgraded from 0.7.3 to 0.7.0. This can be due to dependency issues or rollback requirements.

---------

Co-authored-by: Daniel Mackay [SSW] <[email protected]>
  • Loading branch information
wicksipedia and danielmackay authored Dec 15, 2023
1 parent 593ab55 commit 08c35b4
Show file tree
Hide file tree
Showing 9 changed files with 74 additions and 85 deletions.
Original file line number Diff line number Diff line change
@@ -1,7 +1,4 @@
# This workflow will build a .NET project
# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-net

name: .NET
name: Build and test

on:
push:
Expand All @@ -12,11 +9,10 @@ on:
jobs:
build:
name: "Build"

runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4

- name: Cache
uses: actions/cache@v3
Expand All @@ -36,12 +32,26 @@ jobs:
run: dotnet build --no-restore --configuration Release

- name: Test
run: dotnet test --no-build --no-restore --configuration Release --logger "trx;LogFileName=TestResults.trx"
run: dotnet test --no-build --no-restore --configuration Release --logger "junit;LogFilePath=test-result.xml"

# as per https://github.com/dorny/test-reporter?tab=readme-ov-file#recommended-setup-for-public-repositories
- name: Test Report
- name: Publish
run: dotnet publish src/WebApi/WebApi.csproj --no-build --no-restore --configuration Release --output ./publish

- name: Upload Artifact
uses: actions/upload-artifact@v3
if: success() || failure() # run this step even if previous step failed
with:
name: test-results
path: "**/*.trx"
name: published-files
path: ./publish

- name: Test Report
uses: test-summary/action@v2
if: success() || failure()
with:
paths: ./**/test-result.xml
output: test-summary.md
- name: Output job summary
if: success() || failure()
run: |
cat test-summary.md >> $GITHUB_STEP_SUMMARY
11 changes: 4 additions & 7 deletions .github/workflows/codeql.yml
Original file line number Diff line number Diff line change
@@ -1,11 +1,8 @@
name: "Code Scanning - Action"

on:
workflow_run:
workflows: ['.NET'] # runs after .NET workflow
types:
- completed
branches:
- 'main'
push:
branches: [ "main" ]

jobs:
CodeQL-Build:
Expand All @@ -16,7 +13,7 @@ jobs:

steps:
- name: Checkout repository
uses: actions/checkout@v3
uses: actions/checkout@v4

- name: Initialize CodeQL
uses: github/codeql-action/init@v2
Expand Down
18 changes: 11 additions & 7 deletions .github/workflows/publish-log4brains.yml
Original file line number Diff line number Diff line change
@@ -1,28 +1,32 @@
name: Publish Log4brains

on:
workflow_run:
workflows: ['.NET'] # runs after .NET workflow
types:
- completed
branches:
- 'main'
push:
branches: [ "main" ]

jobs:
build-and-publish:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v2.3.4
uses: actions/checkout@v4
with:
persist-credentials: false # required by JamesIves/github-pages-deploy-action
fetch-depth: 0 # required by Log4brains to work correctly (needs the whole Git history)
sparse-checkout: |
docs
- name: Install Node
uses: actions/setup-node@v1
with:
node-version: "14"

- name: Install and Build Log4brains
run: |
npm install -g log4brains
log4brains build --basePath /${GITHUB_REPOSITORY#*/}
- name: Deploy
uses: JamesIves/[email protected]
with:
Expand Down
24 changes: 0 additions & 24 deletions .github/workflows/test-report.yml

This file was deleted.

4 changes: 2 additions & 2 deletions CleanArchitecture.nuspec
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@
<requireLicenseAcceptance>false</requireLicenseAcceptance>
<tags>clean-architecture project template csharp dotnet ssw</tags>
<icon>icon.png</icon>
<readme>README.md</readme>

<packageTypes>
<packageType name="Template" />
Expand All @@ -31,7 +30,8 @@
<files>
<file src=".template.config\icon.png" target="" />
<file src="README.md" />
<file src=".\**" target="content" exclude="**\bin\**;**\obj\**;**\.vs\**;**\.vscode\**;**\.git\**;**\.github\**;**\LICENSE;" />
<file src=".\**" target="content" exclude="**\bin\**;**\obj\**;**\.vs\**;**\.vscode\**;**\.git\**;**\.github\**;**\LICENSE;**\.template.config\**;**\templates\**;**\.idea\**;CODE_OF_CONDUCT.yml" />
<file src=".\.github\**" target="content\.github" exclude="CODEOWNERS;settings.yml;workflows\package.yml;workflows\update-settings.yml" />
</files>

</package>
1 change: 1 addition & 0 deletions tests/Architecture.Tests/Architecture.Tests.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
<PrivateAssets>all</PrivateAssets>
</PackageReference>
<PackageReference Include="FluentAssertions" />
<PackageReference Include="JunitXml.TestLogger" />
<PackageReference Include="Microsoft.NET.Test.Sdk" />
<PackageReference Include="NetArchTest.Rules" />
<PackageReference Include="xunit" />
Expand Down
43 changes: 21 additions & 22 deletions tests/Directory.Packages.props
Original file line number Diff line number Diff line change
@@ -1,23 +1,22 @@
<Project>

<PropertyGroup>
<ManagePackageVersionsCentrally>true</ManagePackageVersionsCentrally>
</PropertyGroup>

<ItemGroup>
<PackageVersion Include="FluentAssertions" Version="6.12.0" />
<PackageVersion Include="Microsoft.NET.Test.Sdk" Version="17.9.0-preview-23503-02" />
<PackageVersion Include="xunit" Version="2.6.2" />
<PackageVersion Include="xunit.runner.visualstudio" Version="2.5.4" />
<PackageVersion Include="coverlet.collector" Version="6.0.0" />
<PackageVersion Include="NetArchTest.Rules" Version="1.3.2" />
<PackageVersion Include="Bogus" Version="34.0.2" />
<PackageVersion Include="NSubstitute" Version="5.1.0" />
<PackageVersion Include="Respawn" Version="6.1.0" />
<PackageVersion Include="Testcontainers" Version="3.6.0" />
<PackageVersion Include="Testcontainers.SqlEdge" Version="3.6.0" />
<PackageVersion Include="Microsoft.AspNetCore.Mvc.Testing" Version="8.0.0" />
<PackageVersion Include="Microsoft.Extensions.DependencyInjection.Abstractions" Version="8.0.0" />
<PackageVersion Include="Meziantou.Extensions.Logging.Xunit" Version="1.0.7" />
</ItemGroup>
</Project>
<PropertyGroup>
<ManagePackageVersionsCentrally>true</ManagePackageVersionsCentrally>
</PropertyGroup>
<ItemGroup>
<PackageVersion Include="FluentAssertions" Version="6.12.0" />
<PackageVersion Include="JunitXml.TestLogger" Version="3.0.134" />
<PackageVersion Include="Microsoft.NET.Test.Sdk" Version="17.9.0-preview-23503-02" />
<PackageVersion Include="xunit" Version="2.6.2" />
<PackageVersion Include="xunit.runner.visualstudio" Version="2.5.4" />
<PackageVersion Include="coverlet.collector" Version="6.0.0" />
<PackageVersion Include="NetArchTest.Rules" Version="1.3.2" />
<PackageVersion Include="Bogus" Version="34.0.2" />
<PackageVersion Include="NSubstitute" Version="5.1.0" />
<PackageVersion Include="Respawn" Version="6.1.0" />
<PackageVersion Include="Testcontainers" Version="3.6.0" />
<PackageVersion Include="Testcontainers.SqlEdge" Version="3.6.0" />
<PackageVersion Include="Microsoft.AspNetCore.Mvc.Testing" Version="8.0.0" />
<PackageVersion Include="Microsoft.Extensions.DependencyInjection.Abstractions" Version="8.0.0" />
<PackageVersion Include="Meziantou.Extensions.Logging.Xunit" Version="1.0.7" />
</ItemGroup>
</Project>
1 change: 1 addition & 0 deletions tests/Domain.UnitTests/Domain.UnitTests.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
<PrivateAssets>all</PrivateAssets>
</PackageReference>
<PackageReference Include="FluentAssertions" />
<PackageReference Include="JunitXml.TestLogger" />
<PackageReference Include="Microsoft.NET.Test.Sdk" />
<PackageReference Include="xunit" />
<PackageReference Include="xunit.runner.visualstudio">
Expand Down
23 changes: 12 additions & 11 deletions tests/WebApi.IntegrationTests/WebApi.IntegrationTests.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -10,20 +10,21 @@
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Bogus"/>
<PackageReference Include="Bogus" />
<PackageReference Include="coverlet.collector">
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
<PrivateAssets>all</PrivateAssets>
</PackageReference>
<PackageReference Include="FluentAssertions"/>
<PackageReference Include="Microsoft.AspNetCore.Mvc.Testing"/>
<PackageReference Include="Microsoft.NET.Test.Sdk"/>
<PackageReference Include="Microsoft.Extensions.DependencyInjection.Abstractions"/>
<PackageReference Include="NSubstitute"/>
<PackageReference Include="Respawn"/>
<PackageReference Include="Testcontainers"/>
<PackageReference Include="Testcontainers.SqlEdge"/>
<PackageReference Include="xunit"/>
<PackageReference Include="FluentAssertions" />
<PackageReference Include="JunitXml.TestLogger" />
<PackageReference Include="Microsoft.AspNetCore.Mvc.Testing" />
<PackageReference Include="Microsoft.NET.Test.Sdk" />
<PackageReference Include="Microsoft.Extensions.DependencyInjection.Abstractions" />
<PackageReference Include="NSubstitute" />
<PackageReference Include="Respawn" />
<PackageReference Include="Testcontainers" />
<PackageReference Include="Testcontainers.SqlEdge" />
<PackageReference Include="xunit" />
<PackageReference Include="xunit.runner.visualstudio">
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
<PrivateAssets>all</PrivateAssets>
Expand All @@ -32,7 +33,7 @@
</ItemGroup>

<ItemGroup>
<ProjectReference Include="..\..\src\WebApi\WebApi.csproj"/>
<ProjectReference Include="..\..\src\WebApi\WebApi.csproj" />
</ItemGroup>

</Project>

0 comments on commit 08c35b4

Please sign in to comment.