Skip to content

Commit

Permalink
Use mono on linux
Browse files Browse the repository at this point in the history
  • Loading branch information
meziantou committed Feb 22, 2024
1 parent a3428a5 commit 7177eee
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 10 deletions.
1 change: 0 additions & 1 deletion Build.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,6 @@ Process {
Exec { & nuget pack Workleap.DotNet.CodingStandards.nuspec -OutputDirectory $outputDir -Version $version -ForceEnglishOutput }

# Run tests
Get-Command nuget
Exec { & dotnet test }

# Push to a NuGet feed if the environment variables are set
Expand Down
24 changes: 15 additions & 9 deletions tests/Workleap.DotNet.CodingStandards.Tests/PackageFixture.cs
Original file line number Diff line number Diff line change
Expand Up @@ -13,18 +13,24 @@ public sealed class PackageFixture : IAsyncLifetime
public async Task InitializeAsync()
{
// On CI the exe is already present
var exe = "nuget";
var exe = FullPath.GetTempPath() / $"nuget-{Guid.NewGuid()}.exe";
await DownloadFileAsync("https://dist.nuget.org/win-x86-commandline/latest/nuget.exe", exe);

var nuspecPath = PathHelpers.GetRootDirectory() / "Workleap.DotNet.CodingStandards.nuspec";
string[] args = ["pack", nuspecPath, "-ForceEnglishOutput", "-Version", "999.9.9", "-OutputDirectory", _packageDirectory.FullPath];

if (OperatingSystem.IsWindows())
{
var downloadPath = FullPath.GetTempPath() / $"nuget-{Guid.NewGuid()}.exe";
await DownloadFileAsync("https://dist.nuget.org/win-x86-commandline/latest/nuget.exe", downloadPath);
exe = downloadPath;
await Cli.Wrap(exe)
.WithArguments(args)
.ExecuteAsync();
}
else
{
await Cli.Wrap("/bin/sh")
.WithArguments(["mono", exe, .. args])
.ExecuteAsync();
}

var nuspecPath = PathHelpers.GetRootDirectory() / "Workleap.DotNet.CodingStandards.nuspec";
await Cli.Wrap(exe)
.WithArguments(["pack", nuspecPath, "-ForceEnglishOutput", "-Version", "999.9.9", "-OutputDirectory", _packageDirectory.FullPath])
.ExecuteAsync();
}

public async Task DisposeAsync()
Expand Down

0 comments on commit 7177eee

Please sign in to comment.