Skip to content

Commit 7f7ac35

Browse files
committed
⏪ Revert "refactor CI workflow for improved clarity and coverage reporting"
This reverts commit a49330f.
1 parent a49330f commit 7f7ac35

File tree

1 file changed

+60
-47
lines changed

1 file changed

+60
-47
lines changed

.github/workflows/test.yml

Lines changed: 60 additions & 47 deletions
Original file line numberDiff line numberDiff line change
@@ -13,50 +13,59 @@ env:
1313

1414
jobs:
1515
lint:
16+
name: Lint & Build (Release, warn-as-error)
1617
runs-on: ubuntu-latest
18+
1719
steps:
18-
- name: Checkout
19-
uses: actions/checkout@v4
20+
- uses: actions/checkout@v4
2021

2122
- name: Setup .NET 8 SDK
2223
uses: actions/setup-dotnet@v4
2324
with:
24-
dotnet-version: 8.0.x
25+
dotnet-version: '8.0.x'
26+
27+
- name: Cache NuGet
28+
uses: actions/cache@v4
29+
with:
30+
path: ~/.nuget/packages
31+
key: nuget-${{ runner.os }}-${{ hashFiles('**/*.[cC][sS]proj', '**/*.props', '**/*.targets') }}
32+
restore-keys: nuget-${{ runner.os }}-
2533

2634
- name: Restore
2735
run: dotnet restore
2836

29-
- name: Verify formatting
30-
run: dotnet format --verify-no-changes --verbosity diagnostic
31-
32-
- name: Build (warnings as errors)
33-
run: dotnet build --configuration Release -p:TreatWarningsAsErrors=true
37+
- name: dotnet format (verify)
38+
run: dotnet format --verify-no-changes --verbosity minimal
3439

40+
- name: Build (warnings -> errors)
41+
run: dotnet build --configuration Release -p:TreatWarningsAsErrors=true --no-restore
42+
3543
test:
44+
name: Test ${{ matrix.dotnet }} on ${{ matrix.os }}
3645
needs: lint
3746
runs-on: ${{ matrix.os }}
3847

3948
strategy:
4049
fail-fast: false
4150
matrix:
4251
os: [ ubuntu-latest ]
43-
dotnet-version: [ '8.0.x', '9.0.x' ]
52+
dotnet: [ '8.0.x', '9.0.x' ]
4453

4554
steps:
46-
- name: Checkout
47-
uses: actions/checkout@v4
55+
- uses: actions/checkout@v4
4856

49-
- name: Setup .NET ${{ matrix.dotnet-version }}
57+
- name: Setup .NET SDK
5058
uses: actions/setup-dotnet@v4
5159
with:
52-
dotnet-version: ${{ matrix.dotnet-version }}
60+
dotnet-version: ${{ matrix.dotnet }}
5361

5462
- name: Cache NuGet
5563
uses: actions/cache@v4
5664
with:
5765
path: ~/.nuget/packages
58-
key: nuget-${{ runner.os }}-${{ hashFiles('**/*.csproj') }}
66+
key: nuget-${{ runner.os }}-${{ matrix.dotnet }}-${{ hashFiles('**/*.[cC][sS]proj') }}
5967
restore-keys: |
68+
nuget-${{ runner.os }}-${{ matrix.dotnet }}-
6069
nuget-${{ runner.os }}-
6170
6271
- name: Restore
@@ -65,71 +74,75 @@ jobs:
6574
- name: Build
6675
run: dotnet build --configuration Release --no-restore
6776

68-
- name: Test (with coverage)
77+
- name: Test + Coverage
6978
run: |
7079
dotnet test --configuration Release --no-build \
7180
--verbosity normal \
7281
--logger "trx;LogFileName=test-results.trx" \
73-
--collect "XPlat Code Coverage" \
74-
--results-directory ./TestResults \
75-
-- \
76-
DataCollectionRunSettings.DataCollectors.DataCollector.Configuration.Format=cobertura \
77-
DataCollectionRunSettings.DataCollectors.DataCollector.Configuration.OutputDirectory=coverage
82+
--collect "XPlat Code Coverage"
7883
79-
- name: Upload TRX results
84+
- name: Upload TRX
8085
uses: actions/upload-artifact@v4
86+
if: always()
8187
with:
82-
name: test-results-${{ matrix.dotnet-version }}
83-
path: TestResults/*.trx
88+
name: test-results-${{ matrix.dotnet }}
89+
path: '**/*.trx'
8490

85-
- name: Upload raw coverage
91+
- name: Upload coverage
8692
uses: actions/upload-artifact@v4
93+
if: always()
8794
with:
88-
name: coverage-${{ matrix.dotnet-version }}
89-
path: coverage/**/*.cobertura.xml
90-
if-no-files-found: error
91-
95+
name: coverage-${{ matrix.dotnet }}
96+
path: '**/coverage.cobertura.xml'
97+
9298
coverage:
93-
needs: test
94-
if: github.event_name == 'push' || github.event_name == 'pull_request'
99+
name: Coverage (merged)
95100
runs-on: ubuntu-latest
101+
needs: test
96102

97103
steps:
98-
- name: Checkout
99-
uses: actions/checkout@v4
104+
- uses: actions/checkout@v4
100105

101106
- name: Setup .NET 8 SDK
102107
uses: actions/setup-dotnet@v4
103108
with:
104-
dotnet-version: 8.0.x
109+
dotnet-version: '8.0.x'
105110

106-
- name: Download coverage artifacts
107-
uses: actions/download-artifact@v4
108-
with:
109-
pattern: coverage-*
110-
path: coverage
111+
- name: Restore
112+
run: dotnet restore
113+
114+
- name: Build
115+
run: dotnet build --configuration Release --no-restore
116+
117+
- name: Test w/ coverage (8.0—single run)
118+
run: |
119+
dotnet test --configuration Release --no-build \
120+
--collect "XPlat Code Coverage" \
121+
--results-directory coverage \
122+
--settings coverlet.runsettings
111123
112124
- name: Install ReportGenerator
113125
run: dotnet tool install -g dotnet-reportgenerator-globaltool
114126

115-
- name: Generate consolidated report
127+
- name: Generate HTML & Cobertura
116128
run: |
117129
reportgenerator \
118-
-reports:"coverage/**/*.cobertura.xml" \
130+
-reports:"coverage/**/*.cobertura.xml"
119131
-targetdir:"coverage/report" \
120132
-reporttypes:"Html;Cobertura;JsonSummary"
121133
122-
- name: Upload coverage report artifact
123-
uses: actions/upload-artifact@v4
124-
with:
125-
name: coverage-report
126-
path: coverage/report
127-
128134
- name: Upload to Codecov
129135
uses: codecov/codecov-action@v5
130136
env:
131137
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
132138
with:
133139
files: coverage/report/Cobertura.xml
134140
flags: unittests
135-
fail_ci_if_error: false
141+
name: codecov-umbrella
142+
fail_ci_if_error: false
143+
144+
- name: Upload coverage report artifact
145+
uses: actions/upload-artifact@v4
146+
with:
147+
name: coverage-report
148+
path: coverage/report/

0 commit comments

Comments
 (0)