Skip to content

Commit fff9093

Browse files
author
Petr Sramek
committed
updated dotnet workflow
1 parent 6b4eed3 commit fff9093

File tree

1 file changed

+33
-42
lines changed

1 file changed

+33
-42
lines changed

.github/workflows/dotnet.yml

Lines changed: 33 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@ env:
3232
build-configuration: 'Release'
3333
build-platform: 'Any CPU'
3434
git-version: '6.0.x'
35+
test-result-directory: ${{ runner.temp }}/test-results
3536

3637
jobs:
3738
versioning:
@@ -44,16 +45,16 @@ jobs:
4445
PACKAGE_VERSION: ${{ fromJSON(format('[ "{0}{1}", "{0}" ]', steps.gitversion.outputs.assemblySemVer, steps.gitversion.outputs.preReleaseLabelWithDash))[fromJSON(env.is-release)] }}
4546

4647
steps:
47-
- name: Checkout ${{ github.head_ref || github.ref }}
48+
- name: 'Checkout ${{ github.head_ref || github.ref }}'
4849
uses: actions/checkout@v4
4950
with:
5051
fetch-depth: 0
51-
- name: Install GitVersion
52+
- name: Install GitVersion ${{ env.git-version }}
5253
uses: gittools/actions/gitversion/setup@v3.1.11
5354
with:
5455
versionSpec: ${{ env.git-version }}
5556
preferLatestVersion: true
56-
- name: Calculate version with GitVersion ${{ env.git-version }}
57+
- name: Determine version with GitVersion ${{ env.git-version }}
5758
id: gitversion
5859
uses: gittools/actions/gitversion/execute@v3.1.11
5960
with:
@@ -69,62 +70,52 @@ jobs:
6970
ASSEMBLY_INFORMATIONAL_VERSION: ${{ needs.versioning.outputs.ASSEMBLY_INFORMATIONAL_VERSION }}
7071
FILE_VERSION: ${{ needs.versioning.outputs.FILE_VERSION }}
7172
steps:
72-
- name: Checkout ${{ github.head_ref || github.ref }}
73+
- name: 'Checkout ${{ github.head_ref || github.ref }}'
7374
uses: actions/checkout@v4
7475
- uses: ./.github/actions/build
7576
with:
7677
assembly-version: ${{ env.ASSEMBLY_VERSION }}
7778
assembly-informational-version: ${{ env.ASSEMBLY_INFORMATIONAL_VERSION }}
7879
assembly-file-version: ${{ env.FILE_VERSION }}
7980
build-glob-pattern: ${{ vars.SRC_DEFAULT_GLOB_PATTERN }}
80-
# - name: Setup .NET ${{ env.dotnet-sdk-version }}
81-
# uses: actions/setup-dotnet@v4
82-
# with:
83-
# dotnet-version: ${{ env.dotnet-sdk-version }}
84-
# - name: Build with .NET ${{ env.dotnet-sdk-version }}
85-
# run: dotnet build ${{ vars.SRC_SEARCH_PATTERN }} --configuration ${{ env.build-configuration }} /p:Platform=${{ env.build-platform }} /p:Version=${{ env.ASSEMBLY_VERSION }} /p:AssemblyInformationalVersion=${{ env.ASSEMBLY_INFORMATIONAL_VERSION }} /p:FileVersion=${{ env.FILE_VERSION }}
86-
# - name: Upload Build
87-
# uses: actions/upload-artifact@v4
88-
# with:
89-
# name: build
90-
# path: |
91-
# **/bin/*
92-
# **/obj/*
9381

9482
test:
9583
name: Test with .NET
9684
needs: [build]
9785
runs-on: ubuntu-latest
9886
steps:
99-
- name: Checkout ${{ github.head_ref || github.ref }}
87+
- name: 'Checkout ${{ github.head_ref || github.ref }}'
10088
uses: actions/checkout@v4
101-
- name: Setup .NET
89+
- name: 'Setup .NET'
10290
uses: actions/setup-dotnet@v4
10391
with:
10492
dotnet-version: ${{ env.dotnet-sdk-version }}
93+
- uses: ./.github/actions/test
94+
with:
95+
test-project-glob-pattern: ${{ vars.TEST_DEFAULT_GLOB_PATTERN }}
96+
test-runsettings-path: 'unit-test.runsettings'
10597
- name: Test with .NET
106-
run: dotnet test ${{ vars.TEST_DEFAULT_GLOB_PATTERN }} --configuration ${{ env.build-configuration }} --verbosity normal --settings unit-test.runsettings -- --coverage --coverage-output-format cobertura --report-trx --results-directory ${{ runner.temp }}/test-results/
98+
run: dotnet test ${{ vars.TEST_DEFAULT_GLOB_PATTERN }} --configuration ${{ env.build-configuration }} --verbosity normal --settings -- --coverage --coverage-output-format cobertura --report-trx --results-directory ${{ runner.temp }}/test-results/
10799
- name: Upload Test Results
108100
uses: actions/upload-artifact@v4
109101
with:
110102
name: test-results
111-
path: |
112-
${{ runner.temp }}/test-results/*
113-
- run: dotnet tool install --global LiquidTestReports.Cli --prerelease
114-
- run: ls -R ${{ runner.temp }}/test-results/
115-
- run: liquid --inputs "Folder=${{ runner.temp }}/test-results/;File=**/*.trx;Format=Trx" --output-file ${{ runner.temp }}/test-results/test-report.md
116-
- run: cat ${{ runner.temp }}/test-results/*.md >> $GITHUB_STEP_SUMMARY
117-
name: Write Test Results Summary
118-
- run: dotnet tool update --global dotnet-coverage
119-
name: Update dotnet-coverage tool
120-
- run: dotnet-coverage merge --output ${{ runner.temp }}/test-results/test-result.cobertura.xml --output-format cobertura "${{ runner.temp }}/test-results/**/*.cobertura.xml"
121-
name: Merge Code Coverage Results
122-
- run: dotnet tool update --global dotnet-reportgenerator-globaltool
123-
name: Update dotnet-reportgenerator-globaltool tool
124-
- run: reportgenerator -reports:${{ runner.temp }}/test-results/test-result.cobertura.xml -targetdir:${{ runner.temp }}/test-results/coverage-report -reporttypes:"MarkdownSummary"
125-
name: Generate Code Coverage Results
126-
- run: cat ${{ runner.temp }}/test-results/coverage-report/Summary.md >> $GITHUB_STEP_SUMMARY
127-
name: Write Code Coverage Summary
103+
path: ${{ runner.temp }}/test-results/*
104+
# - run: dotnet tool install --global LiquidTestReports.Cli --prerelease
105+
# - run: ls -R ${{ runner.temp }}/test-results/
106+
# - run: liquid --inputs "Folder=${{ runner.temp }}/test-results/;File=**/*.trx;Format=Trx" --output-file ${{ runner.temp }}/test-results/test-report.md
107+
# - run: cat ${{ runner.temp }}/test-results/*.md >> $GITHUB_STEP_SUMMARY
108+
# name: Write Test Results Summary
109+
# - run: dotnet tool update --global dotnet-coverage
110+
# name: Update dotnet-coverage tool
111+
# - run: dotnet-coverage merge --output ${{ runner.temp }}/test-results/test-result.cobertura.xml --output-format cobertura "${{ runner.temp }}/test-results/**/*.cobertura.xml"
112+
# name: Merge Code Coverage Results
113+
# - run: dotnet tool update --global dotnet-reportgenerator-globaltool
114+
# name: Update dotnet-reportgenerator-globaltool tool
115+
# - run: reportgenerator -reports:${{ runner.temp }}/test-results/test-result.cobertura.xml -targetdir:${{ runner.temp }}/test-results/coverage-report -reporttypes:"MarkdownSummary"
116+
# name: Generate Code Coverage Results
117+
# - run: cat ${{ runner.temp }}/test-results/coverage-report/Summary.md >> $GITHUB_STEP_SUMMARY
118+
# name: Write Code Coverage Summary
128119

129120
pack:
130121
name: Pack with .NET
@@ -136,7 +127,7 @@ jobs:
136127
FILE_VERSION: ${{ needs.versioning.outputs.FILE_VERSION }}
137128
PACKAGE_VERSION: ${{ needs.versioning.outputs.PACKAGE_VERSION }}
138129
steps:
139-
- name: Checkout ${{ github.head_ref || github.ref }}
130+
- name: 'Checkout ${{ github.head_ref || github.ref }}'
140131
uses: actions/checkout@v4
141132
- name: Setup .NET
142133
uses: actions/setup-dotnet@v4
@@ -166,7 +157,7 @@ jobs:
166157
os: [ubuntu-latest, windows-latest, macos-latest]
167158
runs-on: ${{ matrix.os }}
168159
steps:
169-
- name: Checkout ${{ github.head_ref || github.ref }}
160+
- name: 'Checkout ${{ github.head_ref || github.ref }}'
170161
uses: actions/checkout@v4
171162
- name: Install .NET SDK
172163
uses: actions/setup-dotnet@v4
@@ -202,7 +193,7 @@ jobs:
202193
url: ${{ steps.deployment.outputs.page_url }}
203194
runs-on: ubuntu-latest
204195
steps:
205-
- name: Checkout ${{ github.head_ref || github.ref }}
196+
- name: 'Checkout ${{ github.head_ref || github.ref }}'
206197
uses: actions/checkout@v4
207198
- name: Dotnet Setup
208199
uses: actions/setup-dotnet@v4
@@ -240,7 +231,7 @@ jobs:
240231
name: private-nuget-feed
241232
runs-on: ubuntu-latest
242233
steps:
243-
- name: Checkout ${{ github.head_ref || github.ref }}
234+
- name: 'Checkout ${{ github.head_ref || github.ref }}'
244235
uses: actions/checkout@v4
245236
- name: Dotnet Setup
246237
uses: actions/setup-dotnet@v4
@@ -264,7 +255,7 @@ jobs:
264255
name: public-nuget-feed
265256
runs-on: ubuntu-latest
266257
steps:
267-
- name: Checkout ${{ github.head_ref || github.ref }}
258+
- name: 'Checkout ${{ github.head_ref || github.ref }}'
268259
uses: actions/checkout@v4
269260
- name: Dotnet Setup
270261
uses: actions/setup-dotnet@v4

0 commit comments

Comments
 (0)