Skip to content

Commit

Permalink
Fix build
Browse files Browse the repository at this point in the history
  • Loading branch information
NikolayPianikov committed May 13, 2024
1 parent afd9692 commit 6fb26da
Show file tree
Hide file tree
Showing 3 changed files with 42 additions and 28 deletions.
19 changes: 19 additions & 0 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
name: Pure.DI check

on: [ push, pull_request ]

jobs:
build:

runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v4

- name: Setup dotnet
uses: actions/setup-dotnet@v3
with:
dotnet-version: '8.0.x'

- name: Build
run: dotnet run --project ./Build
43 changes: 19 additions & 24 deletions Build/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -37,24 +37,18 @@
("version", nuGetVersion.ToString())
};

new DotNetClean()
.WithConfiguration(configuration)
.WithProps(props)
.Build()
.Succeed();

new DotNetTest()
.WithConfiguration(configuration)
.WithProps(props)
.Build()
.Succeed();

new DotNetPack()
.WithConfiguration(configuration)
.WithNoBuild(true)
.WithProps(props)
.Build()
.Succeed();
Assertion.Succeed(
new DotNetTest()
.WithConfiguration(configuration)
.WithProps(props)
.Build());

Assertion.Succeed(
new DotNetPack()
.WithConfiguration(configuration)
.WithNoBuild(true)
.WithProps(props)
.Build());

packages.Add(Path.Combine(output, $"roslyn{@case.AnalyzerRoslynVersion}", $"Immutype.{nuGetVersion}.nupkg"));
}
Expand All @@ -68,12 +62,13 @@

if (!string.IsNullOrWhiteSpace(apiKey) && nuGetVersion.Release != "dev")
{
new DotNetNuGetPush()
.WithApiKey(apiKey)
.WithSources("https://api.nuget.org/v3/index.json")
.WithPackage(package)
.Run().
Succeed($"Pushing {Path.GetFileName(package)}");
Assertion.Succeed(
new DotNetNuGetPush()
.WithApiKey(apiKey)
.WithSources("https://api.nuget.org/v3/index.json")
.WithPackage(package)
.Run(),
$"Pushing {Path.GetFileName(package)}");
}

WriteLine($"Package version: {nuGetVersion}", Color.Highlighted);
Expand Down
8 changes: 4 additions & 4 deletions Build/Tools.cs
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ public static string Get(string name, string defaultProp, bool showWarning = fal

static class Assertion
{
public static bool Succeed(this int? exitCode, string shortName)
public static bool Succeed(int? exitCode, string shortName)
{
if (exitCode == 0)
{
Expand All @@ -114,7 +114,7 @@ public static bool Succeed(this int? exitCode, string shortName)
return false;
}

public static async Task<bool> Succeed(this Task<int?> exitCodeTask, string shortName) =>
public static async Task<bool> Succeed(Task<int?> exitCodeTask, string shortName) =>
Succeed(await exitCodeTask, shortName);

private static bool CheckBuildResult(IBuildResult result)
Expand All @@ -136,15 +136,15 @@ select testResult.ToString())
return false;
}

public static void Succeed(this IBuildResult result)
public static void Succeed(IBuildResult result)
{
if (!CheckBuildResult(result))
{
Exit();
}
}

public static async Task<bool> Succeed(this Task<IBuildResult> resultTask)
public static async Task<bool> Succeed(Task<IBuildResult> resultTask)
{
if (CheckBuildResult(await resultTask))
{
Expand Down

0 comments on commit 6fb26da

Please sign in to comment.