Skip to content

Bump Verify.Xunit from 26.6.0 to 27.0.1 in /src/HomeInventory (#1009) #2167

Bump Verify.Xunit from 26.6.0 to 27.0.1 in /src/HomeInventory (#1009)

Bump Verify.Xunit from 26.6.0 to 27.0.1 in /src/HomeInventory (#1009) #2167

Workflow file for this run

name: Build
on:
push:
branches:
- main
pull_request:
branches:
- main
release:
types:
- published
workflow_dispatch:
env:
CI: true
# Disable the .NET logo in the console output.
DOTNET_NOLOGO: true
# Disable the .NET first time experience to skip caching NuGet packages and speed up the build.
DOTNET_SKIP_FIRST_TIME_EXPERIENCE: true
# Disable sending .NET CLI telemetry to Microsoft.
DOTNET_CLI_TELEMETRY_OPTOUT: true
# Set the build number in MinVer.
MINVERBUILDMETADATA: build.${{github.run_number}}
jobs:
build:
permissions:
pull-requests: write
packages: write
checks: write
actions: write
statuses: write
name: Build .NET
runs-on: ubuntu-latest
steps:
- name: "Checkout"
uses: actions/checkout@v4
with:
lfs: true
fetch-depth: 0
- name: "Install .NET SDK"
uses: actions/setup-dotnet@v4
with:
global-json-file: ./src/HomeInventory/global.json
- name: Info
run: dotnet --info
working-directory: ./src/HomeInventory
- name: Download cached dependencies
uses: actions/cache@v4
with:
path: ~/.nuget/packages
# Look to see if there is a cache hit for the corresponding requirements file
key: ${{ runner.os }}-nuget-${{github.ref}}
restore-keys: |
${{ runner.os }}-nuget-refs/heads/main
- name: Restore dependencies
run: dotnet restore HomeInventory.sln -v minimal
working-directory: ./src/HomeInventory
- name: Build Release
run: dotnet build HomeInventory.sln -m:1 -c Release -v minimal --nologo --no-incremental --no-restore --no-self-contained
working-directory: ./src/HomeInventory
- name: Cache build results
uses: actions/cache@v4
with:
path: ./src/HomeInventory
key: ${{ runner.os }}-build-${{github.ref}}-${{github.run_number}}
format-test:
name: "Formatting test"
needs: build
if: ${{ success() }}
runs-on: ubuntu-latest
steps:
- name: "Checkout"
uses: actions/checkout@v4
with:
lfs: true
fetch-depth: 0
- name: "Install .NET SDK"
uses: actions/setup-dotnet@v4
with:
global-json-file: ./src/HomeInventory/global.json
- name: Info
run: dotnet --info
working-directory: ./src/HomeInventory
- name: Download cached dependencies
uses: actions/cache@v4
with:
path: ~/.nuget/packages
# Look to see if there is a cache hit for the corresponding requirements file
key: ${{ runner.os }}-nuget-${{github.ref}}
restore-keys: |
${{ runner.os }}-nuget-refs/heads/main
- name: Check formatting
run: dotnet format --verify-no-changes --severity error --verbosity diag HomeInventory.sln || (echo "Run 'dotnet format' to fix issues" && exit 1)
working-directory: ./src/HomeInventory
unit-test:
name: "Unit Test .NET"
needs: build
if: ${{ success() }}
permissions:
checks: write
pull-requests: write
runs-on: ubuntu-latest
steps:
- name: "Checkout"
uses: actions/checkout@v4
with:
lfs: true
fetch-depth: 0
- name: "Install .NET SDK"
uses: actions/setup-dotnet@v4
with:
global-json-file: ./src/HomeInventory/global.json
- name: Info
run: dotnet --info
working-directory: ./src/HomeInventory
- name: Cache build results
uses: actions/cache@v4
with:
path: ./src/HomeInventory
key: ${{ runner.os }}-build-${{github.ref}}-${{github.run_number}}
- name: Download cached dependencies
uses: actions/cache@v4
with:
path: ~/.nuget/packages
# Look to see if there is a cache hit for the corresponding requirements file
key: ${{ runner.os }}-nuget-${{github.ref}}
restore-keys: |
${{ runner.os }}-nuget-refs/heads/main
- name: Run Architecture Tests
run: dotnet test HomeInventory.Tests --filter "Category=Architecture" -c Release -v minimal
working-directory: ./src/HomeInventory
- name: Run Unit Tests
if: success() || failure()
run: dotnet test HomeInventory.Tests --filter "Category=Unit" -c Release -v minimal --collect:"XPlat Code Coverage;CollectCoverage=true;Format=json,lcov,cobertura,opencover;SkipAutoProps=true;IncludeTestAssembly=false;ExcludeByFile=\"**/*.g.cs\"" --logger trx --results-directory ./coverage
working-directory: ./src/HomeInventory
- name: Test Report
uses: dorny/[email protected]
if: success() || failure()
with:
name: Unit tests # Name of the check run which will be created
path: "./src/HomeInventory/coverage/*.trx" # Path to test results
reporter: dotnet-trx # Format of test results
- name: Publish Test Results
uses: EnricoMi/publish-unit-test-result-action@v2
continue-on-error: true
if: always()
with:
files: |
./src/HomeInventory/coverage/**/*.trx
- name: Collect Coverage
run: cp coverage/**/coverage.cobertura.xml coverage.cobertura.xml
working-directory: ./src/HomeInventory
- name: Code Coverage Summary Report
id: report
uses: irongut/[email protected]
with:
filename: ./src/HomeInventory/coverage.cobertura.xml
badge: true
fail_below_min: true
format: markdown
hide_branch_rate: false
hide_complexity: true
indicators: true
output: both
thresholds: "60 80"
- name: Add Coverage PR Comment
uses: marocchino/sticky-pull-request-comment@v2
if: ${{ github.event_name == 'pull_request' && (success() || steps.report.conclusion == 'failure') }}
with:
header: "Unit test coverage summary"
recreate: true
path: code-coverage-results.md
- name: Write coverage to Job Summary
if: ${{ success() || steps.report.conclusion == 'failure' }}
run: cat code-coverage-results.md >> $GITHUB_STEP_SUMMARY
- name: Create code coverage report
uses: danielpalme/[email protected]
if: ${{ success() || steps.report.conclusion == 'failure' }}
with:
reports: "./src/HomeInventory/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: "MarkdownSummaryGithub;HtmlInline_AzurePipelines_Dark;Cobertura;CodeClimate" # 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, MarkdownSummaryGithub, MarkdownDeltaSummary, MHtml, PngChart, SonarQube, TeamCitySummary, TextSummary, TextDeltaSummary, Xml, XmlSummary
sourcedirs: "./src/HomeInventory" # 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: "+*" # Optional list of assemblies that should be included or excluded in the report. Exclusion filters take precedence over inclusion filters. Wildcards are allowed.
classfilters: "+*" # 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: Add Coverage PR Comment 2
uses: marocchino/sticky-pull-request-comment@v2
if: ${{ github.event_name == 'pull_request' && (success() || steps.report.conclusion == 'failure') }}
with:
header: "Detailed"
recreate: true
path: coveragereport/SummaryGithub.md
- name: Write coverage to Job Summary 2
if: ${{ success() || steps.report.conclusion == 'failure' }}
run: cat coveragereport/SummaryGithub.md >> $GITHUB_STEP_SUMMARY
- name: Upload coverage report artifact
uses: actions/[email protected]
if: ${{ success() || steps.report.conclusion == 'failure' }}
with:
name: CoverageReport # Artifact name
path: coveragereport # A file, directory or wildcard pattern that describes what to upload
if-no-files-found: warn # The desired behavior if no files are found using the provided path.
retention-days: 90 # Duration after which artifact will expire in days. 0 means using default retention.
intergration-test:
name: "Integration Test .NET"
needs: build
if: ${{ success() }}
permissions:
checks: write
pull-requests: write
runs-on: ubuntu-latest
steps:
- name: "Checkout"
uses: actions/checkout@v4
with:
lfs: true
fetch-depth: 0
- name: "Install .NET SDK"
uses: actions/setup-dotnet@v4
with:
global-json-file: ./src/HomeInventory/global.json
- name: Info
run: dotnet --info
working-directory: ./src/HomeInventory
- name: Cache build results
uses: actions/cache@v4
with:
path: ./src/HomeInventory
key: ${{ runner.os }}-build-${{github.ref}}-${{github.run_number}}
- name: Download cached dependencies
uses: actions/cache@v4
with:
path: ~/.nuget/packages
# Look to see if there is a cache hit for the corresponding requirements file
key: ${{ runner.os }}-nuget-${{github.ref}}
restore-keys: |
${{ runner.os }}-nuget-refs/heads/main
- name: Run Integration Tests
run: dotnet test HomeInventory.Tests.Integration --filter "Category=Integration" -c Release -v minimal
working-directory: ./src/HomeInventory
acceptance-test:
name: "Acceptance Test .NET"
needs: build
if: ${{ success() }}
permissions:
checks: write
pull-requests: write
runs-on: ubuntu-latest
steps:
- name: "Checkout"
uses: actions/checkout@v4
with:
lfs: true
fetch-depth: 0
- name: "Install .NET SDK"
uses: actions/setup-dotnet@v4
with:
global-json-file: ./src/HomeInventory/global.json
- name: Info
run: dotnet --info
working-directory: ./src/HomeInventory
- name: Cache build results
uses: actions/cache@v4
with:
path: ./src/HomeInventory
key: ${{ runner.os }}-build-${{github.ref}}-${{github.run_number}}
- name: Download cached dependencies
uses: actions/cache@v4
with:
path: ~/.nuget/packages
# Look to see if there is a cache hit for the corresponding requirements file
key: ${{ runner.os }}-nuget-${{github.ref}}
restore-keys: |
${{ runner.os }}-nuget-refs/heads/main
- name: Run Acceptance Tests
run: dotnet test HomeInventory.Tests.Acceptance -c Release -v minimal --logger:"trx;verbosity=normal;LogFileName=./Acceptance/AcceptanceTestResults.trx"
working-directory: ./src/HomeInventory
- name: Install Living Documentation Tool
run: dotnet tool install --global SpecFlow.Plus.LivingDoc.CLI
- name: Generate Living Documentation Specification
run: livingdoc test-assembly "HomeInventory.Tests.Acceptance/bin/Release/net8/HomeInventory.Tests.Acceptance.dll" -t "HomeInventory.Tests.Acceptance/bin/Release/net8/TestExecution.json" -o "./Acceptance/AcceptanceTestResults.html"
working-directory: ./src/HomeInventory
- name: Publish Specflow Test Results
if: success() || failure()
uses: actions/[email protected]
with:
name: "Specflow Test Results"
path: ./Acceptance/AcceptanceTestResults.html
if-no-files-found: warn # The desired behavior if no files are found using the provided path.
retention-days: 90 # Duration after which artifact will expire in days. 0 means using default retention.