Skip to content

Commit

Permalink
Modernize solution (#321)
Browse files Browse the repository at this point in the history
* Modernize solution

* Fix typos
  • Loading branch information
Arkatufus committed Sep 28, 2023
1 parent e6e1c30 commit 389e771
Show file tree
Hide file tree
Showing 18 changed files with 204 additions and 196 deletions.
25 changes: 25 additions & 0 deletions Akka.Quartz.Actor.sln
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,28 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Akka.Quartz.Actor.Tests", "
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Akka.Quartz.Actor.IntegrationTests", "src\Akka.Quartz.Actor.IntegrationTests\Akka.Quartz.Actor.IntegrationTests.csproj", "{6F4BDCE1-AFEA-444B-BA13-B560E24C94C6}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "build", "build", "{FB34DCD0-D371-472E-8E7D-0B29FE0B6D88}"
ProjectSection(SolutionItems) = preProject
build.cmd = build.cmd
build.fsx = build.fsx
build.ps1 = build.ps1
README.md = README.md
RELEASE_NOTES.md = RELEASE_NOTES.md
src\Directory.Build.props = src\Directory.Build.props
src\Directory.Generated.props = src\Directory.Generated.props
src\Directory.Packages.props = src\Directory.Packages.props
EndProjectSection
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "build-system", "build-system", "{9B4742AA-8EED-486D-9607-BACFD98D3FB9}"
ProjectSection(SolutionItems) = preProject
build-system\azure-pipeline.template.yaml = build-system\azure-pipeline.template.yaml
build-system\linux-pr-validation.yaml = build-system\linux-pr-validation.yaml
build-system\nightly-builds.yaml = build-system\nightly-builds.yaml
build-system\README.md = build-system\README.md
build-system\windows-pr-validation.yaml = build-system\windows-pr-validation.yaml
build-system\windows-release.yaml = build-system\windows-release.yaml
EndProjectSection
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Expand All @@ -31,4 +53,7 @@ Global
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
GlobalSection(NestedProjects) = preSolution
{9B4742AA-8EED-486D-9607-BACFD98D3FB9} = {FB34DCD0-D371-472E-8E7D-0B29FE0B6D88}
EndGlobalSection
EndGlobal
4 changes: 4 additions & 0 deletions build-system/azure-pipeline.template.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,10 @@ jobs:
displayName: "Use .NET SDK 3.1"
inputs:
version: 3.1.x
- task: UseDotNet@2
displayName: "Use .NET 6.0 SDK"
inputs:
version: 6.x
# Linux or macOS
- task: Bash@3
displayName: Linux / OSX Build
Expand Down
2 changes: 1 addition & 1 deletion build-system/linux-pr-validation.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -19,4 +19,4 @@ jobs:
name: Ubuntu
vmImage: 'ubuntu-latest'
scriptFileName: ./build.sh
scriptArgs: all
scriptArgs: RunTestsNet
2 changes: 1 addition & 1 deletion build-system/windows-release.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ steps:
displayName: 'FAKE Build'
inputs:
filename: build.cmd
arguments: 'All nugetpublishurl=https://www.nuget.org/api/v2/package nugetkey=$(nugetKey)'
arguments: 'All nugetpublishurl=https://api.nuget.org/v3/index.json nugetkey=$(nugetKey)'

- task: GitHubRelease@0
displayName: 'GitHub release (create)'
Expand Down
98 changes: 70 additions & 28 deletions build.fsx
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,10 @@ let outputTests = __SOURCE_DIRECTORY__ @@ "TestResults"
let outputPerfTests = __SOURCE_DIRECTORY__ @@ "PerfResults"
let outputNuGet = output @@ "nuget"

// Configuration values for tests
let testNetFrameworkVersion = "net472"
let testNetVersion = "net6.0"

Target "Clean" (fun _ ->
ActivateFinalTarget "KillCreatedProcesses"

Expand All @@ -43,11 +47,14 @@ Target "Clean" (fun _ ->
CleanDir outputPerfTests
CleanDir outputNuGet
CleanDir "docs/_site"

CleanDirs !! "./**/bin"
CleanDirs !! "./**/obj"
)

Target "AssemblyInfo" (fun _ ->
XmlPokeInnerText "./src/common.props" "//Project/PropertyGroup/VersionPrefix" releaseNotes.AssemblyVersion
XmlPokeInnerText "./src/common.props" "//Project/PropertyGroup/PackageReleaseNotes" (releaseNotes.Notes |> String.concat "\n")
XmlPokeInnerText "./src/Directory.Generated.props" "//Project/PropertyGroup/VersionPrefix" releaseNotes.AssemblyVersion
XmlPokeInnerText "./src/Directory.Generated.props" "//Project/PropertyGroup/PackageReleaseNotes" (releaseNotes.Notes |> String.concat "\n")
)

Target "Build" (fun _ ->
Expand Down Expand Up @@ -84,13 +91,15 @@ Target "RunTests" (fun _ ->
let projects =
match (isWindows) with
| true -> !! "./src/**/*.Tests.csproj"
++ "./src/**/*.*Tests.csproj"
| _ -> !! "./src/**/*.Tests.csproj" // if you need to filter specs for Linux vs. Windows, do it here
++ "./src/**/*.*Tests.csproj"

let runSingleProject project =
let arguments =
match (hasTeamCity) with
| true -> (sprintf "test -c Release --no-build --logger:trx --logger:\"console;verbosity=normal\" --results-directory %s -- -parallel none -teamcity" (outputTests))
| false -> (sprintf "test -c Release --no-build --logger:trx --logger:\"console;verbosity=normal\" --results-directory %s -- -parallel none" (outputTests))
| true -> (sprintf "test -c Release --no-build --logger:trx --logger:\"console;verbosity=normal\" --framework %s --results-directory %s -- -parallel none -teamcity" testNetFrameworkVersion outputTests)
| false -> (sprintf "test -c Release --no-build --logger:trx --logger:\"console;verbosity=normal\" --framework %s --results-directory %s -- -parallel none" testNetFrameworkVersion outputTests)

let result = ExecProcess(fun info ->
info.FileName <- "dotnet"
Expand All @@ -99,6 +108,33 @@ Target "RunTests" (fun _ ->

ResultHandling.failBuildIfXUnitReportedError TestRunnerErrorLevel.Error result

CreateDir outputTests
projects |> Seq.iter (log)
projects |> Seq.iter (runSingleProject)
)

Target "RunTestsNet" (fun _ ->
let projects =
match (isWindows) with
| true -> !! "./src/**/*.Tests.csproj"
++ "./src/**/*.*Tests.csproj"
| _ -> !! "./src/**/*.Tests.csproj" // if you need to filter specs for Linux vs. Windows, do it here
++ "./src/**/*.*Tests.csproj"

let runSingleProject project =
let arguments =
match (hasTeamCity) with
| true -> (sprintf "test -c Release --no-build --logger:trx --logger:\"console;verbosity=normal\" --framework %s --results-directory %s -- -parallel none -teamcity" testNetVersion outputTests)
| false -> (sprintf "test -c Release --no-build --logger:trx --logger:\"console;verbosity=normal\" --framework %s --results-directory %s -- -parallel none" testNetVersion outputTests)

let result = ExecProcess(fun info ->
info.FileName <- "dotnet"
info.WorkingDirectory <- (Directory.GetParent project).FullName
info.Arguments <- arguments) (TimeSpan.FromMinutes 30.0)

ResultHandling.failBuildIfXUnitReportedError TestRunnerErrorLevel.Error result

CreateDir outputTests
projects |> Seq.iter (log)
projects |> Seq.iter (runSingleProject)
)
Expand Down Expand Up @@ -129,30 +165,32 @@ Target "CreateNuget" (fun _ ->
)

Target "PublishNuget" (fun _ ->
let projects = !! "./bin/nuget/*.nupkg" -- "./bin/nuget/*.symbols.nupkg"
let apiKey = getBuildParamOrDefault "nugetkey" ""
let source = getBuildParamOrDefault "nugetpublishurl" ""
let symbolSource = getBuildParamOrDefault "symbolspublishurl" ""
let shouldPublishSymbolsPackages = not (symbolSource = "")

if (not (source = "") && not (apiKey = "") && shouldPublishSymbolsPackages) then
let runSingleProject project =
DotNetCli.RunCommand
(fun p ->
{ p with
TimeOut = TimeSpan.FromMinutes 10. })
(sprintf "nuget push %s --api-key %s --source %s --symbol-source %s" project apiKey source symbolSource)

projects |> Seq.iter (runSingleProject)
else if (not (source = "") && not (apiKey = "") && not shouldPublishSymbolsPackages) then
let runSingleProject project =
DotNetCli.RunCommand
(fun p ->
{ p with
TimeOut = TimeSpan.FromMinutes 10. })
(sprintf "nuget push %s --api-key %s --source %s" project apiKey source)

projects |> Seq.iter (runSingleProject)
let shouldPushNugetPackages = hasBuildParam "nugetkey"
if not shouldPushNugetPackages then ()
else
let apiKey = getBuildParam "nugetkey"
let sourceUrl = getBuildParamOrDefault "nugetpublishurl" "https://api.nuget.org/v3/index.json"

let rec publishPackage retryLeft packageFile =
tracefn "Pushing %s Attempts left: %d" (FullName packageFile) retryLeft
let tracing = ProcessHelper.enableProcessTracing
try
try
ProcessHelper.enableProcessTracing <- false
DotNetCli.RunCommand
(fun p ->
{ p with
TimeOut = TimeSpan.FromMinutes 10. })
(sprintf "nuget push %s --api-key %s --source %s --no-service-endpoint" packageFile apiKey sourceUrl)
with exn ->
if (retryLeft > 0) then (publishPackage (retryLeft-1) packageFile)
finally
ProcessHelper.enableProcessTracing <- tracing

printfn "Pushing nuget packages"
let normalPackages = !! (outputNuGet @@ "*.nupkg") |> Seq.sortBy(fun x -> x.ToLower())
for package in normalPackages do
publishPackage 3 package
)

//--------------------------------------------------------------------------------
Expand Down Expand Up @@ -194,12 +232,15 @@ Target "Help" <| fun _ ->
Target "BuildRelease" DoNothing
Target "All" DoNothing
Target "Nuget" DoNothing
Target "RunTestsFull" DoNothing
Target "RunTestsNetFull" DoNothing

// build dependencies
"Clean" ==> "AssemblyInfo" ==> "Build" ==> "BuildRelease"

// tests dependencies
"Build" ==> "RunTests"
"Build" ==> "RunTestsNet"

// nuget dependencies
"Clean" ==> "Build" ==> "CreateNuget"
Expand All @@ -211,6 +252,7 @@ Target "Nuget" DoNothing
// all
"BuildRelease" ==> "All"
"RunTests" ==> "All"
"RunTestsNet" ==> "All"
"Nuget" ==> "All"

RunTargetOrDefault "Help"
Binary file added docs/images/icon.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
@@ -1,42 +1,23 @@
<Project Sdk="Microsoft.NET.Sdk" ToolsVersion="Current">
<Import Project="..\common.props" />
<PropertyGroup>
<TargetFramework>net472</TargetFramework>
<TargetFrameworks>$(NetFrameworkTestVersion);$(NetTestVersion)</TargetFrameworks>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="$(TestSdkVersion)" />
<PackageReference Include="xunit.runner.visualstudio" Version="$(XunitRunnerVersion)" />
<PackageReference Include="xunit" Version="$(XunitVersion)" />
<PackageReference Include="Akka.TestKit.Xunit2" Version="$(AkkaVersion)" />
<PackageReference Include="EntityFramework" Version="6.4.4" />
<PackageReference Include="Microsoft.Data.Sqlite.Core" Version="7.0.11" />
<PackageReference Include="Quartz" Version="$(QuartzVersion)" />
<PackageReference Include="SQLitePCLRaw.bundle_green" Version="2.1.6" />
<PackageReference Include="System.Data.SQLite" Version="1.0.118" />
<Reference Include="System.Numerics" />
<Reference Include="System.Runtime.Remoting" />
<Reference Include="System.Xml.Linq" />
<Reference Include="System.Data.DataSetExtensions" />
<Reference Include="Microsoft.CSharp" />
<Reference Include="System.Data" />
<Reference Include="System.Xml" />
</ItemGroup>
<ItemGroup>
<None Include="App.config" />
<PackageReference Include="Microsoft.NET.Test.Sdk" />
<PackageReference Include="xunit.runner.visualstudio" />
<PackageReference Include="xunit" />
<PackageReference Include="Akka.TestKit.Xunit2" />
<PackageReference Include="EntityFramework" />
<PackageReference Include="Microsoft.Data.Sqlite" />
<!-- <PackageReference Include="Microsoft.Data.Sqlite.Core" /> -->
</ItemGroup>
<ItemGroup>
<Content Include="tables_sqlite.sql">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</Content>
</ItemGroup>
<ItemGroup>
<Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\Akka.Quartz.Actor\Akka.Quartz.Actor.csproj">
<Project>{80e909a0-2379-408d-9711-70d1bf3147a2}</Project>
<Name>Akka.Quartz.Actor</Name>
</ProjectReference>
<ProjectReference Include="..\Akka.Quartz.Actor\Akka.Quartz.Actor.csproj" />
</ItemGroup>
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
Other similar extension points exist, see Microsoft.Common.targets.
Expand Down
43 changes: 0 additions & 43 deletions src/Akka.Quartz.Actor.IntegrationTests/App.config

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -6,18 +6,25 @@
using Akka.Quartz.Actor.Events;
using Quartz;
using Xunit;
using System.Data.SQLite;
using System.IO;
using Microsoft.Data.Sqlite;
using System.Collections.Specialized;
using Quartz.Impl.AdoJobStore.Common;
using System.Data;
using Quartz.Impl;
using Xunit.Abstractions;

namespace Akka.Quartz.Actor.IntegrationTests
{
public class QuartzPersistentActorIntegration : TestKit.Xunit2.TestKit, IClassFixture<QuartzPersistentActorIntegration.SqliteFixture>
{
private SqliteFixture _fixture;
public QuartzPersistentActorIntegration(ITestOutputHelper output, SqliteFixture fixture)
: base(nameof(QuartzPersistentActorIntegration), output)
{
_fixture = fixture;
}

[Fact]
public async Task QuartzPersistentActor_DB_Should_Create_Job()
{
Expand Down Expand Up @@ -61,7 +68,7 @@ public async Task QuartzPersistentActor_DB_Should_Create_Job()
Sys.Stop(quartzActor);
}

private class SqliteFixture : IDisposable
public class SqliteFixture : IDisposable
{
private const string DatabaseFileName = "quartz-jobs.db";

Expand All @@ -72,12 +79,11 @@ public SqliteFixture()
File.Delete(DatabaseFileName);
}

SQLiteConnection.CreateFile(DatabaseFileName);
string script = File.ReadAllText("tables_sqlite.sql");
var script = File.ReadAllText("tables_sqlite.sql");

using (SQLiteConnection dbConnection = new SQLiteConnection($"Data Source={DatabaseFileName};Version=3;"))
using (var dbConnection = new SqliteConnection($"Data Source={DatabaseFileName};"))
{
using (SQLiteCommand command = new SQLiteCommand(script, dbConnection))
using (var command = new SqliteCommand(script, dbConnection))
{
dbConnection.Open();
command.ExecuteNonQuery();
Expand Down
14 changes: 5 additions & 9 deletions src/Akka.Quartz.Actor.Tests/Akka.Quartz.Actor.Tests.csproj
Original file line number Diff line number Diff line change
@@ -1,16 +1,12 @@
<Project Sdk="Microsoft.NET.Sdk">
<Import Project="..\common.props" />

<PropertyGroup>
<TargetFrameworks>net471;netcoreapp3.1</TargetFrameworks>
<TargetFrameworks>$(NetFrameworkTestVersion);$(NetTestVersion)</TargetFrameworks>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="$(TestSdkVersion)" />
<PackageReference Include="xunit.runner.visualstudio" Version="$(XunitRunnerVersion)" />
<PackageReference Include="xunit" Version="$(XunitVersion)" />
<PackageReference Include="Akka.TestKit.Xunit2" Version="$(AkkaVersion)" />
<PackageReference Include="FluentAssertions" Version="6.12.0" />
<PackageReference Include="Quartz" Version="$(QuartzVersion)" />
<PackageReference Include="Microsoft.NET.Test.Sdk" />
<PackageReference Include="xunit.runner.visualstudio" />
<PackageReference Include="xunit" />
<PackageReference Include="Akka.TestKit.Xunit2" />
</ItemGroup>

<ItemGroup>
Expand Down

0 comments on commit 389e771

Please sign in to comment.