-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Publish coverage report as pipelne artifact on GitHub Actions
- Loading branch information
Showing
3 changed files
with
79 additions
and
9 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
17 changes: 17 additions & 0 deletions
17
src/SharedBuild/Tools/TemporaryFiles/TemporaryDirectory.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
using System; | ||
using Cake.Core.IO; | ||
|
||
namespace Grynwald.SharedBuild.Tools.TemporaryFiles; | ||
|
||
public class TemporaryDirectory(DirectoryPath path, IFileSystem fileSystem) : IDisposable | ||
{ | ||
public DirectoryPath Path { get; } = path ?? throw new ArgumentNullException(nameof(path)); | ||
|
||
public void Dispose() | ||
{ | ||
if (fileSystem.GetDirectory(Path).Exists) | ||
{ | ||
fileSystem.GetDirectory(Path).Delete(recursive: true); | ||
} | ||
} | ||
} |
17 changes: 17 additions & 0 deletions
17
src/SharedBuild/Tools/TemporaryFiles/TemporaryDirectoryAliases.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
using System; | ||
using Cake.Core; | ||
using Cake.Core.IO; | ||
|
||
namespace Grynwald.SharedBuild.Tools.TemporaryFiles; | ||
|
||
public static class TemporaryDirectoryAliases | ||
{ | ||
public static TemporaryDirectory CreateTemporaryDirectory(this ICakeContext context) | ||
{ | ||
var path = context.Environment | ||
.GetSpecialPath(SpecialPath.LocalTemp) | ||
.Combine($"{Guid.NewGuid():n}"); | ||
|
||
return new TemporaryDirectory(path, context.FileSystem); | ||
} | ||
} |