Skip to content

Commit

Permalink
.NET 9.0 support (#61)
Browse files Browse the repository at this point in the history
  • Loading branch information
tonyredondo authored Nov 13, 2024
1 parent 7f9d739 commit fd7981a
Show file tree
Hide file tree
Showing 5 changed files with 22 additions and 12 deletions.
7 changes: 4 additions & 3 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,13 +15,14 @@ jobs:
steps:
- uses: actions/checkout@v3

- name: Setup .NET 6.0, 7.0, 8.0
- name: Setup .NET 6.0, 7.0, 8.0, 9.0
uses: actions/setup-dotnet@v3
with:
dotnet-version: |
6.0.x
7.0.x
8.0.x
9.0.x
- name: Restore dependencies
run: dotnet restore
Expand All @@ -31,11 +32,11 @@ jobs:

- name: Run timeitsharp dotnet tool sample
run: ./TimeItSharp config-example.json
working-directory: src/TimeItSharp/bin/Release/net8.0
working-directory: src/TimeItSharp/bin/Release/net9.0

- name: Run timeitsharp engine sample
run: ./TimeItSharp.FluentConfiguration.Sample
working-directory: test/TimeItSharp.FluentConfiguration.Sample/bin/Release/net8.0
working-directory: test/TimeItSharp.FluentConfiguration.Sample/bin/Release/net9.0

- uses: actions/upload-artifact@v3
with:
Expand Down
6 changes: 3 additions & 3 deletions src/Directory.Build.props
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
<Project>
<PropertyGroup>
<Version>0.1.21</Version>
<Version>0.1.22</Version>
<Authors>Tony Redondo, Grégory Léocadie</Authors>
<TargetFrameworks>net6.0;net7.0;net8.0</TargetFrameworks>
<TargetFrameworks>net6.0;net7.0;net8.0;net9.0</TargetFrameworks>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
<LangVersion>11</LangVersion>
<LangVersion>13</LangVersion>
<ContinuousIntegrationBuild>true</ContinuousIntegrationBuild>
<ServerGarbageCollection>false</ServerGarbageCollection>
</PropertyGroup>
Expand Down
15 changes: 12 additions & 3 deletions src/TimeItSharp.Common/ScenarioProcessor.cs
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,8 @@ internal sealed class ScenarioProcessor
private readonly IReadOnlyList<IService> _services;
private readonly TimeItCallbacks.CallbacksTriggers _callbacksTriggers;

private static readonly IDictionary EnvironmentVariables = Environment.GetEnvironmentVariables();

public ScenarioProcessor(
Config configuration,
TemplateVariables templateVariables,
Expand Down Expand Up @@ -453,7 +455,7 @@ private async Task<DataPoint> RunCommandAsync(int index, Scenario scenario, Time
var timeoutCmdArguments = scenario.Timeout.ProcessArguments ?? string.Empty;

var cmdEnvironmentVariables = new Dictionary<string, string?>();
foreach (DictionaryEntry osEnv in Environment.GetEnvironmentVariables())
foreach (DictionaryEntry osEnv in EnvironmentVariables)
{
if (osEnv.Key?.ToString() is { Length: > 0 } keyString)
{
Expand All @@ -472,8 +474,15 @@ private async Task<DataPoint> RunCommandAsync(int index, Scenario scenario, Time
}

// add working directory as a path to resolve binary
var pathWithWorkingDir = workingDirectory + Path.PathSeparator + Environment.GetEnvironmentVariable("PATH");
Environment.SetEnvironmentVariable("PATH", pathWithWorkingDir);
if (!string.IsNullOrWhiteSpace(workingDirectory))
{
var currentPath = Environment.GetEnvironmentVariable("PATH");
if (currentPath != null && !currentPath.Contains(workingDirectory))
{
var pathWithWorkingDir = workingDirectory + Path.PathSeparator + currentPath;
Environment.SetEnvironmentVariable("PATH", pathWithWorkingDir);
}
}

// Setup the command
var cmd = Cli.Wrap(cmdString)
Expand Down
4 changes: 2 additions & 2 deletions src/TimeItSharp.Common/TimeItSharp.Common.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,8 @@
</ItemGroup>

<ItemGroup>
<PackageReference Include="CliWrap" Version="3.6.6" />
<PackageReference Include="Datadog.Trace.BenchmarkDotNet" Version="2.47.0" />
<PackageReference Include="CliWrap" Version="3.6.7" />
<PackageReference Include="Datadog.Trace.BenchmarkDotNet" Version="2.61.0" />
<PackageReference Include="MathNet.Numerics" Version="5.0.0" />
<PackageReference Include="Spectre.Console" Version="0.49.1" />
<PackageReference Include="IgnoresAccessChecksToGenerator" Version="0.7.0">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>net8.0</TargetFramework>
<TargetFramework>net9.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
</PropertyGroup>
Expand Down

0 comments on commit fd7981a

Please sign in to comment.