Skip to content

Commit b3ab913

Browse files
Merge pull request #28 from stiefeljackal/ci/test-action
ci: add test workflow
2 parents 7e39501 + dd6fadf commit b3ab913

8 files changed

Lines changed: 61 additions & 168 deletions

File tree

.github/workflows/build.yml

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -14,15 +14,14 @@ on:
1414

1515
jobs:
1616
build:
17-
# 2019, has our .NET needs, latest does not
18-
runs-on: windows-2019
17+
# Windows Server 2022 contains .NET 9
18+
runs-on: windows-2022
1919
steps:
20-
- uses: actions/checkout@v4
21-
# While this package targets .Net Framework 4.6.2, the dotnet 7 stuff will work.
22-
- name: Setup .NET 7
23-
uses: actions/setup-dotnet@v3
20+
- uses: actions/checkout@v5
21+
- name: Setup .NET 9
22+
uses: actions/setup-dotnet@v4
2423
with:
25-
dotnet-version: 7.0.x
24+
dotnet-version: 9.0.x
2625
- name: Install dependencies
2726
run: dotnet restore
2827
- name: Build

.github/workflows/release.yml

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -6,18 +6,18 @@ on:
66
types: [published]
77
jobs:
88
publish:
9-
# 2019, has our .NET needs, latest does not
10-
runs-on: windows-2019
9+
# Windows Server 2022 contains .NET 9
10+
runs-on: windows-2022
1111
env:
1212
VERSION: ${{ github.event.release.tag_name }}
1313
steps:
14-
- uses: actions/checkout@v4
14+
- uses: actions/checkout@v5
1515
- name: Get version
1616
run: echo "Building with ${{ env.VERSION }}"
17-
- name: Setup .NET 7
18-
uses: actions/setup-dotnet@v3
17+
- name: Setup .NET 9
18+
uses: actions/setup-dotnet@v4
1919
with:
20-
dotnet-version: 7.0.x
20+
dotnet-version: 9.0.x
2121
- name: Install dependencies
2222
run: dotnet restore
2323
- name: Build

.github/workflows/test.yml

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
name: Test Library
2+
3+
on:
4+
workflow_dispatch:
5+
push:
6+
paths:
7+
- '**.cs'
8+
- '**.csproj'
9+
- '**.props'
10+
branches:
11+
- main
12+
pull_request:
13+
paths:
14+
- '**.cs'
15+
- '**.csproj'
16+
- '**.props'
17+
branches:
18+
- main
19+
20+
env:
21+
DOTNET_NOLOGO: true
22+
DOTNET_SKIP_FIRST_TIME_EXPERIENCE: true
23+
DOTNET_CLI_TELEMETRY_OPTOUT: true
24+
25+
jobs:
26+
build:
27+
runs-on: windows-2022
28+
steps:
29+
- uses: actions/checkout@v5
30+
- name: Setup .NET 9
31+
uses: actions/setup-dotnet@v4
32+
with:
33+
dotnet-version: 9.0.x
34+
- name: Install Dependencies
35+
run: dotnet restore
36+
- name: Run Test
37+
run: dotnet test --configuration Release --no-restore --logger "trx;LogFileName=test-results.trx" || true
38+
- name: Generate Test Report
39+
uses: dorny/test-reporter@v2
40+
if: success() || failure()
41+
with:
42+
name: Elements.Quantity.Test
43+
path: '**/test-results.trx'
44+
reporter: dotnet-trx
45+
fail-on-error: true
Lines changed: 4 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,27 +1,18 @@
11
<Project Sdk="Microsoft.NET.Sdk">
22
<PropertyGroup>
3-
<OutputType>Exe</OutputType>
43
<TargetFramework>net9.0</TargetFramework>
54
<LangVersion>latest</LangVersion>
65
<Nullable>enable</Nullable>
7-
<GenerateAssemblyInfo>false</GenerateAssemblyInfo>
8-
<ProjectTypeGuids>{3AC096D0-A1C2-E12C-1390-A8335801FDAB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
6+
<OutputType>Library</OutputType>
97
<IsTestProject>true</IsTestProject>
108
<TestProjectType>UnitTest</TestProjectType>
119
<IsPackable>false</IsPackable>
1210
<IsCodedUITest>False</IsCodedUITest>
1311
</PropertyGroup>
1412
<ItemGroup>
15-
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.6.0" />
16-
<PackageReference Include="MSTest.TestAdapter" version="2.2.10" />
17-
<PackageReference Include="MSTest.TestFramework" version="2.2.10" />
18-
<PackageReference Include="coverlet.collector" Version="3.2.0" />
19-
<PackageReference Include="System.ValueTuple" version="4.5.0" />
13+
<PackageReference Include="MSTest" Version="3.10.4" />
2014
</ItemGroup>
2115
<ItemGroup>
22-
<ProjectReference Include="..\Elements.Quantity\Elements.Quantity.csproj">
23-
<Project>{7da9b41e-a0f0-4392-8672-966642c94884}</Project>
24-
<Name>Elements.Quantity</Name>
25-
</ProjectReference>
16+
<ProjectReference Include="..\Elements.Quantity\Elements.Quantity.csproj" />
2617
</ItemGroup>
27-
</Project>
18+
</Project>

Elements.Quantity.sln

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,6 @@ Microsoft Visual Studio Solution File, Format Version 12.00
33
# Visual Studio Version 17
44
VisualStudioVersion = 17.7.34031.279
55
MinimumVisualStudioVersion = 10.0.40219.1
6-
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Testing", "Testing\Testing.csproj", "{F163205C-0EBA-40EC-A4ED-0AE26C4A5BC5}"
7-
EndProject
86
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Elements.Quantity", "Elements.Quantity\Elements.Quantity.csproj", "{7DA9B41E-A0F0-4392-8672-966642C94884}"
97
EndProject
108
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Elements.Quantity.Test", "Elements.Quantity.Tests\Elements.Quantity.Test.csproj", "{40DBC8C3-EF68-47E0-AA3C-83692A649E60}"
@@ -15,10 +13,6 @@ Global
1513
Release|Any CPU = Release|Any CPU
1614
EndGlobalSection
1715
GlobalSection(ProjectConfigurationPlatforms) = postSolution
18-
{F163205C-0EBA-40EC-A4ED-0AE26C4A5BC5}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
19-
{F163205C-0EBA-40EC-A4ED-0AE26C4A5BC5}.Debug|Any CPU.Build.0 = Debug|Any CPU
20-
{F163205C-0EBA-40EC-A4ED-0AE26C4A5BC5}.Release|Any CPU.ActiveCfg = Release|Any CPU
21-
{F163205C-0EBA-40EC-A4ED-0AE26C4A5BC5}.Release|Any CPU.Build.0 = Release|Any CPU
2216
{7DA9B41E-A0F0-4392-8672-966642C94884}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
2317
{7DA9B41E-A0F0-4392-8672-966642C94884}.Debug|Any CPU.Build.0 = Debug|Any CPU
2418
{7DA9B41E-A0F0-4392-8672-966642C94884}.Release|Any CPU.ActiveCfg = Release|Any CPU

Testing/App.config

Lines changed: 0 additions & 6 deletions
This file was deleted.

Testing/Program.cs

Lines changed: 0 additions & 115 deletions
This file was deleted.

Testing/Testing.csproj

Lines changed: 0 additions & 15 deletions
This file was deleted.

0 commit comments

Comments
 (0)