Skip to content

GitHub Action Workflows for Test Runs on certify #107

GitHub Action Workflows for Test Runs on certify

GitHub Action Workflows for Test Runs on certify #107

name: build and test .NET Core 8.0 Linux
on:
push:
pull_request:
branches: [ release, development ]
paths:
- '**.cs'
- '**.csproj'
env:
DOTNET_VERSION: '8.0.100' # 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@master
with:
path: ./certify
- name: Clone webprofusion/anvil
uses: actions/checkout@master
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') }}
uses: actions/checkout@master
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') }}
uses: actions/checkout@master
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@master
with:
repository: webprofusion/certify-plugins
ref: ${{ github.base_ref }}
path: ./certify-plugins
- name: Setup .NET Core
uses: actions/setup-dotnet@master
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: Install Dependencies & Build Certify.Core.Tests.Unit
run: |
dotnet tool install --global dotnet-reportgenerator-globaltool --version 5.2.0
dotnet add package GitHubActionsTestLogger
dotnet build -c Debug -f net8.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"
echo "# Test Results" > $GITHUB_STEP_SUMMARY
dotnet test Certify.Core.Tests.Unit.dll -v normal -f net8.0 -l trx -l "GitHubActions;summary.includePassedTests=true;summary.includeSkippedTests=true;annotations.messageFormat=@error\n@trace" --collect:"XPlat Code Coverage" --results-directory "TestResults-8_0-${{ runner.os }}" /testadapterpath:$HOME/.nuget/packages/coverlet.collector/6.0.0/build/netstandard1.0 -- RunConfiguration.CollectSourceInformation=true
working-directory: ./certify/src/Certify.Tests/Certify.Core.Tests.Unit/bin/Debug/net8.0
- name: Generated Test Coverage Report
run: |
reportgenerator -reports:./TestResults-8_0-${{ runner.os }}/**/coverage.cobertura.xml -targetdir:./TestResults-8_0-${{ runner.os }} -reporttypes:MarkdownSummaryGithub "-title:Test Coverage"
cat ./TestResults-8_0-${{ runner.os }}/SummaryGithub.md > $GITHUB_STEP_SUMMARY
working-directory: ./certify/src/Certify.Tests/Certify.Core.Tests.Unit/bin/Debug/net8.0