Skip to content

Commit

Permalink
(chore) Update to .net8 (#1267) and fix CI builds
Browse files Browse the repository at this point in the history
  • Loading branch information
rnwood authored Feb 23, 2024
1 parent 6ab4829 commit 5c6b55e
Show file tree
Hide file tree
Showing 13 changed files with 204 additions and 76 deletions.
2 changes: 1 addition & 1 deletion Dockerfile.linux
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM mcr.microsoft.com/dotnet/aspnet:6.0.5 AS runtime
FROM mcr.microsoft.com/dotnet/aspnet:8.0.2 AS runtime
COPY out /app
VOLUME ["/smtp4dev"]
WORKDIR /
Expand Down
2 changes: 1 addition & 1 deletion Dockerfile.linux.arm64
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM --platform=linux/arm64 mcr.microsoft.com/dotnet/aspnet:6.0.5 AS runtime
FROM --platform=linux/arm64 mcr.microsoft.com/dotnet/aspnet:8.0.2 AS runtime
COPY out /app
VOLUME ["/smtp4dev"]
WORKDIR /
Expand Down
2 changes: 1 addition & 1 deletion Dockerfile.windows
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# escape=`
FROM mcr.microsoft.com/dotnet/aspnet:6.0.5 AS final
FROM mcr.microsoft.com/dotnet/aspnet:8.0.2-windowsservercore-ltsc2019 AS final
COPY out /app
EXPOSE 80
EXPOSE 25
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

A dummy SMTP server for Windows, Linux, Mac OS-X (and maybe elsewhere where .NET Core is available). Lets you test your application without spamming your real customers and without needing to set up a complicated real email server with a special configuration. Messages received in smtp4dev can be viewed and inspected.

*If you're looking for the older v2 Windows GUI version. [Grab it here](https://github.com/rnwood/smtp4dev/releases/tag/v2.0.10).*
*If you're looking for the older v2 Windows only GUI version. [Grab it here](https://github.com/rnwood/smtp4dev/releases/tag/v2.0.10).*

> <a style="float: right" href="https://www.patreon.com/bePatron?u=38204828" data-patreon-widget-type="become-patron-button"><img alt='Become a Patreon' src='https://c5.patreon.com/external/logo/become_a_patron_button.png' height="30px"></a> <a style="float: right" href='https://www.paypal.me/rnwood'><img alt='Donate' src='https://www.paypalobjects.com/webstatic/en_US/btn/btn_donate_pp_142x27.png'/></a> *If you find smtp4dev useful, please consider supporting further development by making a donation*
> .
Expand Down
6 changes: 3 additions & 3 deletions Rnwood.Smtp4dev.Desktop/Rnwood.Smtp4dev.Desktop.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

<PropertyGroup>
<OutputType>WinExe</OutputType>
<TargetFramework>net6.0</TargetFramework>
<TargetFramework>net8.0</TargetFramework>
<ApplicationIcon>app\icon.ico</ApplicationIcon>
</PropertyGroup>

Expand All @@ -21,8 +21,8 @@
</ItemGroup>

<ItemGroup>
<PackageReference Include="ParallelExtensionsExtras.NetFxStandard" Version="1.4.0" />
<PackageReference Include="Photino.NET" Version="2.1.11" />
<PackageReference Include="ParallelExtensionsExtras.NetFxStandard" Version="2.1.0" />
<PackageReference Include="Photino.NET" Version="2.6.0" />
</ItemGroup>

<ItemGroup>
Expand Down
21 changes: 18 additions & 3 deletions Rnwood.Smtp4dev.Tests/E2E/E2ETests_WebUI.cs
Original file line number Diff line number Diff line change
@@ -1,11 +1,14 @@
using MailKit.Net.Smtp;
using MailKit.Security;
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
using MimeKit;
using OpenQA.Selenium;
using OpenQA.Selenium.Chrome;
using OpenQA.Selenium.Support.Extensions;
using Rnwood.Smtp4dev.Tests.E2E.PageModel;
using System;
using System.Diagnostics;
using System.IO;
using System.Linq;
using System.Threading;
using WebDriverManager;
Expand All @@ -29,7 +32,7 @@ public E2ETests_WebUI(ITestOutputHelper output) : base(output)
[InlineData("/smtp4dev", true)]
public void CheckMessageIsReceivedAndDisplayed(string basePath, bool inMemoryDb)
{
RunUITest((browser, baseUrl, smtpPortNumber) =>
RunUITest($"{nameof(CheckMessageIsReceivedAndDisplayed)}-{basePath}-{inMemoryDb}", (browser, baseUrl, smtpPortNumber) =>
{
browser.Navigate().GoToUrl(baseUrl);
HomePage homePage = new HomePage(browser);
Expand Down Expand Up @@ -73,7 +76,7 @@ public void CheckMessageIsReceivedAndDisplayed(string basePath, bool inMemoryDb)
[Fact]
public void CheckUTF8MessageIsReceivedAndDisplayed()
{
RunUITest((browser, baseUrl, smtpPortNumber) =>
RunUITest(nameof(CheckUTF8MessageIsReceivedAndDisplayed), (browser, baseUrl, smtpPortNumber) =>
{
browser.Navigate().GoToUrl(baseUrl);
HomePage homePage = new HomePage(browser);
Expand Down Expand Up @@ -135,7 +138,7 @@ class UITestOptions : E2ETestOptions
{
}

private void RunUITest(Action<IWebDriver, Uri, int> uitest, UITestOptions options = null)
private void RunUITest(string testName, Action<IWebDriver, Uri, int> uitest, UITestOptions options = null)
{
options ??= new UITestOptions();

Expand All @@ -152,6 +155,18 @@ private void RunUITest(Action<IWebDriver, Uri, int> uitest, UITestOptions option
{
uitest(browser, context.BaseUrl, context.SmtpPortNumber);
}
catch
{
string screenshotFileName = Path.Combine(Path.GetTempPath(), Guid.NewGuid().ToString() + ".png");
string consoleFileName = Path.Combine(Path.GetTempPath(), Guid.NewGuid().ToString() + ".txt");
browser.TakeScreenshot().SaveAsFile(screenshotFileName);
File.WriteAllLines(consoleFileName, browser.Manage().Logs.GetLog(LogType.Browser).Select(m => $"{m.Timestamp} - {m.Level}: {m.Message}"));

Console.WriteLine($"##vso[artifact.upload containerfolder=e2eerror;artifactname={testName}.png]{screenshotFileName}");

Console.WriteLine($"##vso[artifact.upload containerfolder=e2eerror;artifactname={testName}.txt]{consoleFileName}");
throw;
}
finally
{
browser.Quit();
Expand Down
26 changes: 13 additions & 13 deletions Rnwood.Smtp4dev.Tests/Rnwood.Smtp4dev.Tests.csproj
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk.Web">

<PropertyGroup>
<TargetFramework>net6.0</TargetFramework>
<TargetFramework>net8.0</TargetFramework>
<IsPackable>false</IsPackable>
</PropertyGroup>

Expand All @@ -24,19 +24,19 @@
</ItemGroup>

<ItemGroup>
<PackageReference Include="FluentAssertions" Version="6.6.0" />
<PackageReference Include="MailKit" Version="3.3.0" />
<PackageReference Include="FluentAssertions" Version="6.12.0" />
<PackageReference Include="MailKit" Version="4.3.0" />
<PackageReference Include="MedallionShell" Version="1.6.2" />
<PackageReference Include="NSubstitute" Version="4.4.0" />
<PackageReference Include="ReflectionMagic" Version="4.1.0" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.2.0" />
<PackageReference Include="Selenium.Support" Version="4.2.0" />
<PackageReference Include="Selenium.WebDriver" Version="4.2.0" />
<PackageReference Include="System.Configuration.ConfigurationManager" Version="6.0.0" />
<PackageReference Include="System.Linq.Dynamic.Core" Version="1.2.20" />
<PackageReference Include="WebDriverManager" Version="2.13.0" />
<PackageReference Include="xunit" Version="2.4.2" />
<PackageReference Include="xunit.runner.visualstudio" Version="2.4.5">
<PackageReference Include="NSubstitute" Version="5.1.0" />
<PackageReference Include="ReflectionMagic" Version="5.0.1" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.9.0" />
<PackageReference Include="Selenium.Support" Version="4.18.1" />
<PackageReference Include="Selenium.WebDriver" Version="4.18.1" />
<PackageReference Include="System.Configuration.ConfigurationManager" Version="8.0.0" />
<PackageReference Include="System.Linq.Dynamic.Core" Version="1.3.8" />
<PackageReference Include="WebDriverManager" Version="2.17.2" />
<PackageReference Include="xunit" Version="2.7.0" />
<PackageReference Include="xunit.runner.visualstudio" Version="2.5.7">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
Expand Down
126 changes: 122 additions & 4 deletions Rnwood.Smtp4dev/ClientApp/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

20 changes: 11 additions & 9 deletions Rnwood.Smtp4dev/ClientApp/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,22 +4,23 @@
"private": true,
"scripts": {
"postinstall": "patch-package",
"serve": "vue-cli-service serve",
"build": "vue-cli-service build",
"build:dev": "vue-cli-service build --mode development",
"serve": "cross-env NODE_OPTIONS=--openssl-legacy-provider vue-cli-service serve",
"build": "cross-env NODE_OPTIONS=--openssl-legacy-provider vue-cli-service build",
"build:dev": "cross-env NODE_OPTIONS=--openssl-legacy-provider vue-cli-service build --mode development",
"lint": "vue-cli-service lint",
"test": "jest"
},
"devDependencies": {
"@microsoft/signalr": "^6.0.6",
"@babel/preset-typescript": "^7.18.6",
"@fortawesome/fontawesome-free": "^5.15.4",
"@fortawesome/fontawesome-svg-core": "^6.1.1",
"@fortawesome/free-solid-svg-icons": "^6.1.1",
"@fortawesome/vue-fontawesome": "^2.0.8",
"@microsoft/signalr": "^6.0.6",
"@testing-library/jest-dom": "^5.15.0",
"@testing-library/vue": "^5.8.2",
"@types/jest": "^27.0.2",
"@types/sanitize-html": "^2.6.2",
"@typescript-eslint/eslint-plugin": "^4.33.0",
"@typescript-eslint/parser": "^4.31.2",
"@vue/cli-plugin-babel": "^4.5.15",
Expand All @@ -46,6 +47,7 @@
"locale-index-of": "^3.1.0",
"moment": "^2.29.3",
"patch-package": "^6.4.7",
"sanitize-html": "^2.7.1",
"sass": "^1.51.0",
"sass-loader": "^10.2.1",
"splitpanes": "^2.4.1",
Expand All @@ -59,10 +61,7 @@
"vue-property-decorator": "^9.1.2",
"vue-router": "^3.5.4",
"vue-template-compiler": "^2.6.14",
"vue2-ace-editor": "^0.0.15",
"sanitize-html": "^2.7.1",
"@types/sanitize-html": "^2.6.2"

"vue2-ace-editor": "^0.0.15"
},
"eslintConfig": {
"root": true,
Expand Down Expand Up @@ -90,5 +89,8 @@
"browserslist": [
"> 1%",
"last 2 versions"
]
],
"dependencies": {
"cross-env": "^7.0.3"
}
}
4 changes: 0 additions & 4 deletions Rnwood.Smtp4dev/CommandLineOptionsException.cs
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,5 @@ public CommandLineOptionsException(string message) : base(message)
public CommandLineOptionsException(string message, Exception innerException) : base(message, innerException)
{
}

protected CommandLineOptionsException(SerializationInfo info, StreamingContext context) : base(info, context)
{
}
}
}
Loading

0 comments on commit 5c6b55e

Please sign in to comment.