Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

GitHub Action Workflows for Test Runs on certify #661

Merged
merged 118 commits into from
Dec 14, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
118 commits
Select commit Hold shift + click to select a range
878edb2
First attempt adding testing Github Actions for Certify.Core.Tests.Unit
jrnelson90 Nov 30, 2023
0509bee
Fix to the .NET Version number needed to download SDK
jrnelson90 Nov 30, 2023
3c87e39
Changes for pulling dependencies, and splitting 8.0 into two workflows
jrnelson90 Dec 1, 2023
a317005
Change ref type for plugins dependency branch
jrnelson90 Dec 1, 2023
5329852
More changes to cloning dependencies in GitActions
jrnelson90 Dec 1, 2023
8564a35
Fix path for cloning certify-internal repo
jrnelson90 Dec 1, 2023
8a52afd
Testing actions without internal repo clone
jrnelson90 Dec 1, 2023
63b7c82
Fixing relative placement of cloning paths for dependency repos
jrnelson90 Dec 1, 2023
ba967cb
Setting repos for "side by side" checkout
jrnelson90 Dec 1, 2023
3ee269c
Fix paths on dotnet tool steps
jrnelson90 Dec 1, 2023
9b77371
Disable .NET 4.6.2 Test Workflow until cause of test stalls is fixed
jrnelson90 Dec 1, 2023
fc6a5dd
Default pull step for cloning webprofusion/certify-plugins
jrnelson90 Dec 1, 2023
93f8582
Add step to setup Step CLI on Windows Test Runner
jrnelson90 Dec 1, 2023
579c570
Add Github Actions step to pull step-ca docker image on Windows runner
jrnelson90 Dec 1, 2023
9f2bd0f
Add Github Actions step to pull step-ca docker image on Linux runner
jrnelson90 Dec 1, 2023
b526768
Fix Setup Step CLI GitHub Actions step for Windows runner
jrnelson90 Dec 1, 2023
e6920b9
Fix Setup Step CLI GitHub Actions step for Linux runner
jrnelson90 Dec 1, 2023
ab10858
Refactor step-ca-win to be more like step-ca Linux image with env args
jrnelson90 Dec 1, 2023
4db80f8
Changes to CertifyManagerAccountTests for Windows GitHub Actions runner
jrnelson90 Dec 1, 2023
5fdd2be
Fix to CertifyManagerAccountTests for Windows GitHub Actions runner
jrnelson90 Dec 1, 2023
49b08a4
Adding Step-CA and Step CLI dependencies to .NET 4.6.2 test GitHub flow
jrnelson90 Dec 1, 2023
c231f8c
Fix to CertifyManagerAccountTests for Windows GitHub Actions runner
jrnelson90 Dec 1, 2023
fee9359
Debug Windows runner on GitHub for CertifyManagerAccountTests
jrnelson90 Dec 1, 2023
0ef9a8d
Fixes for running CertifyManagerAccountTests in Windows GitHub Runner
jrnelson90 Dec 1, 2023
c79a1b8
Tweak to command for Setup Step CLI step in Windows GitHub Runner
jrnelson90 Dec 1, 2023
e3fe7c2
More Fixes for missing LE Accounts expected by Unit Tests
jrnelson90 Dec 1, 2023
f3530f5
Debug step for Step CLI setup in Windows GitHub Runner
jrnelson90 Dec 1, 2023
71a1d52
More fixes to running tests in GitLab Runners
jrnelson90 Dec 1, 2023
2d2d6a9
More debugging info for fixing GitLab Runners
jrnelson90 Dec 1, 2023
1d408e7
More debugging info for Step CLI step in GitLab Runners
jrnelson90 Dec 1, 2023
89ee2fd
Tweak for adding Step CLI to Windows GitLab Runner PATH
jrnelson90 Dec 1, 2023
86273c1
Another tweak for adding Step CLI to Windows GitLab Runner PATH
jrnelson90 Dec 1, 2023
07d085a
Path update for Step CLI in Windows GitLab Runner
jrnelson90 Dec 1, 2023
ac5728d
More GitHub Runner Tweaks
jrnelson90 Dec 1, 2023
a2ec8e0
Add to Windows GitHub Path using GITHUB_PATH
jrnelson90 Dec 1, 2023
162adc6
Finishing up adding Step CLI to PATH in Windows GitHub Runners
jrnelson90 Dec 1, 2023
87dc365
Testing adding code coverage report to GitHub Actions markup output
jrnelson90 Dec 5, 2023
c0b6649
Update sticky pull request comment version in Linux GitHub Action
jrnelson90 Dec 5, 2023
e06a6e4
Try using EnricoMi/publish-unit-test-result-action GitHub action
jrnelson90 Dec 5, 2023
096946e
Make coverage report without GitHub Action, using ReportGenerator CLI
jrnelson90 Dec 5, 2023
a7702dc
Debug output files to Testresults folder from dotnet test
jrnelson90 Dec 5, 2023
28d5b9a
Further debugging of test results output files
jrnelson90 Dec 5, 2023
c2e41e3
Fix path for cobertura coverage file in report generation
jrnelson90 Dec 5, 2023
48999d6
Add Coverlet Collector Package at runtime of GitHub Action for coverage
jrnelson90 Dec 5, 2023
f69aae5
Specify working directory when adding Coverlet Collector package
jrnelson90 Dec 5, 2023
01461ff
Add coverlet.collector through project dependencies rather than CLI
jrnelson90 Dec 5, 2023
568cd6a
Changes to fix loading Coverlet Collector without running dotnet publish
jrnelson90 Dec 5, 2023
d4720d7
Remove coverage directory debug step
jrnelson90 Dec 5, 2023
248a096
Remove coverage directory debug step on Linux
jrnelson90 Dec 5, 2023
40f82da
Tweaks to fix PR GitHub Actions Test jobs for Certify
jrnelson90 Dec 5, 2023
4c4e415
More tweaks to fix PR GitHub Actions Test jobs for Certify
jrnelson90 Dec 5, 2023
8a3446c
Edit to generate HTML Test Results Artifact
jrnelson90 Dec 6, 2023
da82524
Add .NET Core 3.1.x to GitHub Actions for Trx-To-HTML Tool
jrnelson90 Dec 6, 2023
5a376af
Generate HTML Test Results report with built-in Logger
jrnelson90 Dec 6, 2023
4f38cb1
Attempting to output CLI reports to Markdown in GITHUB_STEP_SUMMARY
jrnelson90 Dec 6, 2023
97e20c2
Fix for generating Test Results Markdown
jrnelson90 Dec 6, 2023
6bd2997
Tweaks to generating Markdown reports for Windows Runners
jrnelson90 Dec 6, 2023
d30b340
Change Markup Report Titles and Display Order
jrnelson90 Dec 6, 2023
08b1e17
Add Folder parameter to Test Results Generation
jrnelson90 Dec 6, 2023
5e9c424
Trying to suppress build warnings from being added to annotations
jrnelson90 Dec 6, 2023
4c561de
Trying out dorny/test-reporter action on Linux runner
jrnelson90 Dec 6, 2023
97d4483
Fix to dorny/test-reporter step for Linux GitHub Actions runner
jrnelson90 Dec 6, 2023
868d932
Trying out Tyrrrz/GitHubActionsTestLogger on Linux Runner
jrnelson90 Dec 6, 2023
1bf11d6
Fix for trying out Tyrrrz/GitHubActionsTestLogger on Linux Runner
jrnelson90 Dec 6, 2023
137876f
Another Fix for Tyrrrz/GitHubActionsTestLogger on Linux Runner
jrnelson90 Dec 6, 2023
0d586b4
Debug GITHUB_WORKSPACE value for Tyrrrz/GitHubActionsTestLogger
jrnelson90 Dec 6, 2023
6e041fa
Debug Tyrrrz/GitHubActionsTestLogger source link generation
jrnelson90 Dec 6, 2023
3e7bb45
More debugging Tyrrrz/GitHubActionsTestLogger source link generation
jrnelson90 Dec 6, 2023
273565b
More debugging Tyrrrz/GitHubActionsTestLogger source link generation
jrnelson90 Dec 6, 2023
fd04f6f
Cleanup GitHub Action Workflow YAML for .NET Core 8.0 on Windows & Linux
jrnelson90 Dec 6, 2023
7f50dd9
Fix GitHub Action Workflow YAML for .NET Core 8.0 on Windows & Linux
jrnelson90 Dec 6, 2023
9d8d0b1
Tweak to GitHub Action Workflow YAML for .NET Core 8.0 on Windows
jrnelson90 Dec 6, 2023
59dfc07
Fix paths in dotnet test step for Windows .NET Core Action
jrnelson90 Dec 6, 2023
26845dd
Debug Windows .NET Core 8.0 Test Result Generation
jrnelson90 Dec 6, 2023
477fcca
Fix Windows .NET Core 8.0 Test Result Generation
jrnelson90 Dec 7, 2023
e71ab43
Separate Test Run and Test Results step for Windows Runner .NET Core 8.0
jrnelson90 Dec 7, 2023
41d4eb8
Restore working directory info to Windows test run step
jrnelson90 Dec 7, 2023
7888621
More YAML action updates for Linux and Windows .NET Core 8.0 runners
jrnelson90 Dec 7, 2023
726439d
More tweaks to GitHub Actions for test runs on Windows and Linux
jrnelson90 Dec 7, 2023
687243b
Fix to running tests in Linux GitHub Action
jrnelson90 Dec 7, 2023
6999dc7
Fix to path to Coverlet on Linux test runner
jrnelson90 Dec 7, 2023
5c7058f
Lint cleanup for ChallengeConfigMatchTests Certify Core Unit Tests
jrnelson90 Dec 7, 2023
df28717
Refactors to speed up execution of CertifyManagerAccountTests Unit Tests
jrnelson90 Dec 7, 2023
0761cda
Test out using Linux Docker containers on Windows GitHub Action Runner
jrnelson90 Dec 7, 2023
7ce2bca
Debug Docker location in GitHub Actions Windows Runner
jrnelson90 Dec 7, 2023
68a14ec
More debugging DockerCli.exe location in GitHub Actions Windows Runner
jrnelson90 Dec 7, 2023
35fbbe5
More debugging DockerCli.exe location in GitHub Actions Windows Runner
jrnelson90 Dec 7, 2023
456e710
More debugging DockerCli.exe location in GitHub Actions Windows Runner
jrnelson90 Dec 7, 2023
dd8ce6e
More debugging DockerCli.exe location in GitHub Actions Windows Runner
jrnelson90 Dec 7, 2023
b865cd5
Simplify Docker Info command output in CertifyManagerAccountTests
jrnelson90 Dec 7, 2023
93b4570
More debugging DockerCli.exe location in GitHub Actions Windows Runner
jrnelson90 Dec 7, 2023
a578712
More debugging DockerCli.exe location in GitHub Actions Windows Runner
jrnelson90 Dec 7, 2023
2967632
More debugging DockerCli.exe location in GitHub Actions Windows Runner
jrnelson90 Dec 7, 2023
0da37c9
More debugging DockerCli.exe location in GitHub Actions Windows Runner
jrnelson90 Dec 7, 2023
ee0e9ce
More debugging DockerCli.exe location in GitHub Actions Windows Runner
jrnelson90 Dec 7, 2023
5bfff04
Restore using Windows Docker Image for Windows Runners in GitHub Actions
jrnelson90 Dec 7, 2023
4482918
Test Caching NuGet Dependencies for Linux and Windows GitHub Actions
jrnelson90 Dec 7, 2023
9732fef
Remove blank Constructor methods to enable debugging in .NET 4.6.2
jrnelson90 Dec 8, 2023
2130c9e
Fix Unit/Integration tests stalling in 4.6.2 when using CertifyManager
jrnelson90 Dec 8, 2023
06f7675
Re-enable Windows 4.6.2 Certify Core Unit Test GitHub Action Workflow
jrnelson90 Dec 8, 2023
5ee76ac
Fix to Windows .NET 4.6.2 test run GitHub Action Workflow
jrnelson90 Dec 8, 2023
5fc6963
Disable Coverage Report for .NET 4.6.2 until issue can be determined
jrnelson90 Dec 8, 2023
352477f
Fix Test Result generation for Windows .NET 4.6.2 runs
jrnelson90 Dec 8, 2023
6069c82
Fix for enabling Coverage Report on 4.6.2 Windows Test Runs
jrnelson90 Dec 8, 2023
80770d0
Another fix for enabling Coverage Report on 4.6.2 Windows Test Runs
jrnelson90 Dec 8, 2023
86dca0d
Script fix for enabling Coverage Report on 4.6.2 Windows Test Runs
jrnelson90 Dec 8, 2023
4403a99
YAML fixes for caching NuGet dependencies
jrnelson90 Dec 8, 2023
970c986
Fixes to Windows NuGet dependency caching
jrnelson90 Dec 8, 2023
7f2b842
Disable archiving Test Artifacts on all GitHub Actions Test Jobs
jrnelson90 Dec 8, 2023
9b286ce
More tweaks to NuGet Dependency caching in GitHub Actions
jrnelson90 Dec 8, 2023
58afd14
Simplify Code Coverage Generation for 4.6.2 runs
jrnelson90 Dec 9, 2023
7bce650
Simplify testing commands for GitHub Actions using .runsettings files
jrnelson90 Dec 9, 2023
bfe7739
Further fixes to GitHub Actions report generation
jrnelson90 Dec 9, 2023
aa4cb02
Fix Linux Test Results Directory to match value from ${{ runner.os }}
jrnelson90 Dec 9, 2023
a5d39ab
Filter unused DataStore Plugins from Unit Test Reports with Coverlet
jrnelson90 Dec 9, 2023
fc1efb6
Add basic Unit Test for Certify.Service so it shows on 4.6.2 coverage
jrnelson90 Dec 9, 2023
0ba73cd
Expand tests for Certify.Service
jrnelson90 Dec 13, 2023
109f7c8
Additional Certify.Service tests
jrnelson90 Dec 14, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
114 changes: 114 additions & 0 deletions .github/workflows/4_6_2_Core_Unit_Tests_Win.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,114 @@
name: build and test .NET 4.6.2 Windows

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:
# if: ${{ ! always() }}
name: build-and-test-windows
runs-on: windows-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: |
Invoke-WebRequest -Method 'GET' -uri 'https://dl.smallstep.com/gh-release/cli/docs-cli-install/v0.24.4/step_windows_0.24.4_amd64.zip' -Outfile 'C:\temp\step_windows_0.24.4_amd64.zip'
tar -oxzf C:\temp\step_windows_0.24.4_amd64.zip -C "C:\Program Files"
echo "C:\Program Files\step_0.24.4\bin" | Out-File -FilePath $env:GITHUB_PATH -Encoding utf8 -Append

- name: Pull step-ca Docker Image
run: docker pull jrnelson90/step-ca-win

- 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 }}-4.6.2-nuget-${{ hashFiles('./certify/src/Certify.Tests/Certify.Core.Tests.Unit/*.csproj') }}
restore-keys: |
${{ runner.os }}-4.6.2-nuget

- 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 add package coverlet.collector
dotnet build -c Debug -f net462 --property WarningLevel=0 /clp:ErrorsOnly
working-directory: ./certify/src/Certify.Tests/Certify.Core.Tests.Unit

- name: Run Certify.Core.Tests.Unit Tests
run: |
$env:GITHUB_WORKSPACE="$env:GITHUB_WORKSPACE\certify"
$env:GITHUB_STEP_SUMMARY=".\TestResults-4_6_2-${{ runner.os }}\test-summary.md"
dotnet test --no-build -f net462 -l "GitHubActions;summary.includePassedTests=true;summary.includeSkippedTests=true;annotations.messageFormat=@error\n@trace"
working-directory: ./certify/src/Certify.Tests/Certify.Core.Tests.Unit

- name: Generated Test Results Report
run: |
echo "# Test Results" | Out-File -FilePath $env:GITHUB_STEP_SUMMARY -Encoding utf8
(Get-Content -Path .\TestResults-4_6_2-${{ runner.os }}\test-summary.md).Replace('<details>', '<details open>') | Out-File -FilePath $env:GITHUB_STEP_SUMMARY -Encoding utf8 -Append
working-directory: ./certify/src/Certify.Tests/Certify.Core.Tests.Unit
if: ${{ always() }}

- name: Generated Test Coverage Report
run: |
reportgenerator -reports:./TestResults-4_6_2-${{ runner.os }}/*/*.cobertura.xml -targetdir:./TestResults-4_6_2-${{ runner.os }} -reporttypes:MarkdownSummaryGithub "-title:Test Coverage"
Get-Content -Path ./TestResults-4_6_2-${{ runner.os }}/SummaryGithub.md | Out-File -FilePath $env:GITHUB_STEP_SUMMARY
working-directory: ./certify/src/Certify.Tests/Certify.Core.Tests.Unit
if: ${{ always() }}

# - name: Upload dotnet test Artifacts
# uses: actions/upload-artifact@master
# with:
# name: dotnet-results-${{ runner.os }}-${{ env.DOTNET_VERSION }}
# path: ./certify/src/Certify.Tests/Certify.Core.Tests.Unit/TestResults-4_6_2-${{ runner.os }}
# # Use always() to always run this step to publish test results when there are test failures
# if: ${{ always() }}
114 changes: 114 additions & 0 deletions .github/workflows/8_0_Core_Unit_Tests_Linux.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,114 @@
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: 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.2.0
dotnet add package GitHubActionsTestLogger
dotnet add package coverlet.collector
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"
export GITHUB_STEP_SUMMARY="./TestResults-8_0-${{ runner.os }}/test-summary.md"
dotnet test --no-build -f net8.0 -l "GitHubActions;summary.includePassedTests=true;summary.includeSkippedTests=true;annotations.messageFormat=@error\n@trace"
working-directory: ./certify/src/Certify.Tests/Certify.Core.Tests.Unit

- name: Generate Test Results Report
run: |
echo "# Test Results" > $GITHUB_STEP_SUMMARY
sed -i 's/<details>/<details open>/g' ./TestResults-8_0-${{ runner.os }}/test-summary.md
cat ./TestResults-8_0-${{ runner.os }}/test-summary.md >> $GITHUB_STEP_SUMMARY
working-directory: ./certify/src/Certify.Tests/Certify.Core.Tests.Unit
if: ${{ always() }}

- 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
if: ${{ always() }}

# - name: Upload dotnet test Artifacts
# uses: actions/upload-artifact@master
# with:
# name: dotnet-results-${{ runner.os }}-${{ env.DOTNET_VERSION }}
# path: ./certify/src/Certify.Tests/Certify.Core.Tests.Unit/TestResults-8_0-${{ runner.os }}
# # Use always() to always run this step to publish test results when there are test failures
# if: ${{ always() }}
114 changes: 114 additions & 0 deletions .github/workflows/8_0_Core_Unit_Tests_Win.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,114 @@
name: build and test .NET Core 8.0 Windows

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-windows
runs-on: windows-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: |
Invoke-WebRequest -Method 'GET' -uri 'https://dl.smallstep.com/gh-release/cli/docs-cli-install/v0.24.4/step_windows_0.24.4_amd64.zip' -Outfile 'C:\temp\step_windows_0.24.4_amd64.zip'
tar -oxzf C:\temp\step_windows_0.24.4_amd64.zip -C "C:\Program Files"
echo "C:\Program Files\step_0.24.4\bin" | Out-File -FilePath $env:GITHUB_PATH -Encoding utf8 -Append

- name: Pull step-ca Docker Image
run: docker pull jrnelson90/step-ca-win

- 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.2.0
dotnet add package GitHubActionsTestLogger
dotnet add package coverlet.collector
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: |
$env:GITHUB_WORKSPACE="$env:GITHUB_WORKSPACE\certify"
$env:GITHUB_STEP_SUMMARY=".\TestResults-8_0-${{ runner.os }}\test-summary.md"
dotnet test --no-build -f net8.0 -l "GitHubActions;summary.includePassedTests=true;summary.includeSkippedTests=true;annotations.messageFormat=@error\n@trace"
working-directory: ./certify/src/Certify.Tests/Certify.Core.Tests.Unit

- name: Generate Test Results Report
run: |
echo "# Test Results" | Out-File -FilePath $env:GITHUB_STEP_SUMMARY -Encoding utf8
(Get-Content -Path .\TestResults-8_0-${{ runner.os }}\test-summary.md).Replace('<details>', '<details open>') | Out-File -FilePath $env:GITHUB_STEP_SUMMARY -Encoding utf8 -Append
working-directory: ./certify/src/Certify.Tests/Certify.Core.Tests.Unit
if: ${{ always() }}

- 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"
Get-Content -Path ./TestResults-8_0-${{ runner.os }}/SummaryGithub.md | Out-File -FilePath $env:GITHUB_STEP_SUMMARY
working-directory: ./certify/src/Certify.Tests/Certify.Core.Tests.Unit
if: ${{ always() }}

# - name: Upload dotnet test Artifacts
# uses: actions/upload-artifact@master
# with:
# name: dotnet-results-${{ runner.os }}-${{ env.DOTNET_VERSION }}
# path: ./certify/src/Certify.Tests/Certify.Core.Tests.Unit/TestResults-8_0-${{ runner.os }}
# # Use always() to always run this step to publish test results when there are test failures
# if: ${{ always() }}
11 changes: 10 additions & 1 deletion src/Certify.Core/Management/CertifyManager/CertifyManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -537,7 +537,16 @@ public async Task<bool> PerformRenewalTasks()
return await Task.FromResult(true);
}

public void Dispose() => ManagedCertificateLog.DisposeLoggers();
public void Dispose() => Cleanup();

private void Cleanup()
{
ManagedCertificateLog.DisposeLoggers();
if(_tc != null)
{
_tc.Dispose();
}
}

/// <summary>
/// Perform (or preview) an import of settings from another instance
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
using System;
using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Linq;
Expand Down Expand Up @@ -81,6 +81,7 @@ public async Task TeardownIIS()
{
await iisManager.DeleteSite(testSiteName);
Assert.IsFalse(await iisManager.SiteExists(testSiteName));
certifyManager.Dispose();
}

[TestMethod, TestCategory("MegaTest")]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ public async Task TeardownIIS()
{
await _iisManager.DeleteSite(_testSiteName);
Assert.IsFalse(await _iisManager.SiteExists(_testSiteName));
_certifyManager.Dispose();
}

[TestMethod, Description("Happy path test for using CertifyManager.GetPrimaryWebSites() for IIS")]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,11 @@ public CertifyManagerTests()
_certifyManager.Init().Wait();
}

[TestCleanup] public void Cleanup()
{
_certifyManager.Dispose();
}

[TestMethod, Description("Happy path test for using CertifyManager.GetACMEProvider()")]
public async Task TestCertifyManagerGetACMEProvider()
{
Expand Down
Loading