Skip to content

Commit

Permalink
update workflows (#277)
Browse files Browse the repository at this point in the history
* update workflows

* Add error to logging when email credentials not found

* update workflows

* Update unit test configuration
  • Loading branch information
k3ldar authored Sep 9, 2023
1 parent ab4198c commit c98f25d
Show file tree
Hide file tree
Showing 37 changed files with 111 additions and 50 deletions.
19 changes: 13 additions & 6 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,15 +10,16 @@ jobs:
name: Build
runs-on: windows-latest
steps:
- name: Set up JDK 11
uses: actions/setup-java@v1
- name: Set up JDK 17
uses: actions/setup-java@v3
with:
java-version: 1.11
- uses: actions/checkout@v2
java-version: 17
distribution: 'zulu' # Alternative distribution options are available.
- uses: actions/checkout@v3
with:
fetch-depth: 0 # Shallow clones should be disabled for a better relevancy of analysis
- name: Cache SonarCloud packages
uses: actions/cache@v1
uses: actions/cache@v3
with:
path: ~\sonar\cache
key: ${{ runner.os }}-sonar
Expand All @@ -36,13 +37,19 @@ jobs:
run: |
New-Item -Path .\.sonar\scanner -ItemType Directory
dotnet tool update dotnet-sonarscanner --tool-path .\.sonar\scanner
- name: Install Code Coverage
shell: powershell
run: |
dotnet tool install --global dotnet-coverage
- name: Build and analyze
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # Needed to get PR information, if any
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
shell: powershell
run: |
.\.sonar\scanner\dotnet-sonarscanner begin /k:"k3ldar_.NetCorePluginManager" /o:"pluginmanager" /d:sonar.login="${{ secrets.SONAR_TOKEN }}" /d:sonar.host.url="https://sonarcloud.io"
.\.sonar\scanner\dotnet-sonarscanner begin /k:"k3ldar_.NetCorePluginManager" /o:"pluginmanager" /d:sonar.login="${{ secrets.SONAR_TOKEN }}" /d:sonar.cs.vscoveragexml.reportsPaths=coverage.xml /d:sonar.host.url="https://sonarcloud.io"
dotnet restore ./AspNetCore.PluginManager.Solution.sln
dotnet build ./AspNetCore.PluginManager.Solution.sln --configuration Release
dotnet test --collect "Code Coverage"
dotnet-coverage collect "dotnet test ./AspNetCore.PluginManager.Solution.sln" -f xml -o "coverage.xml"
.\.sonar\scanner\dotnet-sonarscanner end /d:sonar.login="${{ secrets.SONAR_TOKEN }}"
11 changes: 0 additions & 11 deletions .github/workflows/codeql-analysis.yml
Original file line number Diff line number Diff line change
@@ -1,14 +1,3 @@
# For most projects, this workflow file will not need changing; you simply need
# to commit it to your repository.
#
# You may wish to alter this file to override the set of languages analyzed,
# or to provide custom queries or build logic.
#
# ******** NOTE ********
# We have attempted to detect the languages in your repository. Please check
# the `language` matrix defined below to confirm you have the correct set of
# supported CodeQL languages.
#
name: "CodeQL"

on:
Expand Down
15 changes: 13 additions & 2 deletions AspNetCore.PluginManager.Solution.sln
Original file line number Diff line number Diff line change
Expand Up @@ -72,8 +72,6 @@ EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{9D6C1367-C141-4577-8E9C-5710C9D5E516}"
ProjectSection(SolutionItems) = preProject
.editorconfig = .editorconfig
appveyor.yml = appveyor.yml
azure-pipelines.yml = azure-pipelines.yml
Directory.Build.props = Directory.Build.props
README.md = README.md
ReleaseNotes.txt = ReleaseNotes.txt
Expand Down Expand Up @@ -111,6 +109,16 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "PluginManager.DAL.TextFiles
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Resources.Plugin", "Plugins\Resources.Plugin\Resources.Plugin.csproj", "{33E06D80-EEED-491E-A212-7C5E6688A37D}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = ".github", ".github", "{0B6CC20A-FE83-4CC7-A836-06CE25C5F24C}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "workflows", "workflows", "{30CA931F-8150-451B-8720-11D53C7C9749}"
ProjectSection(SolutionItems) = preProject
.github\workflows\build.yml = .github\workflows\build.yml
.github\workflows\codeql-analysis.yml = .github\workflows\codeql-analysis.yml
EndProjectSection
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "ISSUE_TEMPLATE", "ISSUE_TEMPLATE", "{054AB9E6-B61B-416E-9680-8F470C38D767}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Expand Down Expand Up @@ -304,6 +312,9 @@ Global
{615AE0C8-2986-49AB-9B84-139E252CCB59} = {8522A683-113C-49D8-BA64-E6677D72A5E9}
{59B9833B-8752-4257-AB07-244555F71E96} = {19AFBC9B-7D1B-4405-871F-00763C364C86}
{2CA6425F-5474-43CC-AC87-47A4D49A8ADA} = {19AFBC9B-7D1B-4405-871F-00763C364C86}
{0B6CC20A-FE83-4CC7-A836-06CE25C5F24C} = {9D6C1367-C141-4577-8E9C-5710C9D5E516}
{30CA931F-8150-451B-8720-11D53C7C9749} = {0B6CC20A-FE83-4CC7-A836-06CE25C5F24C}
{054AB9E6-B61B-416E-9680-8F470C38D767} = {0B6CC20A-FE83-4CC7-A836-06CE25C5F24C}
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {144AC182-32DC-41B2-9617-BBB390D27A65}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -166,6 +166,15 @@ private void RetrieveEmailsFromPop3Server(List<ReceivedEmail> messages)
string password = Environment.GetEnvironmentVariable("EmailUserPassword");
string port = Environment.GetEnvironmentVariable("EmailPop3Port");

if (String.IsNullOrEmpty(pop3Server) || String.IsNullOrEmpty(userName) || String.IsNullOrEmpty(password) || String.IsNullOrEmpty(port))
{
_logger.AddToLog(PluginManager.LogLevel.Error, "Environment variables not setup for email");
pop3Server = String.Empty;
userName = String.Empty;
password = String.Empty;
port = String.Empty;
}

using IPop3Client popClient = _pop3ClientFactory.Create();

popClient.Initialize(pop3Server, userName, password, ushort.Parse(port));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,10 @@
<AssemblyOriginatorKeyFile>$(AssemblyOriginatorKeyFile)</AssemblyOriginatorKeyFile>
</PropertyGroup>

<PropertyGroup Condition="'$(Configuration)|$(TargetFramework)|$(Platform)'=='Release|net7.0|AnyCPU'">
<Optimize>False</Optimize>
</PropertyGroup>

<ItemGroup>
<None Remove="Properties\Images\banksy-no-ball-games.-graffiti-street-fine-art-print-poster.-sizes-a4-a3-a2-a1-001187--4305-p.jpg" />
<None Remove="Properties\Images\banksy-pulp-fiction.-banana-graffiti-street-fine-art-print-poster.-sizes-a4-a3-a2-a1-00344--4244-p.jpg" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,8 @@ namespace AspNetCore.PluginManager.Tests.Plugins.DocumentationTests
{
[TestClass]
[ExcludeFromCodeCoverage]
public sealed class DocumentTests : BaseDocumentTests
[DoNotParallelize]
public sealed class DocumentTests : BaseDocumentTests
{
[TestInitialize]
public void Setup()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,13 +33,14 @@

namespace AspNetCore.PluginManager.Tests
{
public class MinifyTestBase
[ExcludeFromCodeCoverage]
[DoNotParallelize]
public class MinifyTestBase
{
[System.Diagnostics.CodeAnalysis.SuppressMessage("Design", "CA1051:Do not declare visible instance fields", Justification = "It's just a test man, innit!")]
protected IMinificationEngine _minifyFileContents;

[TestInitialize]
[ExcludeFromCodeCoverage]
public void InitialiseTest()
{
_minifyFileContents = new MinificationEngine();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,8 @@ namespace AspNetCore.PluginManager.Tests.AspNetCore.PluginManager
{
[TestClass]
[ExcludeFromCodeCoverage]
public class RouteLoadTimeMiddlewareTests : GenericBaseClass
[DoNotParallelize]
public class RouteLoadTimeMiddlewareTests : GenericBaseClass
{
private const string TestCategoryName = "AspNetCore Plugin Manager Tests";
private const string MiddlewareCategoryName = "Middleware";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,8 @@ namespace AspNetCore.PluginManager.Tests.AspNetCore.PluginManager
{
[TestClass]
[ExcludeFromCodeCoverage]
public class SystemAdminMenuTests : GenericBaseClass
[DoNotParallelize]
public class SystemAdminMenuTests : GenericBaseClass
{
private const string TestCategoryName = "AspNetCore Plugin Manager Tests";
private const string SystemAdminCategoryName = "System Admin Menu";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,8 @@ namespace AspNetCore.PluginManager.Tests.Plugins.BadEggTests
{
[TestClass]
[ExcludeFromCodeCoverage]
public class BadEggTests : BaseMiddlewareTests
[DoNotParallelize]
public class BadEggTests : BaseMiddlewareTests
{
[TestInitialize]
public void InitialiseBadEggTests()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,8 @@ namespace AspNetCore.PluginManager.Tests.Plugins.BadEggTests
{
[TestClass]
[ExcludeFromCodeCoverage]
public class ValidateConnectionsTests
[DoNotParallelize]
public class ValidateConnectionsTests
{
private const string TestCategoryName = "BadEgg";

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,8 @@ namespace AspNetCore.PluginManager.Tests.Plugins.DynamicContentTests
{
[TestClass]
[ExcludeFromCodeCoverage]
public class DefaultDynamicContentProviderTests : GenericBaseClass
[DoNotParallelize]
public class DefaultDynamicContentProviderTests : GenericBaseClass
{
private const string TestCategoryName = "Dynamic Content";
private const string HtmlTemplateAssemblyQualifiedName = "DynamicContent.Plugin.Templates.HtmlTextTemplate, DynamicContent.Plugin";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -62,8 +62,8 @@ namespace AspNetCore.PluginManager.Tests.Plugins.DynamicContentTests
{
[TestClass]
[ExcludeFromCodeCoverage]

public class DynamicContentControllerTests : BaseControllerTests
[DoNotParallelize]
public class DynamicContentControllerTests : BaseControllerTests
{
#region Private Members

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,8 @@ namespace AspNetCore.PluginManager.Tests.Plugins.DynamicContentTests
{
[TestClass]
[ExcludeFromCodeCoverage]
public class DynamicContentThreadManagerTests : GenericBaseClass
[DoNotParallelize]
public class DynamicContentThreadManagerTests : GenericBaseClass
{
private const string TestCategoryName = "Dynamic Content";
private string _currentTestPath = null;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,8 +46,18 @@ namespace AspNetCore.PluginManager.Tests.Plugins.HelpdeskTests
{
[TestClass]
[ExcludeFromCodeCoverage]
[DoNotParallelize]
public class ImportEmailIntoHelpdeskTests
{
[TestInitialize]
public void InitialiseTests()
{
Environment.SetEnvironmentVariable("EmailPop3ServerName", "test.server.com");
Environment.SetEnvironmentVariable("EmailUserName", "myemail.test.server.com");
Environment.SetEnvironmentVariable("EmailUserPassword", "asdfasdfasdf");
Environment.SetEnvironmentVariable("EmailPop3Port", "634");
}

[TestMethod]
[ExpectedException(typeof(ArgumentNullException))]
public void Construct_InvalidParameter_HelpdeskProviderNull_Throws_ArgumentNullException()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,8 @@ namespace AspNetCore.PluginManager.Tests.Plugins.ImageManagerTests
{
[TestClass]
[ExcludeFromCodeCoverage]
public class DefaultImageProviderTests : GenericBaseClass
[DoNotParallelize]
public class DefaultImageProviderTests : GenericBaseClass
{
private const string ImageManagerTestsCategory = "Image Manager Tests";
private const string DemoWebsiteImagePath = "..\\..\\..\\..\\..\\..\\.NetCorePluginManager\\Demo\\NetCorePluginDemoWebsite\\wwwroot\\images";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,8 @@ namespace AspNetCore.PluginManager.Tests.Plugins.ImageManagerTests
{
[TestClass]
[ExcludeFromCodeCoverage]
public class ImageManagerControllerTests : BaseControllerTests
[DoNotParallelize]
public class ImageManagerControllerTests : BaseControllerTests
{
private const string TestCategoryName = "Image Manager Tests";
private const string ExpectedResponseWithNoListener = "{\"GroupName\":\"Group\",\"SubgroupName\":\"test subgrouP\",\"ShowSubgroup\":true,\"AdditionalDataName\":null,\"AdditionalData\":null,\"AdditionalDataMandatory\":false}";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,8 @@ namespace AspNetCore.PluginManager.Tests.Plugins.LoginTests
{
[TestClass]
[ExcludeFromCodeCoverage]
public class LoginControllerTests : BaseControllerTests
[DoNotParallelize]
public class LoginControllerTests : BaseControllerTests
{
private const string TestCategoryName = "Login Plugin";

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,8 @@ namespace AspNetCore.PluginManager.Tests.Plugins.LoginTests
{
[TestClass]
[ExcludeFromCodeCoverage]
public class LoginMiddlewareTests : BaseMiddlewareTests
[DoNotParallelize]
public class LoginMiddlewareTests : BaseMiddlewareTests
{
private const string TestCategoryName = "Login";

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,8 @@ namespace AspNetCore.PluginManager.Tests.Plugins.MemoryCacheTests
{
[TestClass]
[ExcludeFromCodeCoverage]
public class DynamicContentMenuTests
[DoNotParallelize]
public class DynamicContentMenuTests
{
private const string TestCategoryName = "Memory Cache Plugin";
private const string SystemAdminCategoryName = "System Admin";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,8 @@ namespace AspNetCore.PluginManager.Tests.Plugins.SearchTests
{
[TestClass]
[ExcludeFromCodeCoverage]
public class DefaultSearchProviderTests : MockBasePlugin
[DoNotParallelize]
public class DefaultSearchProviderTests : MockBasePlugin
{
[TestInitialize]
public void InitializeSearchTests()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ namespace AspNetCore.PluginManager.Tests.Plugins.SearchTests
{
[TestClass]
[ExcludeFromCodeCoverage]
[DoNotParallelize]
public sealed class KeywordSearchTests : MockBasePlugin
{
private const int _searchClassCount = 4;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,8 @@ namespace AspNetCore.PluginManager.Tests.Plugins.SearchTests
{
[TestClass]
[ExcludeFromCodeCoverage]
public class SearchControllerTests : MockBasePlugin
[DoNotParallelize]
public class SearchControllerTests : MockBasePlugin
{
[TestInitialize]
public void InitializeSearchTests()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,8 @@ namespace AspNetCore.PluginManager.Tests.Plugins.SmokeTestTests
{
[TestClass]
[ExcludeFromCodeCoverage]
public class WebSmokeTestTests : BaseMiddlewareTests
[DoNotParallelize]
public class WebSmokeTestTests : BaseMiddlewareTests
{
private string EncryptionKey;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,8 @@ namespace AspNetCore.PluginManager.Tests.Plugins.SpiderTests
{
[TestClass]
[ExcludeFromCodeCoverage]
public sealed class SpiderControllerTests : BaseControllerTests
[DoNotParallelize]
public sealed class SpiderControllerTests : BaseControllerTests
{
[TestInitialize]
public void InitializeSpiderControllerTests()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,8 @@ namespace AspNetCore.PluginManager.Tests.Plugins.SpiderTests
{
[TestClass]
[ExcludeFromCodeCoverage]
public class SpiderMiddlewareTests : BaseMiddlewareTests
[DoNotParallelize]
public class SpiderMiddlewareTests : BaseMiddlewareTests
{
[TestInitialize]
public void InitializeTest()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,8 @@ namespace AspNetCore.PluginManager.Tests.Plugins.SubdomainTests
{
[TestClass]
[ExcludeFromCodeCoverage]
public class SubdomainMiddlewareTests : BaseMiddlewareTests
[DoNotParallelize]
public class SubdomainMiddlewareTests : BaseMiddlewareTests
{
#region Constants

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,8 @@ namespace AspNetCore.PluginManager.Tests.Plugins.SystemAdminTests
{
[TestClass]
[ExcludeFromCodeCoverage]
public class PluginInitialisationTests
[DoNotParallelize]
public class PluginInitialisationTests
{
private const string TestsCategoryName = "System Admin";

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,8 @@ namespace AspNetCore.PluginManager.Tests.Plugins.SystemAdminTests
{
[TestClass]
[ExcludeFromCodeCoverage]
public class SystemAdminHelperTests : GenericBaseClass
[DoNotParallelize]
public class SystemAdminHelperTests : GenericBaseClass
{
private const string TestsCategory = "SystemAdmin Tests";

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,8 @@ namespace PluginManager.DAL.TextFiles.Tests.Providers
{
[TestClass]
[ExcludeFromCodeCoverage]
public class DownloadProviderTests : BaseProviderTests
[DoNotParallelize]
public class DownloadProviderTests : BaseProviderTests
{
[TestInitialize]
public void Setup()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,8 @@ namespace PluginManager.DAL.TextFiles.Tests.Providers
{
[TestClass]
[ExcludeFromCodeCoverage]
public class DynamicContentProviderTests : BaseProviderTests
[DoNotParallelize]
public class DynamicContentProviderTests : BaseProviderTests
{
[TestInitialize]
public void Setup()
Expand Down
Loading

0 comments on commit c98f25d

Please sign in to comment.