Skip to content

Update DotNetCore_Unit_Tests_Linux.yaml #188

Update DotNetCore_Unit_Tests_Linux.yaml

Update DotNetCore_Unit_Tests_Linux.yaml #188

name: build and test .NET Core 9.0 Linux
on:
push:
pull_request:
branches: [ release, development ]
paths:
- '**.cs'
- '**.csproj'
env:
DOTNET_VERSION: '9.0.x' # The .NET SDK version to use
jobs:
build-and-test:
name: build-and-test-linux
runs-on: ubuntu-latest
steps:
- name: Clone webprofusion/certify
uses: actions/checkout@v4
with:
path: ./certify
- name: Clone webprofusion/anvil
uses: actions/checkout@v4
with:
repository: webprofusion/anvil
ref: refs/heads/main
path: ./libs/anvil
- name: Clone webprofusion/certify-plugins (development branch push)
if: ${{ github.event_name == 'push' && (contains(github.ref_name, '_dev') || github.ref_name == 'development') }}
uses: actions/checkout@v4
with:
repository: webprofusion/certify-plugins
ref: refs/heads/development
path: ./certify-plugins
- name: Clone webprofusion/certify-plugins (release branch push)
if: ${{ github.event_name == 'push' && (contains(github.ref_name, '_rel') || github.ref_name == 'release') }}
uses: actions/checkout@v4
with:
repository: webprofusion/certify-plugins
ref: refs/heads/release
path: ./certify-plugins
- name: Clone webprofusion/certify-plugins (pull request)
if: ${{ github.event_name == 'pull_request' }}
uses: actions/checkout@v4
with:
repository: webprofusion/certify-plugins
ref: ${{ github.base_ref }}
path: ./certify-plugins
- name: Setup .NET Core
uses: actions/setup-dotnet@v4
with:
dotnet-version: ${{ env.DOTNET_VERSION }}
- name: Setup Step CLI
run: |
wget https://dl.smallstep.com/gh-release/cli/docs-cli-install/v0.23.0/step-cli_0.23.0_amd64.deb
sudo dpkg -i step-cli_0.23.0_amd64.deb
- name: Pull step-ca Docker Image
run: docker pull smallstep/step-ca
- name: Cache NuGet Dependencies
uses: actions/cache@v3
with:
path: ~/.nuget/packages
# Look to see if there is a cache hit for the corresponding requirements file
key: ${{ runner.os }}-${{ env.DOTNET_VERSION }}-nuget-${{ hashFiles('./certify/src/Certify.Tests/Certify.Core.Tests.Unit/*.csproj') }}
restore-keys: |
${{ runner.os }}-${{ env.DOTNET_VERSION }}-nuget
- name: Install Dependencies & Build Certify.Core.Tests.Unit
run: |
dotnet tool install --global dotnet-reportgenerator-globaltool --version 5.4.4
dotnet build Certify.Core.Tests.Unit.csproj -c Debug -f net9.0 --property WarningLevel=0 /clp:ErrorsOnly
working-directory: ./certify/src/Certify.Tests/Certify.Core.Tests.Unit
- name: Run Certify.Core.Tests.Unit Tests
run: |
export GITHUB_WORKSPACE="$GITHUB_WORKSPACE/certify"
export GITHUB_STEP_SUMMARY="./TestResults-${{ runner.os }}/test-summary.md"
dotnet test --no-build -f net9.0 --logger "GitHubActions;summary.includePassedTests=true;summary.includeSkippedTests=true;annotations.messageFormat=@error\n@trace"
working-directory: ./certify/src/Certify.Tests/Certify.Core.Tests.Unit
- name: ReportGenerator
uses: danielpalme/ReportGenerator-GitHub-Action@v5
with:
reports: 'coverage.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;MarkdownSummaryGithub' # The output formats and scope (separated by semicolon) Values: Badges, Clover, Cobertura, OpenCover, CsvSummary, Html, Html_Dark, Html_Light, Html_BlueRed, HtmlChart, HtmlInline, HtmlInline_AzurePipelines, HtmlInline_AzurePipelines_Dark, HtmlInline_AzurePipelines_Light, HtmlSummary, Html_BlueRed_Summary, JsonSummary, Latex, LatexSummary, lcov, MarkdownSummary, MarkdownSummaryGithub, MarkdownDeltaSummary, MHtml, SvgChart, SonarQube, TeamCitySummary, TextSummary, TextDeltaSummary, Xml, XmlSummary
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
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: Publish coverage in build summary # Only applicable if 'MarkdownSummaryGithub' or one of the other Markdown report types is generated
run: cat coveragereport/SummaryGithub.md >> $GITHUB_STEP_SUMMARY # Adjust path and filename if necessary
shell: bash
- name: Upload dotnet test Artifacts
uses: actions/upload-artifact@main
with:
name: dotnet-results-${{ runner.os }}-${{ env.DOTNET_VERSION }}
path: ./certify/src/Certify.Tests/Certify.Core.Tests.Unit/TestResults-${{ runner.os }}
if: ${{ always() }}