Skip to content

Commit

Permalink
Merge branch 'release/4.2.0'
Browse files Browse the repository at this point in the history
* release/4.2.0:
  Bump JetBrains.Annotations from 2022.1.0 to 2022.3.1
  (#114) added Cake.GitHubActions.Module
  (build) Switch to using latest Ubuntu image
  (build) Update OS'es for matrix build
  Bump actions/setup-dotnet from 3.0.2 to 3.0.3
  Bump actions/setup-dotnet from 3.0.1 to 3.0.2
  Bump actions/setup-dotnet from 3.0.0 to 3.0.1
  Bump actions/setup-dotnet from 2 to 3.0.0
  (maint) pinned to Cake 1.3.0
  Bump Cake.Recipe from 2.2.1 to 3.0.1
  Bump cake-build/cake-action from 1.4.0 to 1.4.1
  Bump github/codeql-action from 1 to 2
  Bump JetBrains.Annotations from 2021.3.0 to 2022.1.0
  Bump actions/upload-artifact from 2 to 3
  Bump actions/cache from 2.1.7 to 3
  Bump actions/checkout from 2.4.0 to 3
  Bump actions/setup-dotnet from 1.9.1 to 2
  Bump actions/setup-dotnet from 1.9.0 to 1.9.1
  • Loading branch information
gep13 committed Nov 21, 2022
2 parents 09c7ce5 + 90bc49e commit ebaeecc
Show file tree
Hide file tree
Showing 18 changed files with 265 additions and 49 deletions.
2 changes: 1 addition & 1 deletion .config/dotnet-tools.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"isRoot": true,
"tools": {
"cake.tool": {
"version": "0.38.5",
"version": "1.3.0",
"commands": [
"dotnet-cake"
]
Expand Down
29 changes: 14 additions & 15 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ jobs:
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ windows-2019, ubuntu-18.04, macos-10.15 ]
os: [windows-latest, macos-latest, ubuntu-latest]

env:
AZURE_PASSWORD: ${{ secrets.AZURE_PASSWORD }}
Expand All @@ -44,46 +44,45 @@ jobs:

steps:
- name: Checkout the repository
uses: actions/checkout@v2.4.0
uses: actions/checkout@v3

- name: Fetch all tags and branches
run: git fetch --prune --unshallow

- uses: actions/setup-dotnet@v1.9.0
- uses: actions/setup-dotnet@v3.0.3
with:
# codecov and unittests need 2.1
dotnet-version: '2.1.818'
- uses: actions/setup-dotnet@v1.9.0
- uses: actions/setup-dotnet@v3.0.3
with:
dotnet-version: '3.1.414'
- uses: actions/setup-dotnet@v1.9.0
- uses: actions/setup-dotnet@v3.0.3
with:
# gitversion needs 5.0
dotnet-version: '5.0.402'
- uses: actions/setup-dotnet@v1.9.0
- uses: actions/setup-dotnet@v3.0.3
with:
# need at least .NET 6 rc2 to build
dotnet-version: '6.0.100-rc.2.21505.57'
# need at least .NET 6 to build
dotnet-version: '6.0.400'
include-prerelease: true

- name: Cache Tools
uses: actions/cache@v2.1.7
uses: actions/cache@v3
with:
path: tools
key: ${{ runner.os }}-tools-${{ hashFiles('recipe.cake') }}

- name: Build project
uses: cake-build/[email protected].0
uses: cake-build/[email protected].1
with:
script-path: recipe.cake
target: CI
verbosity: Diagnostic
cake-version: 0.38.5
cake-bootstrap: true
cake-version: 1.3.0

# currently, Cake.Recipe does not upload artifacts when run on gh-actions
- name: Upload Issues
uses: actions/upload-artifact@v2
uses: actions/upload-artifact@v3
with:
if-no-files-found: warn
name: ${{ matrix.os }} Issues
Expand All @@ -92,9 +91,9 @@ jobs:
BuildArtifacts/**/coverlet/*.xml
- name: Upload Packages
uses: actions/upload-artifact@v2
uses: actions/upload-artifact@v3
if: runner.os == 'Windows'
with:
if-no-files-found: warn
name: package
path: BuildArtifacts/Packages/**/*
path: BuildArtifacts/Packages/**/*
27 changes: 13 additions & 14 deletions .github/workflows/codeql-analysis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ on:
jobs:
analyze:
name: Analyze
runs-on: ubuntu-18.04
runs-on: ubuntu-latest

strategy:
fail-fast: false
Expand All @@ -20,45 +20,44 @@ jobs:

steps:
- name: Checkout repository
uses: actions/checkout@v2.4.0
uses: actions/checkout@v3
with:
fetch-depth: 0

- uses: actions/setup-dotnet@v1.9.0
- uses: actions/setup-dotnet@v3.0.3
with:
# codecov and unittests need 2.1
dotnet-version: '2.1.818'
- uses: actions/setup-dotnet@v1.9.0
- uses: actions/setup-dotnet@v3.0.3
with:
dotnet-version: '3.1.414'
- uses: actions/setup-dotnet@v1.9.0
- uses: actions/setup-dotnet@v3.0.3
with:
# gitversion needs 5.0
dotnet-version: '5.0.402'
- uses: actions/setup-dotnet@v1.9.0
- uses: actions/setup-dotnet@v3.0.3
with:
# need at least .NET 6 rc2 to build
dotnet-version: '6.0.100-rc.2.21505.57'
# need at least .NET 6 to build
dotnet-version: '6.0.400'
include-prerelease: true

- name: Cache Tools
uses: actions/cache@v2.1.7
uses: actions/cache@v3
with:
path: tools
key: ${{ runner.os }}-tools-${{ hashFiles('recipe.cake') }}

- name: Initialize CodeQL
uses: github/codeql-action/init@v1
uses: github/codeql-action/init@v2
with:
languages: ${{ matrix.language }}

- name: Build project
uses: cake-build/[email protected].0
uses: cake-build/[email protected].1
with:
script-path: recipe.cake
target: DotNetCore-Build
cake-version: 0.38.5
cake-bootstrap: true
cake-version: 1.3.0

- name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@v1
uses: github/codeql-action/analyze@v2
3 changes: 0 additions & 3 deletions build.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,5 @@ $env:DOTNET_NOLOGO = '1'
dotnet tool restore
if ($LASTEXITCODE -ne 0) { exit $LASTEXITCODE }

dotnet cake recipe.cake --bootstrap
if ($LASTEXITCODE -ne 0) { exit $LASTEXITCODE }

dotnet cake recipe.cake @args
if ($LASTEXITCODE -ne 0) { exit $LASTEXITCODE }
2 changes: 0 additions & 2 deletions build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,4 @@ export DOTNET_NOLOGO=1

dotnet tool restore

dotnet cake recipe.cake --bootstrap

dotnet cake recipe.cake "$@"
2 changes: 1 addition & 1 deletion global.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"sdk": {
"allowPrerelease": true,
"version": "6.0.100-rc.2",
"version": "6.0.400",
"rollForward": "latestFeature"
}
}
9 changes: 1 addition & 8 deletions recipe.cake
Original file line number Diff line number Diff line change
@@ -1,7 +1,4 @@
#load nuget:?package=Cake.Recipe&version=2.2.1

// Workaround for https://github.com/cake-contrib/Cake.Recipe/issues/854
#tool nuget:?package=NuGet.CommandLine&version=5.8.1
#load nuget:?package=Cake.Recipe&version=3.0.1

Environment.SetVariableNames();

Expand All @@ -13,7 +10,6 @@ BuildParameters.SetParameters(
sourceDirectoryPath: "./src",
title: "Cake.BuildSystems.Module",
repositoryOwner: "cake-contrib",
shouldRunDupFinder: false, // leave this out, for now.
shouldRunDotNetCorePack: true,
shouldUseDeterministicBuilds: true,
gitterMessage: "@/all " + standardNotificationMessage,
Expand All @@ -25,7 +21,4 @@ BuildParameters.PrintParameters(Context);

ToolSettings.SetToolSettings(context: Context);

ToolSettings.SetToolPreprocessorDirectives(
reSharperTools: "#tool nuget:?package=JetBrains.ReSharper.CommandLineTools&version=2021.2.0");

Build.RunDotNetCore();
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
<ItemGroup>
<PackageReference Include="Cake.Core" Version="2.0.0" PrivateAssets="All" />
<PackageReference Include="Cake.Common" Version="2.0.0" PrivateAssets="All" />
<PackageReference Include="JetBrains.Annotations" Version="2021.3.0" PrivateAssets="All" />
<PackageReference Include="JetBrains.Annotations" Version="2022.3.1" PrivateAssets="All" />
<PackageReference Include="Microsoft.SourceLink.GitHub" Version="1.1.1">
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
<PrivateAssets>all</PrivateAssets>
Expand Down
14 changes: 14 additions & 0 deletions src/Cake.BuildSystems.Module.sln
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,8 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Cake.MyGet.Module", "Cake.M
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Cake.BuildSystems.Module", "Cake.BuildSystems.Module\Cake.BuildSystems.Module.csproj", "{F9A7A095-162B-416D-9BBD-90EB447111EC}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Cake.GitHubActions.Module", "Cake.GitHubActions.Module\Cake.GitHubActions.Module.csproj", "{A6BAA454-179C-422C-A954-38852265722F}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Expand Down Expand Up @@ -101,6 +103,18 @@ Global
{F9A7A095-162B-416D-9BBD-90EB447111EC}.Release|x64.Build.0 = Release|Any CPU
{F9A7A095-162B-416D-9BBD-90EB447111EC}.Release|x86.ActiveCfg = Release|Any CPU
{F9A7A095-162B-416D-9BBD-90EB447111EC}.Release|x86.Build.0 = Release|Any CPU
{A6BAA454-179C-422C-A954-38852265722F}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{A6BAA454-179C-422C-A954-38852265722F}.Debug|Any CPU.Build.0 = Debug|Any CPU
{A6BAA454-179C-422C-A954-38852265722F}.Debug|x64.ActiveCfg = Debug|Any CPU
{A6BAA454-179C-422C-A954-38852265722F}.Debug|x64.Build.0 = Debug|Any CPU
{A6BAA454-179C-422C-A954-38852265722F}.Debug|x86.ActiveCfg = Debug|Any CPU
{A6BAA454-179C-422C-A954-38852265722F}.Debug|x86.Build.0 = Debug|Any CPU
{A6BAA454-179C-422C-A954-38852265722F}.Release|Any CPU.ActiveCfg = Release|Any CPU
{A6BAA454-179C-422C-A954-38852265722F}.Release|Any CPU.Build.0 = Release|Any CPU
{A6BAA454-179C-422C-A954-38852265722F}.Release|x64.ActiveCfg = Release|Any CPU
{A6BAA454-179C-422C-A954-38852265722F}.Release|x64.Build.0 = Release|Any CPU
{A6BAA454-179C-422C-A954-38852265722F}.Release|x86.ActiveCfg = Release|Any CPU
{A6BAA454-179C-422C-A954-38852265722F}.Release|x86.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
Expand Down
3 changes: 3 additions & 0 deletions src/Cake.BuildSystems.Module/Cake.BuildSystems.Module.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,9 @@
<ProjectReference Include="..\Cake.TravisCI.Module\Cake.TravisCI.Module.csproj">
<PrivateAssets>all</PrivateAssets>
</ProjectReference>
<ProjectReference Include="..\Cake.GitHubActions.Module\Cake.GitHubActions.Module.csproj">
<PrivateAssets>all</PrivateAssets>
</ProjectReference>
</ItemGroup>

<ItemGroup>
Expand Down
27 changes: 27 additions & 0 deletions src/Cake.GitHubActions.Module/Cake.GitHubActions.Module.csproj
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFramework>netcoreapp3.1</TargetFramework>
<GenerateDocumentationFile>true</GenerateDocumentationFile>
<AssemblyName>Cake.GitHubActions.Module</AssemblyName>
<IsPackable>false</IsPackable>
</PropertyGroup>

<ItemGroup>
<ProjectReference Include="..\Cake.Module.Shared\Cake.Module.Shared.csproj" />
</ItemGroup>

<ItemGroup>
<PackageReference Include="Cake.Core" Version="2.0.0" PrivateAssets="All" />
<PackageReference Include="Cake.Common" Version="2.0.0" PrivateAssets="All" />
<PackageReference Include="JetBrains.Annotations" Version="2022.3.1" PrivateAssets="All" />
<PackageReference Include="Microsoft.SourceLink.GitHub" Version="1.1.1">
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
<PrivateAssets>all</PrivateAssets>
</PackageReference>
<PackageReference Include="StyleCop.Analyzers" Version="1.1.118">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
</ItemGroup>
</Project>
86 changes: 86 additions & 0 deletions src/Cake.GitHubActions.Module/GitHubActionsEngine.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,86 @@
using Cake.Common.Build;
using Cake.Core;
using Cake.Core.Diagnostics;
using Cake.Module.Shared;

using JetBrains.Annotations;

namespace Cake.GitHubActions.Module
{
/// <summary>
/// <see cref="ICakeEngine"/> implementation for GitHub Actions.
/// </summary>
[UsedImplicitly]
public sealed class GitHubActionsEngine : CakeEngineBase
{
private readonly IConsole _console;

/// <summary>
/// Initializes a new instance of the <see cref="GitHubActionsEngine"/> class.
/// </summary>
/// <param name="dataService">Implementation of <see cref="ICakeDataService"/>.</param>
/// <param name="log">Implementation of <see cref="ICakeLog"/>.</param>
/// <param name="console">Implementation of <see cref="IConsole"/>.</param>
public GitHubActionsEngine(ICakeDataService dataService, ICakeLog log, IConsole console)
: base(new CakeEngine(dataService, log))
{
_console = console;
_engine.BeforeSetup += OnBeforeSetup;
_engine.AfterSetup += OnAfterSetup;
_engine.BeforeTaskSetup += OnBeforeTaskSetup;
_engine.BeforeTaskTeardown += OnBeforeTaskTeardown;
_engine.BeforeTeardown += OnBeforeBuildTeardown;
_engine.AfterTeardown += OnAfterBuildTeardown;
}

private void WriteStartBlock(BuildSystem buildSystem, string name)
{
if (!buildSystem.IsRunningOnGitHubActions)
{
return;
}

_console.WriteLine($"::group::{name}");
}

private void WriteEndBlock(BuildSystem buildSystem)
{
if (!buildSystem.IsRunningOnGitHubActions)
{
return;
}

_console.WriteLine("::endgroup::");
}

private void OnBeforeSetup(object sender, BeforeSetupEventArgs e)
{
WriteStartBlock(e.Context.BuildSystem(), "Setup");
}

private void OnAfterSetup(object sender, AfterSetupEventArgs e)
{
WriteEndBlock(e.Context.BuildSystem());
}

private void OnBeforeTaskSetup(object sender, BeforeTaskSetupEventArgs e)
{
WriteStartBlock(e.TaskSetupContext.BuildSystem(), e.TaskSetupContext.Task.Name);
}

private void OnBeforeTaskTeardown(object sender, BeforeTaskTeardownEventArgs e)
{
WriteEndBlock(e.TaskTeardownContext.BuildSystem());
}

private void OnBeforeBuildTeardown(object sender, BeforeTeardownEventArgs e)
{
WriteStartBlock(e.TeardownContext.BuildSystem(), "Teardown");
}

private void OnAfterBuildTeardown(object sender, AfterTeardownEventArgs e)
{
WriteEndBlock(e.TeardownContext.BuildSystem());
}
}
}
Loading

0 comments on commit ebaeecc

Please sign in to comment.