Skip to content

Merge branch 'main' into dependabot/nuget/src/application/Azure.Local… #23

Merge branch 'main' into dependabot/nuget/src/application/Azure.Local…

Merge branch 'main' into dependabot/nuget/src/application/Azure.Local… #23

# This workflow will build a .NET project for Dependabot branches
# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-net
name: Dependabot Build And Test
permissions:
contents: read
actions: read
statuses: write
on:
push:
branches:
- 'dependabot/**'
pull_request:
branches: [ "master", "main" ]
types: [opened, synchronize, reopened]
jobs:
build:
# Only run if the branch name or PR title starts with "Bump the grouped-dependencies group with"
if: |
(github.event_name == 'push' && startsWith(github.event.head_commit.message, 'Bump the grouped-dependencies group with')) ||
(github.event_name == 'pull_request' && startsWith(github.event.pull_request.title, 'Bump the grouped-dependencies group with'))
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Setup .NET
uses: actions/setup-dotnet@v4
with:
dotnet-version: 10.0.x
- name: Restore Dependencies
run: dotnet restore
- name: Build Project
run: dotnet build --no-restore
- name: Run Tests
run: dotnet test ./tests/Azure.Local.Tests/Azure.Local.Tests.csproj --verbosity detailed --logger trx --results-directory ${{ github.workspace }}/unittests
- name: Upload Test Results
uses: actions/upload-artifact@v4
with:
name: unittestresults
path: ${{ github.workspace }}/unittests
- name: Run Tests For Coverage
run: dotnet test --no-build --verbosity normal --collect:"XPlat Code Coverage" --results-directory ${{ github.workspace }}/coverage --settings:./codecoverage.runsettings
- name: Combine Coverage Reports as Cobertura # This is because one report is produced per project, and we want one result for all of them.
uses: danielpalme/[email protected]
with:
reports: "**/*.cobertura.xml" # REQUIRED # The coverage reports that should be parsed (separated by semicolon). Globbing is supported.
targetdir: "${{ github.workspace }}" # REQUIRED # The directory where the generated report should be saved.
reporttypes: "Cobertura" # The output formats and scope (separated by semicolon) Values: Badges, Clover, Cobertura, CsvSummary, Html, Html_Dark, Html_Light, Html_BlueRed, 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
verbosity: "Info" # The verbosity level of the log messages. Values: Verbose, Info, Warning, Error, Off
title: "Code Coverage Xml" # Optional title.
tag: "${{ github.run_number }}_${{ github.run_id }}" # Optional tag or build version.
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: Combine Coverage Reports as Html # This is because one report is produced per project, and we want one result for all of them.
uses: danielpalme/[email protected]
with:
reports: "**/*.cobertura.xml" # REQUIRED # The coverage reports that should be parsed (separated by semicolon). Globbing is supported.
targetdir: "${{ github.workspace }}/codecoverage" # REQUIRED # The directory where the generated report should be saved.
reporttypes: "Html" # The output formats and scope (separated by semicolon) Values: Badges, Clover, Cobertura, CsvSummary, Html, Html_Dark, Html_Light, Html_BlueRed, 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
verbosity: "Verbose" # The verbosity level of the log messages. Values: Verbose, Info, Warning, Error, Off
title: "Code Coverage Html" # Optional title.
tag: "${{ github.run_number }}_${{ github.run_id }}" # Optional tag or build version.
customSettings: "" # Optional custom settings (separated by semicolon). See: https://github.com/danielpalme/ReportGenerator/wiki/Settings.
toolpath: "reportgeneratortool" # Default directory for installing the dotnet tool.
classfilters: "-System.Runtime.CompilerServices;-Microsoft.AspNetCore.OpenApi.Generated;-AutoGeneratedProgram;-Azure.Local.ApiService.Tests.Component.*;-*.TestHelper;-*.ApplicationUnitTests"
- name: Upload Combined Artifact Of Xml Code Coverage Report
uses: actions/upload-artifact@v4
with:
name: code-coverage-report-cobertura
path: ${{ github.workspace }}/Cobertura.xml
- name: Upload Combined Artifact Of Cobutura Code Coverage Report
uses: actions/upload-artifact@v4
with:
name: code-coverage-report-html
path: ${{ github.workspace }}/codecoverage
- name: Generate Code Coverage Report
uses: irongut/[email protected]
with:
filename: cobertura.xml
badge: true
fail_below_min: false
format: markdown
hide_branch_rate: false
hide_complexity: true
indicators: true
output: both
thresholds: '60 80'
- name: Write Code Coverage To Job Summary
run: cat code-coverage-results.md >> $GITHUB_STEP_SUMMARY