-
Notifications
You must be signed in to change notification settings - Fork 0
113 lines (98 loc) · 5.2 KB
/
build-test.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
name: Build / Test (with Reports)
# Run workflow on every push to the master branch
on:
workflow_dispatch:
push:
branches: [ main, dev ]
paths: src/**
pull_request:
branches: [ main ]
paths: src/**
# permissions:
# contents: read
# issues: read
# checks: write
# pull-requests: write
# pages: write
# #id-token: write
jobs:
build-test:
# use ubuntu-latest image to run steps on
runs-on: ubuntu-latest
# defaults:
# run:
# working-directory: src
steps:
# uses GitHub's checkout action to checkout code form the master branch
- name: 🛎️ Checkout
uses: actions/checkout@v4
- name: Setup .NET 8.0
uses: actions/setup-dotnet@v4
with:
dotnet-version: '8.0.x'
- name: ⬇️ Restore dependencies
run: dotnet restore
working-directory: src
- name: 🔨 Build
run: dotnet build --no-restore
working-directory: src
# Run Tests
- name: Unit Testing
# run: dotnet test Utility.Test/Utility.Test.csproj
run: dotnet test Utility.Test/Utility.Test.csproj --collect:"XPlat Code Coverage"
working-directory: src
- name: Publish Test Results
uses: EnricoMi/publish-unit-test-result-action@v2
if: always()
with:
xunit_files: 'src/Utility.Test/TestResults/**/coverage.cobertura.xml'
# ReportGenerator -reports:"src/Utility.Test/TestResults/**/coverage.cobertura.xml" -targetdir:coveragereport
- name: ReportGenerator
uses: danielpalme/[email protected]
with:
reports: 'src/Utility.Test/TestResults/**/coverage.cobertura.xml' # REQUIRED # The coverage reports that should be parsed (separated by semicolon). Globbing is supported.
targetdir: 'coveragereport' # REQUIRED # The directory where the generated report should be saved.
reporttypes: 'HtmlInline;Cobertura' # The output formats and scope (separated by semicolon) Values: Badges, Clover, Cobertura, CsvSummary, Html, Html_Dark, Html_Light, HtmlChart, HtmlInline, HtmlInline_AzurePipelines, HtmlInline_AzurePipelines_Dark, HtmlInline_AzurePipelines_Light, HtmlSummary, JsonSummary, Latex, LatexSummary, lcov, MarkdownSummary, MHtml, PngChart, SonarQube, TeamCitySummary, TextSummary, Xml, XmlSummary
# sourcedirs: '' # Optional directories which contain the corresponding source code (separated by semicolon). The source directories are used if coverage report contains classes without path information.
# historydir: '' # Optional directory for storing persistent coverage information. Can be used in future reports to show coverage evolution.
# plugins: '' # Optional plugin files for custom reports or custom history storage (separated by semicolon).
assemblyfilters: '+Utility*;-XUnit.*;-Bunit.*;-AltCover.*;-AngleSharpWrappers' # Optional list of assemblies that should be included or excluded in the report. Exclusion filters take precedence over inclusion filters. Wildcards are allowed.
classfilters: '+*;-Utility.Test' # Optional list of classes that should be included or excluded in the report. Exclusion filters take precedence over inclusion filters. Wildcards are allowed.
filefilters: '+*' # Optional list of files that should be included or excluded in the report. Exclusion filters take precedence over inclusion filters. Wildcards are allowed.
verbosity: 'Info' # The verbosity level of the log messages. Values: Verbose, Info, Warning, Error, Off
# title: '' # Optional title.
tag: '${{ github.run_number }}_${{ github.run_id }}' # Optional tag or build version.
# license: '' # Optional license for PRO version. Get your license here: https://reportgenerator.io/pro
# customSettings: '' # Optional custom settings (separated by semicolon). See: https://github.com/danielpalme/ReportGenerator/wiki/Settings.
toolpath: 'reportgeneratortool' # Default directory for installing the dotnet tool.
# - name: Deploy Code Coverage Report
# uses: peaceiris/actions-gh-pages@v3
# # if: github.event_name == 'push'
# with:
# github_token: ${{ secrets.GITHUB_TOKEN }}
# publish_dir: coveragereport
# destination_dir: coverage
# enable_jekyll: true
- name: Deploy Code Coverage Report
uses: JamesIves/[email protected]
with:
branch: gh-pages
folder: coveragereport
target-folder: coverage
- name: Upload coverage report artifact
uses: actions/[email protected]
with:
name: CoverageReport # Artifact name
path: coveragereport # Directory containing files to upload
# https://github.com/zyborg/dotnet-tests-report
# https://github.com/marketplace/actions/dotnet-tests-report
- name: use this action, test solution dir
uses: zyborg/dotnet-tests-report@v1
with:
project_path: src/Utility.Test
report_name: Tests
report_title: My Tests
github_token: ${{ secrets.GITHUB_TOKEN }}
gist_name: utility_blazor_tests.md
gist_badge_label: 'Utility Blazor: %Counters_passed%/%Counters_total%'
gist_token: ${{ secrets.GIST_TOKEN }}