Skip to content

Commit 2cdf940

Browse files
committed
Use GitHubActionsTestLogger for test reporting
1 parent 1f03002 commit 2cdf940

File tree

9 files changed

+62
-76
lines changed

9 files changed

+62
-76
lines changed

.editorconfig

+8-1
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,15 @@ indent_size = 2
2121
[*.json]
2222
indent_size = 2
2323

24-
[*.verified.txt]
24+
# Verify settings
25+
[*.{received,verified}.{txt,xml,json}]
26+
charset = "utf-8-bom"
27+
end_of_line = lf
28+
indent_size = unset
29+
indent_style = unset
2530
insert_final_newline = false
31+
tab_width = unset
32+
trim_trailing_whitespace = false
2633

2734
[*.yml]
2835
indent_size = 2

.gitattributes

+12
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,14 @@
11
# Auto detect text files and perform LF normalization
22
* text=auto
3+
4+
*.jpg binary
5+
*.png binary
6+
*.gif binary
7+
8+
*.cs text diff=csharp
9+
*.csproj text
10+
*.sln text eol=crlf
11+
12+
*.verified.txt text eol=lf working-tree-encoding=UTF-8
13+
*.verified.xml text eol=lf working-tree-encoding=UTF-8
14+
*.verified.json text eol=lf working-tree-encoding=UTF-8

.github/dependabot.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -42,9 +42,9 @@ updates:
4242
- "System.CommandLine.*"
4343
testing:
4444
patterns:
45-
- "coverlet.collector"
4645
- "FakeItEasy"
4746
- "FakeItEasy.*"
47+
- "GitHubActionsTestLogger"
4848
- "Microsoft.NET.Test.Sdk"
4949
- "Shouldly"
5050
- "Verify.Xunit"

.github/workflows/ci.yml

+17-15
Original file line numberDiff line numberDiff line change
@@ -72,23 +72,24 @@ jobs:
7272

7373
- run: dotnet r build
7474

75-
- run: dotnet r test -- --logger "trx;LogFilePrefix=${{ matrix.os }}"
75+
- run: dotnet r test -- --no-build --logger GitHubActions
7676

77-
- run: dotnet r pack -- --version-suffix ${{ env.VERSION_SUFFIX }}
77+
- run: dotnet r pack -- --no-build --version-suffix ${{ env.VERSION_SUFFIX }}
7878

7979
- name: Upload artifacts
80-
uses: actions/[email protected]
8180
if: matrix.os == 'ubuntu-latest'
81+
uses: actions/[email protected]
8282
with:
8383
name: nupkg
8484
path: ./artifacts/*.nupkg
8585

8686
- name: Upload test results
87+
if: failure()
8788
uses: actions/[email protected]
88-
if: always()
8989
with:
90-
name: test-results
91-
path: ./coverage/*.trx
90+
name: build-verify-test-results
91+
path: |
92+
**/*.received.*
9293
9394
integration:
9495
needs:
@@ -160,28 +161,29 @@ jobs:
160161
161162
- run: |
162163
if [ "${{ matrix.shell }}" == "default" ]; then
163-
dotnet r test --verbose -- --logger "trx;LogFilePrefix=${{ matrix.os }}-default"
164+
dotnet r test --verbose -- --no-build --logger GitHubActions
164165
else
165166
shellName="${{ matrix.shell }}"
166167
167168
if [[ "$shellName" == *\.exe ]]; then
168169
shellName="bash"
169170
fi
170171
171-
dotnet r test --verbose --script-shell "${{ matrix.shell }}" -- --logger "trx;LogFilePrefix=${{ matrix.os }}-$shellName"
172+
dotnet r test --verbose --script-shell "${{ matrix.shell }}" -- --no-build --logger GitHubActions
172173
fi
173174
shell: bash
174175
176+
- run: dotnet r integration:ci --verbose -- --no-build --logger GitHubActions
177+
178+
- run: dotnet r clean:bin build test --verbose
179+
175180
- name: Upload test results
181+
if: failure()
176182
uses: actions/[email protected]
177-
if: always()
178183
with:
179-
name: integration-test-results
180-
path: ./coverage/*.trx
181-
182-
- run: dotnet r integration:ci --verbose -- --logger "trx;LogFilePrefix=ci test"
183-
184-
- run: dotnet r clean:bin build test --verbose
184+
name: integration-verify-test-results
185+
path: |
186+
**/*.received.*
185187
186188
release:
187189
if: github.event_name == 'push'

.github/workflows/release.yml

+10-9
Original file line numberDiff line numberDiff line change
@@ -40,23 +40,16 @@ jobs:
4040

4141
- run: dotnet r build
4242

43-
- run: dotnet r test
43+
- run: dotnet r test -- --no-build --logger GitHubActions
4444

45-
- run: dotnet r pack
45+
- run: dotnet r pack -- --no-build
4646

4747
- name: Upload artifacts
4848
uses: actions/[email protected]
4949
with:
5050
name: nupkg
5151
path: ./artifacts/*.nupkg
5252

53-
- name: Upload test results
54-
uses: actions/[email protected]
55-
if: always()
56-
with:
57-
name: test-results
58-
path: ./coverage/*.trx
59-
6053
- name: Upload release assets
6154
uses: softprops/action-gh-release@v1
6255
id: release_updater
@@ -87,3 +80,11 @@ jobs:
8780
dotnet nuget push "./artifacts/*.nupkg" \
8881
--api-key ${{ secrets.NUGET_TOKEN }} \
8982
--source https://api.nuget.org/v3/index.json
83+
84+
- name: Upload test results
85+
if: failure()
86+
uses: actions/[email protected]
87+
with:
88+
name: verify-test-results
89+
path: |
90+
**/*.received.*

.github/workflows/test-results.yml

-35
This file was deleted.

.gitignore

-3
Original file line numberDiff line numberDiff line change
@@ -399,6 +399,3 @@ FodyWeavers.xsd
399399

400400
# Verify snapshots
401401
*.received.*
402-
403-
# Test results
404-
*.trx

global.json

+10-8
Original file line numberDiff line numberDiff line change
@@ -5,25 +5,27 @@
55
//"scriptShell": "pwsh",
66
"scripts": {
77
// project scripts
8-
"clean": "dotnet rimraf artifacts coverage",
8+
"clean": "dotnet r clean:*",
9+
"clean:artifacts": "dotnet rimraf artifacts",
910
"clean:bin": "dotnet rimraf **/bin **/obj",
10-
"prebuild": "dotnet r clean",
11+
1112
"build": "dotnet build",
12-
"test": "dotnet test --no-build --logger \"trx;LogFilePrefix=tests\" --results-directory \"./coverage\"",
13+
14+
"test": "dotnet test",
1315
"test:6": "dotnet r test -- --framework net6.0",
1416

15-
"testbase": "dotnet test --no-build --logger \"trx;LogFilePrefix=tests\" --results-directory \"./coverage\"",
16-
"test:unit": "dotnet r testbase -- --filter \"category=unit\"",
17-
"test:int": "dotnet r testbase -- --filter \"category=integration\"",
17+
"test:unit": "dotnet r test -- --filter \"category=unit\"",
18+
"test:int": "dotnet r test -- --filter \"category=integration\"",
1819

19-
"pack": "dotnet pack --no-build --output \"./artifacts\"",
20+
"prepack": "dotnet r clean:artifacts",
21+
"pack": "dotnet pack --output \"./artifacts\"",
2022

2123
"build:release": "dotnet r build -- --configuration Release",
2224
"test:release": "dotnet r test -- --configuration Release",
2325
"pack:release": "dotnet r pack -- --configuration Release",
2426

2527
// integration tests
26-
"integration:ci": "dotnet r clean clean:bin && dotnet build && dotnet test --no-build",
28+
"integration:ci": "dotnet r clean build && dotnet test --no-build",
2729

2830
// test scripts
2931
"info": "dotnet r dotnet:version dotnet:info",

test/Tests.csproj

+4-4
Original file line numberDiff line numberDiff line change
@@ -11,15 +11,15 @@
1111
</ItemGroup>
1212

1313
<ItemGroup>
14-
<PackageReference Include="coverlet.collector" Version="6.0.0">
15-
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
16-
<PrivateAssets>all</PrivateAssets>
17-
</PackageReference>
1814
<PackageReference Include="FakeItEasy" Version="7.4.0" />
1915
<PackageReference Include="FakeItEasy.Analyzer.CSharp" Version="6.1.1">
2016
<PrivateAssets>all</PrivateAssets>
2117
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
2218
</PackageReference>
19+
<PackageReference Include="GitHubActionsTestLogger" Version="2.3.3">
20+
<PrivateAssets>all</PrivateAssets>
21+
<IncludeAssets>runtime; build; native; contentfiles; analyzers</IncludeAssets>
22+
</PackageReference>
2323
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.7.1" />
2424
<PackageReference Include="Shouldly" Version="4.2.1" />
2525
<PackageReference Include="Verify.Xunit" Version="20.8.2" />

0 commit comments

Comments
 (0)