Skip to content

Commit

Permalink
Merge branch 'release/0.3.2'
Browse files Browse the repository at this point in the history
  • Loading branch information
agc93 committed Sep 4, 2019
2 parents 518cb52 + 903a445 commit 2c2c5fd
Show file tree
Hide file tree
Showing 12 changed files with 82 additions and 20 deletions.
6 changes: 6 additions & 0 deletions ReleaseNotes.md
Original file line number Diff line number Diff line change
Expand Up @@ -42,3 +42,9 @@
- Supports Cake 0.30.0
- Retargeted to .NET Standard 2.0 (raise issues if you see new issues from this)
- Thanks again to @flcdrg and @RaringCoder for contributions and testing!

# 0.3.2

- Supports Cake 0.34.1
- Fixes errors writing summary report when run in Azure Pipelines container (#21)
- Thanks again to @flcdrg for contributions!
44 changes: 44 additions & 0 deletions azure-pipelines.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
trigger:
- master
- develop

variables:
buildConfiguration: 'Release'
cakeVersion: 0.34.1
sdkVersion: '2.2.300'
target: NuGet

pool:
vmImage: 'windows-2019'
steps:
- task: UseDotNet@2
displayName: 'Use .NET Core SDK'
inputs:
packageType: sdk
version: $(sdkVersion)
installationPath: $(Agent.ToolsDirectory)/dotnet
- task: NuGetToolInstaller@1
inputs:
versionSpec: '>=5.x'
- task: DotNetCoreCLI@2
displayName: Install Cake tool
inputs:
command: custom
custom: tool
arguments: install -g Cake.Tool --version $(cakeVersion)
- task: DotNetCoreCLI@2
displayName: Run build
inputs:
command: custom
custom: cake
arguments: --settings_skipverification=true --target=$(target)
- task: PublishPipelineArtifact@1
displayName: Publish packages artifact
inputs:
path: dist/package
artifact: package
- task: PublishPipelineArtifact@1
displayName: Publish build output
inputs:
path: dist/build
artifact: publish
2 changes: 1 addition & 1 deletion build.cake
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ Task("NuGet")
Summary = "A simple Cake module to enhance running from a hosted CI environment.",
ProjectUrl = new Uri("https://github.com/agc93/Cake.BuildSystems.Module"),
IconUrl = new Uri("https://cakeresources.blob.core.windows.net/nuget/64/deployment-64.png"),
LicenseUrl = new Uri("https://raw.githubusercontent.com/agc93/Cake.BuildSystems.Module/master/LICENSE"),
License = new NuSpecLicense() { Type = "expression", Value = "MIT" },
Copyright = "Alistair Chapman 2017",
Tags = new[] { "cake", "build", "ci", "build" },
OutputDirectory = artifacts + "/package",
Expand Down
4 changes: 2 additions & 2 deletions src/Cake.Module.Shared/Cake.Module.Shared.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Cake.Core" Version="0.30.0" />
<PackageReference Include="Cake.Common" Version="0.30.0" />
<PackageReference Include="Cake.Core" Version="0.34.1" />
<PackageReference Include="Cake.Common" Version="0.34.1" />
</ItemGroup>
</Project>
4 changes: 2 additions & 2 deletions src/Cake.MyGet.Module/Cake.MyGet.Module.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@
</ItemGroup>

<ItemGroup>
<PackageReference Include="Cake.Core" Version="0.30.0" />
<PackageReference Include="Cake.Common" Version="0.30.0" />
<PackageReference Include="Cake.Core" Version="0.34.1" />
<PackageReference Include="Cake.Common" Version="0.34.1" />
</ItemGroup>

</Project>
4 changes: 2 additions & 2 deletions src/Cake.TFBuild.Module/Cake.TFBuild.Module.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@
</ItemGroup>

<ItemGroup>
<PackageReference Include="Cake.Core" Version="0.30.0" />
<PackageReference Include="Cake.Common" Version="0.30.0" />
<PackageReference Include="Cake.Core" Version="0.34.1" />
<PackageReference Include="Cake.Common" Version="0.34.1" />
</ItemGroup>

</Project>
2 changes: 2 additions & 0 deletions src/Cake.TFBuild.Module/Extensions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -13,5 +13,7 @@ public static void UpdateProgress(this ITFBuildProvider provider, Guid parent, i
{
provider.Commands.UpdateRecord(parent, new TFBuildRecordData {Progress = progress, Status = TFBuildTaskStatus.InProgress});
}

internal static bool IsRunningOnPipelines(this Common.Build.BuildSystem b) => b.IsRunningOnAzurePipelines || b.IsRunningOnAzurePipelinesHosted;
}
}
8 changes: 4 additions & 4 deletions src/Cake.TFBuild.Module/TFBuildEngine.cs
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ public TFBuildEngine(ICakeDataService dataService, ICakeLog log) : base(new Cake
private void OnBuildTeardown(object sender, TeardownEventArgs e)
{
var b = e.TeardownContext.BuildSystem();
if (b.IsRunningOnVSTS || b.IsRunningOnTFS)
if (b.IsRunningOnPipelines())
{
b.TFBuild.Commands.UpdateRecord(_parentRecord, new TFBuildRecordData
{
Expand All @@ -45,7 +45,7 @@ private void OnBuildTeardown(object sender, TeardownEventArgs e)
private void OnTaskTeardown(object sender, TaskTeardownEventArgs e)
{
var b = e.TaskTeardownContext.BuildSystem();
if (b.IsRunningOnVSTS || b.IsRunningOnTFS)
if (b.IsRunningOnPipelines())
{
var currentTask = _engine.Tasks.First(t => t.Name == e.TaskTeardownContext.Task.Name);
var currentIndex = _engine.Tasks.ToList().IndexOf(currentTask);
Expand All @@ -72,7 +72,7 @@ private void OnTaskTeardown(object sender, TaskTeardownEventArgs e)
private void OnTaskSetup(object sender, TaskSetupEventArgs e)
{
var b = e.TaskSetupContext.BuildSystem();
if (b.IsRunningOnVSTS || b.IsRunningOnTFS)
if (b.IsRunningOnPipelines())
{
var currentTask =
_engine.Tasks.First(t => t.Name == e.TaskSetupContext.Task.Name);
Expand All @@ -96,7 +96,7 @@ private int GetProgress(int currentTask, int count)
private void BuildSetup(object sender, SetupEventArgs e)
{
var b = e.Context.BuildSystem();
if (b.IsRunningOnTFS || b.IsRunningOnVSTS)
if (b.IsRunningOnPipelines())
{
//e.Context.TFBuild().Commands.SetProgress(0, "Build Setup");
e.Context.TFBuild().Commands.SetProgress(0, string.Empty);
Expand Down
18 changes: 14 additions & 4 deletions src/Cake.TFBuild.Module/TFBuildReportPrinter.cs
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,24 @@

namespace Cake.TFBuild.Module
{
/// <summary>
/// The TF Build/Azure Pipelines report printer.
/// </summary>
public class TFBuildReportPrinter : CakeReportPrinterBase
{
/// <summary>
/// Initializes a new instance of the <see cref="TFBuildReportPrinter"/> class.
/// </summary>
/// <param name="console">The console.</param>
/// <param name="context">The context.</param>
public TFBuildReportPrinter(IConsole console, ICakeContext context) : base(console, context)
{
}

/// <summary>
/// Writes the specified report to a target.
/// </summary>
/// <param name="report">The report to write.</param>
public override void Write(CakeReport report)
{
if (report == null)
Expand All @@ -24,7 +36,7 @@ public override void Write(CakeReport report)
try
{

if (_context.TFBuild().IsRunningOnTFS || _context.TFBuild().IsRunningOnVSTS) {
if (_context.TFBuild().IsRunningOnAzurePipelines || _context.TFBuild().IsRunningOnAzurePipelinesHosted) {
WriteToMarkdown(report);
}
WriteToConsole(report);
Expand Down Expand Up @@ -63,7 +75,7 @@ private void WriteToMarkdown(CakeReport report)
}
sb.AppendLine("");
var b = _context.BuildSystem().TFBuild;
FilePath agentWorkPath = b.Environment.Agent.WorkingDirectory + "/tasksummary.md";
FilePath agentWorkPath = b.Environment.Build.ArtifactStagingDirectory + "/tasksummary.md";
var absFilePath = agentWorkPath.MakeAbsolute(_context.Environment);
var file = _context.FileSystem.GetFile(absFilePath);
using (var writer = new StreamWriter(file.OpenWrite())) {
Expand All @@ -72,7 +84,5 @@ private void WriteToMarkdown(CakeReport report)
//b.Commands.UploadTaskSummary(absFilePath);
_console.WriteLine($"##vso[task.addattachment type=Distributedtask.Core.Summary;name=Cake Build Summary;]{absFilePath.MakeAbsolute(_context.Environment).FullPath}");
}


}
}
4 changes: 2 additions & 2 deletions src/Cake.TeamCity.Module/Cake.TeamCity.Module.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@
</ItemGroup>

<ItemGroup>
<PackageReference Include="Cake.Core" Version="0.30.0" />
<PackageReference Include="Cake.Common" Version="0.30.0" />
<PackageReference Include="Cake.Core" Version="0.34.1" />
<PackageReference Include="Cake.Common" Version="0.34.1" />
</ItemGroup>

</Project>
4 changes: 2 additions & 2 deletions src/Cake.TravisCI.Module/Cake.TravisCI.Module.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@
</ItemGroup>

<ItemGroup>
<PackageReference Include="Cake.Core" Version="0.30.0" />
<PackageReference Include="Cake.Common" Version="0.30.0" />
<PackageReference Include="Cake.Core" Version="0.34.1" />
<PackageReference Include="Cake.Common" Version="0.34.1" />
</ItemGroup>

</Project>
2 changes: 1 addition & 1 deletion tools/packages.config
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="Cake" version="0.24.0" />
<package id="Cake" version="0.34.1" />
</packages>

0 comments on commit 2c2c5fd

Please sign in to comment.