Skip to content

Commit

Permalink
Merge branch 'release/4.0.0'
Browse files Browse the repository at this point in the history
* release/4.0.0:
  (GH-33): Update Cake.FileHelpers to target Cake v1.0.0
  (GH-42) Cross compile for .NET 5.0
  (GH-43) Add dependabot configuration
  (GH-46) Add publish docs workflow
  (GH-43) Add Cake dependabot workflow
  (GH-44) Add CodeQL analysis workflow
  • Loading branch information
gep13 committed Feb 25, 2021
2 parents d75f4dd + 82c1acd commit 4ca7e3a
Show file tree
Hide file tree
Showing 9 changed files with 328 additions and 202 deletions.
18 changes: 18 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
version: 2
updates:
- package-ecosystem: "nuget"
directory: "/"
schedule:
interval: "daily"
commit-message:
prefix: "(maint)"
target-branch: "develop"
ignore:
- dependency-name: "Cake.Core"
- package-ecosystem: "github-actions"
directory: "/"
schedule:
interval: "daily"
commit-message:
prefix: "(maint)"
target-branch: "develop"
56 changes: 56 additions & 0 deletions .github/workflows/codeql-analysis.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
# For most projects, this workflow file will not need changing; you simply need
# to commit it to your repository.
#
# You may wish to alter this file to override the set of languages analyzed,
# or to provide custom queries or build logic.
name: "CodeQL"

on:
push:
branches: [develop]
pull_request:
# The branches below must be a subset of the branches above
branches: [develop]
schedule:
- cron: '0 15 * * 6'

jobs:
analyze:
name: Analyze
runs-on: ubuntu-latest

strategy:
fail-fast: false
matrix:
# Override automatic language detection by changing the below list
# Supported options are ['csharp', 'cpp', 'go', 'java', 'javascript', 'python']
language: ['csharp']
# Learn more...
# https://docs.github.com/en/github/finding-security-vulnerabilities-and-errors-in-your-code/configuring-code-scanning#overriding-automatic-language-detection

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

# If this run was triggered by a pull request event, then checkout
# the head of the pull request instead of the merge commit.
- run: git checkout HEAD^2
if: ${{ github.event_name == 'pull_request' }}

# Initializes the CodeQL tools for scanning.
- name: Initialize CodeQL
uses: github/codeql-action/init@v1
with:
languages: ${{ matrix.language }}
# If you wish to specify custom queries, you can do so here or in a config file.
# By default, queries listed here will override any specified in a config file.
# Prefix the list here with "+" to use these queries and those in the config file.
# queries: ./path/to/local/query, your-org/your-repo/queries@main

- run: ./build.ps1
shell: pwsh

- name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@v1
13 changes: 13 additions & 0 deletions .github/workflows/dependabot-cake.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
name: Run dependabot for cake
on:
workflow_dispatch:
schedule:
# run everyday at 6
- cron: '0 6 * * *'

jobs:
dependabot-cake:
runs-on: ubuntu-latest # linux, because this is a docker-action
steps:
- name: check/update cake dependencies
uses: nils-org/dependabot-cake-action@v1
36 changes: 36 additions & 0 deletions .github/workflows/publishDocs.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
name: Publish Documentation

on:
workflow_dispatch:

env:
WYAM_ACCESS_TOKEN: ${{ secrets.API_TOKEN }}
# secrets.GITHUB_TOKEN has no permissions to push, sadly.
WYAM_DEPLOY_BRANCH: 'gh-pages'
WYAM_DEPLOY_REMOTE: "${{ github.event.repository.html_url }}"

jobs:
cake:
runs-on: ubuntu-latest

steps:
- name: checkout
uses: actions/checkout@v2.3.4 #https://github.com/actions/checkout
with:
fetch-depth: 0 # GitVersion is somewhat irritated when fetch-depth is "1"....
ref: ${{ github.event.ref }}

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

- name: Publishing documentation
uses: cake-build/cake-action@v1
with:
script-path: recipe.cake
target: Force-Publish-Documentation
verbosity: Diagnostic
cake-version: 0.38.5
cake-bootstrap: true
20 changes: 10 additions & 10 deletions src/Cake.FileHelpers.Tests/Cake.FileHelpers.Tests.csproj
Original file line number Diff line number Diff line change
@@ -1,17 +1,17 @@
<Project Sdk="Microsoft.NET.Sdk">
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFrameworks>netcoreapp2.1;netcoreapp3.1</TargetFrameworks>
<TargetFrameworks>net50;netcoreapp2.1;netcoreapp3.1</TargetFrameworks>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Cake.Core" Version="0.33.0" />
<PackageReference Include="Cake.Testing" Version="0.33.0" />
<PackageReference Include="coverlet.msbuild" Version="3.0.3">
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
<PrivateAssets>all</PrivateAssets>
<PackageReference Include="Cake.Core" Version="1.0.0" />
<PackageReference Include="Cake.Testing" Version="1.0.0" />
<PackageReference Include="coverlet.msbuild" Version="3.0.3">
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
<PrivateAssets>all</PrivateAssets>
</PackageReference>
<PackageReference Include="Microsoft.SourceLink.GitHub" Version="1.0.0">
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
<PrivateAssets>all</PrivateAssets>
<PackageReference Include="Microsoft.SourceLink.GitHub" Version="1.0.0">
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
<PrivateAssets>all</PrivateAssets>
</PackageReference>
<PackageReference Include="xunit" Version="2.4.1" />
<PackageReference Include="xunit.runner.visualstudio" Version="2.4.1" />
Expand Down
23 changes: 13 additions & 10 deletions src/Cake.FileHelpers.Tests/Fakes/FakeCakeArguments.cs
Original file line number Diff line number Diff line change
@@ -1,39 +1,37 @@
using System;
using System.Collections.Generic;
using System.Linq;
using Cake.Core;

namespace Cake.Xamarin.Tests.Fakes
{
internal sealed class FakeCakeArguments : ICakeArguments
{
private readonly Dictionary<string, string> _arguments;
private readonly Dictionary<string, List<string>> _arguments;

/// <summary>
/// Gets the arguments.
/// </summary>
/// <value>The arguments.</value>
public IReadOnlyDictionary<string, string> Arguments
{
get { return _arguments; }
}
public IReadOnlyDictionary<string, List<string>> Arguments => _arguments;

/// <summary>
/// Initializes a new instance of the <see cref="CakeArguments"/> class.
/// </summary>
public FakeCakeArguments()
{
_arguments = new Dictionary<string, string>(StringComparer.OrdinalIgnoreCase);
_arguments = new Dictionary<string, List<string>>(StringComparer.OrdinalIgnoreCase);
}

/// <summary>
/// Initializes the argument list.
/// </summary>
/// <param name="arguments">The arguments.</param>
public void SetArguments(IDictionary<string, string> arguments)
public void SetArguments(IDictionary<string, List<string>> arguments)
{
if (arguments == null)
{
throw new ArgumentNullException("arguments");
throw new ArgumentNullException(nameof(arguments));
}
_arguments.Clear();
foreach (var argument in arguments)
Expand All @@ -54,15 +52,20 @@ public bool HasArgument(string name)
return _arguments.ContainsKey(name);
}

public ICollection<string> GetArguments(string name)
{
_arguments.TryGetValue(name, out var arguments);
return arguments ?? (ICollection<string>)Array.Empty<string>();
}

/// <summary>
/// Gets an argument.
/// </summary>
/// <param name="name">The argument name.</param>
/// <returns>The argument value.</returns>
public string GetArgument(string name)
{
return _arguments.ContainsKey(name)
? _arguments[name] : null;
return GetArguments(name).LastOrDefault();
}
}
}
4 changes: 2 additions & 2 deletions src/Cake.FileHelpers.Tests/Fakes/FakeCakeContext.cs
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ public FakeCakeContext ()
log = new FakeLog();
var runtime = new CakeRuntime();
var platform = new FakePlatform(PlatformFamily.Windows);
var environment = new CakeEnvironment (platform, runtime, log);
var environment = new CakeEnvironment(platform, runtime);
var globber = new Globber (fileSystem, environment);

var args = new FakeCakeArguments ();
Expand All @@ -30,7 +30,7 @@ public FakeCakeContext ()
var dataService = new FakeDataService();
var toolRepository = new ToolRepository(environment);
var config = new FakeConfiguration();
var toolResolutionStrategy = new ToolResolutionStrategy(fileSystem, environment, globber, config);
var toolResolutionStrategy = new ToolResolutionStrategy(fileSystem, environment, globber, config, log);
IToolLocator tools = new ToolLocator(environment, toolRepository, toolResolutionStrategy);
var processRunner = new ProcessRunner(fileSystem, environment, log, tools, config);
context = new CakeContext (fileSystem, environment, globber, log, args, processRunner, registry, tools, dataService, config);
Expand Down
Loading

0 comments on commit 4ca7e3a

Please sign in to comment.