Skip to content

Commit 4ca7e3a

Browse files
committed
Merge branch 'release/4.0.0'
* 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
2 parents d75f4dd + 82c1acd commit 4ca7e3a

File tree

9 files changed

+328
-202
lines changed

9 files changed

+328
-202
lines changed

.github/dependabot.yml

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
version: 2
2+
updates:
3+
- package-ecosystem: "nuget"
4+
directory: "/"
5+
schedule:
6+
interval: "daily"
7+
commit-message:
8+
prefix: "(maint)"
9+
target-branch: "develop"
10+
ignore:
11+
- dependency-name: "Cake.Core"
12+
- package-ecosystem: "github-actions"
13+
directory: "/"
14+
schedule:
15+
interval: "daily"
16+
commit-message:
17+
prefix: "(maint)"
18+
target-branch: "develop"
Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
# For most projects, this workflow file will not need changing; you simply need
2+
# to commit it to your repository.
3+
#
4+
# You may wish to alter this file to override the set of languages analyzed,
5+
# or to provide custom queries or build logic.
6+
name: "CodeQL"
7+
8+
on:
9+
push:
10+
branches: [develop]
11+
pull_request:
12+
# The branches below must be a subset of the branches above
13+
branches: [develop]
14+
schedule:
15+
- cron: '0 15 * * 6'
16+
17+
jobs:
18+
analyze:
19+
name: Analyze
20+
runs-on: ubuntu-latest
21+
22+
strategy:
23+
fail-fast: false
24+
matrix:
25+
# Override automatic language detection by changing the below list
26+
# Supported options are ['csharp', 'cpp', 'go', 'java', 'javascript', 'python']
27+
language: ['csharp']
28+
# Learn more...
29+
# https://docs.github.com/en/github/finding-security-vulnerabilities-and-errors-in-your-code/configuring-code-scanning#overriding-automatic-language-detection
30+
31+
steps:
32+
- name: Checkout repository
33+
uses: actions/[email protected]
34+
with:
35+
fetch-depth: 0
36+
37+
# If this run was triggered by a pull request event, then checkout
38+
# the head of the pull request instead of the merge commit.
39+
- run: git checkout HEAD^2
40+
if: ${{ github.event_name == 'pull_request' }}
41+
42+
# Initializes the CodeQL tools for scanning.
43+
- name: Initialize CodeQL
44+
uses: github/codeql-action/init@v1
45+
with:
46+
languages: ${{ matrix.language }}
47+
# If you wish to specify custom queries, you can do so here or in a config file.
48+
# By default, queries listed here will override any specified in a config file.
49+
# Prefix the list here with "+" to use these queries and those in the config file.
50+
# queries: ./path/to/local/query, your-org/your-repo/queries@main
51+
52+
- run: ./build.ps1
53+
shell: pwsh
54+
55+
- name: Perform CodeQL Analysis
56+
uses: github/codeql-action/analyze@v1
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
name: Run dependabot for cake
2+
on:
3+
workflow_dispatch:
4+
schedule:
5+
# run everyday at 6
6+
- cron: '0 6 * * *'
7+
8+
jobs:
9+
dependabot-cake:
10+
runs-on: ubuntu-latest # linux, because this is a docker-action
11+
steps:
12+
- name: check/update cake dependencies
13+
uses: nils-org/dependabot-cake-action@v1

.github/workflows/publishDocs.yml

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
name: Publish Documentation
2+
3+
on:
4+
workflow_dispatch:
5+
6+
env:
7+
WYAM_ACCESS_TOKEN: ${{ secrets.API_TOKEN }}
8+
# secrets.GITHUB_TOKEN has no permissions to push, sadly.
9+
WYAM_DEPLOY_BRANCH: 'gh-pages'
10+
WYAM_DEPLOY_REMOTE: "${{ github.event.repository.html_url }}"
11+
12+
jobs:
13+
cake:
14+
runs-on: ubuntu-latest
15+
16+
steps:
17+
- name: checkout
18+
uses: actions/[email protected] #https://github.com/actions/checkout
19+
with:
20+
fetch-depth: 0 # GitVersion is somewhat irritated when fetch-depth is "1"....
21+
ref: ${{ github.event.ref }}
22+
23+
- name: Cache Tools
24+
uses: actions/cache@v2
25+
with:
26+
path: tools
27+
key: ${{ runner.os }}-doc-tools-${{ hashFiles('recipe.cake') }}
28+
29+
- name: Publishing documentation
30+
uses: cake-build/cake-action@v1
31+
with:
32+
script-path: recipe.cake
33+
target: Force-Publish-Documentation
34+
verbosity: Diagnostic
35+
cake-version: 0.38.5
36+
cake-bootstrap: true

src/Cake.FileHelpers.Tests/Cake.FileHelpers.Tests.csproj

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,17 @@
1-
<Project Sdk="Microsoft.NET.Sdk">
1+
<Project Sdk="Microsoft.NET.Sdk">
22
<PropertyGroup>
3-
<TargetFrameworks>netcoreapp2.1;netcoreapp3.1</TargetFrameworks>
3+
<TargetFrameworks>net50;netcoreapp2.1;netcoreapp3.1</TargetFrameworks>
44
</PropertyGroup>
55
<ItemGroup>
6-
<PackageReference Include="Cake.Core" Version="0.33.0" />
7-
<PackageReference Include="Cake.Testing" Version="0.33.0" />
8-
<PackageReference Include="coverlet.msbuild" Version="3.0.3">
9-
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
10-
<PrivateAssets>all</PrivateAssets>
6+
<PackageReference Include="Cake.Core" Version="1.0.0" />
7+
<PackageReference Include="Cake.Testing" Version="1.0.0" />
8+
<PackageReference Include="coverlet.msbuild" Version="3.0.3">
9+
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
10+
<PrivateAssets>all</PrivateAssets>
1111
</PackageReference>
12-
<PackageReference Include="Microsoft.SourceLink.GitHub" Version="1.0.0">
13-
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
14-
<PrivateAssets>all</PrivateAssets>
12+
<PackageReference Include="Microsoft.SourceLink.GitHub" Version="1.0.0">
13+
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
14+
<PrivateAssets>all</PrivateAssets>
1515
</PackageReference>
1616
<PackageReference Include="xunit" Version="2.4.1" />
1717
<PackageReference Include="xunit.runner.visualstudio" Version="2.4.1" />

src/Cake.FileHelpers.Tests/Fakes/FakeCakeArguments.cs

Lines changed: 13 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,39 +1,37 @@
11
using System;
22
using System.Collections.Generic;
3+
using System.Linq;
34
using Cake.Core;
45

56
namespace Cake.Xamarin.Tests.Fakes
67
{
78
internal sealed class FakeCakeArguments : ICakeArguments
89
{
9-
private readonly Dictionary<string, string> _arguments;
10+
private readonly Dictionary<string, List<string>> _arguments;
1011

1112
/// <summary>
1213
/// Gets the arguments.
1314
/// </summary>
1415
/// <value>The arguments.</value>
15-
public IReadOnlyDictionary<string, string> Arguments
16-
{
17-
get { return _arguments; }
18-
}
16+
public IReadOnlyDictionary<string, List<string>> Arguments => _arguments;
1917

2018
/// <summary>
2119
/// Initializes a new instance of the <see cref="CakeArguments"/> class.
2220
/// </summary>
2321
public FakeCakeArguments()
2422
{
25-
_arguments = new Dictionary<string, string>(StringComparer.OrdinalIgnoreCase);
23+
_arguments = new Dictionary<string, List<string>>(StringComparer.OrdinalIgnoreCase);
2624
}
2725

2826
/// <summary>
2927
/// Initializes the argument list.
3028
/// </summary>
3129
/// <param name="arguments">The arguments.</param>
32-
public void SetArguments(IDictionary<string, string> arguments)
30+
public void SetArguments(IDictionary<string, List<string>> arguments)
3331
{
3432
if (arguments == null)
3533
{
36-
throw new ArgumentNullException("arguments");
34+
throw new ArgumentNullException(nameof(arguments));
3735
}
3836
_arguments.Clear();
3937
foreach (var argument in arguments)
@@ -54,15 +52,20 @@ public bool HasArgument(string name)
5452
return _arguments.ContainsKey(name);
5553
}
5654

55+
public ICollection<string> GetArguments(string name)
56+
{
57+
_arguments.TryGetValue(name, out var arguments);
58+
return arguments ?? (ICollection<string>)Array.Empty<string>();
59+
}
60+
5761
/// <summary>
5862
/// Gets an argument.
5963
/// </summary>
6064
/// <param name="name">The argument name.</param>
6165
/// <returns>The argument value.</returns>
6266
public string GetArgument(string name)
6367
{
64-
return _arguments.ContainsKey(name)
65-
? _arguments[name] : null;
68+
return GetArguments(name).LastOrDefault();
6669
}
6770
}
6871
}

src/Cake.FileHelpers.Tests/Fakes/FakeCakeContext.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ public FakeCakeContext ()
2121
log = new FakeLog();
2222
var runtime = new CakeRuntime();
2323
var platform = new FakePlatform(PlatformFamily.Windows);
24-
var environment = new CakeEnvironment (platform, runtime, log);
24+
var environment = new CakeEnvironment(platform, runtime);
2525
var globber = new Globber (fileSystem, environment);
2626

2727
var args = new FakeCakeArguments ();
@@ -30,7 +30,7 @@ public FakeCakeContext ()
3030
var dataService = new FakeDataService();
3131
var toolRepository = new ToolRepository(environment);
3232
var config = new FakeConfiguration();
33-
var toolResolutionStrategy = new ToolResolutionStrategy(fileSystem, environment, globber, config);
33+
var toolResolutionStrategy = new ToolResolutionStrategy(fileSystem, environment, globber, config, log);
3434
IToolLocator tools = new ToolLocator(environment, toolRepository, toolResolutionStrategy);
3535
var processRunner = new ProcessRunner(fileSystem, environment, log, tools, config);
3636
context = new CakeContext (fileSystem, environment, globber, log, args, processRunner, registry, tools, dataService, config);

0 commit comments

Comments
 (0)