Skip to content

Commit bbf1978

Browse files
authored
Release (#23)
1 parent 6cace8c commit bbf1978

19 files changed

Lines changed: 229 additions & 22 deletions

File tree

.github/workflows/pull-requests.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,4 +30,4 @@ jobs:
3030
run: dotnet publish -o bake-it Source/Bake
3131

3232
- name: Run Bake
33-
run: bake-it/Bake run --build-version 0.0.$GITHUB_RUN_NUMBER
33+
run: bake-it/Bake run --build-version 0.0.$GITHUB_RUN_NUMBER --print-plan=true

.github/workflows/release.yml

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
name: release
2+
3+
on:
4+
push:
5+
branches: [ release ]
6+
7+
jobs:
8+
build:
9+
runs-on: ubuntu-latest
10+
11+
env:
12+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
13+
14+
services:
15+
baget:
16+
image: loicsharma/baget
17+
env:
18+
ApiKey: acd0b30512ac4fa39f62eb7a61fcf56c
19+
ports:
20+
- 5555:80
21+
22+
steps:
23+
- uses: actions/checkout@v2
24+
25+
- name: Setup .NET Core
26+
uses: actions/setup-dotnet@v1
27+
with:
28+
dotnet-version: 3.1.404
29+
30+
- name: Publish Bake
31+
run: dotnet publish -o bake-it Source/Bake
32+
33+
- name: Run Bake
34+
run: bake-it/Bake run --convention=Release --print-plan=true --build-version 0.0.$GITHUB_RUN_NUMBER --destination="nuget>github"

.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -349,3 +349,6 @@ MigrationBackup/
349349
# Ionide (cross platform F# VS Code tools) working folder
350350
.ionide/
351351
*.orig
352+
353+
# Bake specific
354+
/bake-it

Bake.sln

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,13 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Bake", "Source\Bake\Bake.cs
77
EndProject
88
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Bake.Tests", "Source\Bake.Tests\Bake.Tests.csproj", "{7B627E59-1653-4AED-BDD1-9B3654818FCF}"
99
EndProject
10+
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = ".build", ".build", "{F1119402-8DEF-401A-9F21-54AB22F0A6EC}"
11+
ProjectSection(SolutionItems) = preProject
12+
.github\workflows\pull-requests.yml = .github\workflows\pull-requests.yml
13+
.github\workflows\release.yml = .github\workflows\release.yml
14+
RELEASE_NOTES.md = RELEASE_NOTES.md
15+
EndProjectSection
16+
EndProject
1017
Global
1118
GlobalSection(SolutionConfigurationPlatforms) = preSolution
1219
Debug|Any CPU = Debug|Any CPU

RELEASE_NOTES.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
# 0.1 alpha version of Bake
2+
3+
- Basic functionality

Source/Bake.Tests/Helpers/GitHelper.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ public static void Create(string path)
3333

3434
using var repository = new Repository(path);
3535

36-
repository.Network.Remotes.Add("origin", "https://github.com/rasmus/Bake.git");
36+
repository.Network.Remotes.Add("origin", "git@github.com:rasmus/Bake.git");
3737

3838
var signature = new Signature("test", "test@example.org", DateTimeOffset.Now);
3939
repository.Commit(

Source/Bake.Tests/IntegrationTests/BakeTests/NetCoreConsoleTests.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ public async Task PlanThenApply(LogEventLevel logLevel)
6868
var planPath = Path.Combine(WorkingDirectory, "plan.bake");
6969
var returnCode = await ExecuteAsync(
7070
"plan",
71-
"--destination=nuget>github",
71+
"--destination=\"nuget>github\"",
7272
$"--log-level:{logLevel}",
7373
"--build-version", SemVer.Random.ToString(),
7474
"--plan-path", $"\"{planPath}\"");

Source/Bake.Tests/UnitTests/Core/CredentialsTests.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,7 @@ public async Task GetNuGetApiKeyAsync(
4242
string expectedCredentials)
4343
{
4444
// Arrange
45+
Inject<IDefaults>(A<Defaults>());
4546
Inject<IEnvironmentVariables>(new TestEnvironmentVariables(new Dictionary<string, string>(StringComparer.OrdinalIgnoreCase)
4647
{
4748
[environmentKey] = expectedCredentials
Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
// MIT License
2+
//
3+
// Copyright (c) 2021 Rasmus Mikkelsen
4+
//
5+
// Permission is hereby granted, free of charge, to any person obtaining a copy
6+
// of this software and associated documentation files (the "Software"), to deal
7+
// in the Software without restriction, including without limitation the rights
8+
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9+
// copies of the Software, and to permit persons to whom the Software is
10+
// furnished to do so, subject to the following conditions:
11+
//
12+
// The above copyright notice and this permission notice shall be included in all
13+
// copies or substantial portions of the Software.
14+
//
15+
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16+
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17+
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18+
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19+
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20+
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21+
// SOFTWARE.
22+
23+
using Bake.Core;
24+
using Bake.Tests.Helpers;
25+
using FluentAssertions;
26+
using NUnit.Framework;
27+
28+
// ReSharper disable StringLiteralTypo
29+
30+
namespace Bake.Tests.UnitTests.Core
31+
{
32+
public class GitRemoteParserTests : TestIt
33+
{
34+
[TestCase(
35+
"git@github.com:rasmus/Bake.git",
36+
"git",
37+
"github.com",
38+
"/rasmus/Bake.git")]
39+
[TestCase(
40+
"https://github.com/rasmus/Bake.git",
41+
"https",
42+
"github.com",
43+
"/rasmus/Bake.git")]
44+
public void TryParse(
45+
string input,
46+
string expectedScheme,
47+
string expectedHost,
48+
string expectedPath)
49+
{
50+
// Act
51+
GitRemoteParser.TryParse(input, out var url).Should().BeTrue();
52+
53+
// Assert
54+
url.Scheme.Should().Be(expectedScheme, url.AbsoluteUri);
55+
url.Host.Should().Be(expectedHost, url.AbsoluteUri);
56+
url.PathAndQuery.Should().Be(expectedPath, url.AbsoluteUri);
57+
}
58+
}
59+
}

Source/Bake/Commands/Run/RunCommand.cs

Lines changed: 18 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,10 @@
2020
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
2121
// SOFTWARE.
2222

23+
using System;
2324
using System.IO;
2425
using System.Linq;
26+
using System.Text;
2527
using System.Threading;
2628
using System.Threading.Tasks;
2729
using Bake.Cooking;
@@ -38,15 +40,18 @@ public class RunCommand : ICommand
3840
private readonly IEditor _editor;
3941
private readonly IKitchen _kitchen;
4042
private readonly ILogCollector _logCollector;
43+
private readonly IYaml _yaml;
4144

4245
public RunCommand(
4346
IEditor editor,
4447
IKitchen kitchen,
45-
ILogCollector logCollector)
48+
ILogCollector logCollector,
49+
IYaml yaml)
4650
{
4751
_editor = editor;
4852
_kitchen = kitchen;
4953
_logCollector = logCollector;
54+
_yaml = yaml;
5055
}
5156

5257
// ReSharper disable once UnusedMember.Global
@@ -55,7 +60,8 @@ public async Task<int> ExecuteAsync(
5560
CancellationToken cancellationToken,
5661
Convention convention = Convention.Default,
5762
Destination[] destination = null,
58-
LogEventLevel logLevel = LogEventLevel.Information)
63+
LogEventLevel logLevel = LogEventLevel.Information,
64+
bool printPlan = false)
5965
{
6066
_logCollector.LogLevel = logLevel;
6167

@@ -76,6 +82,16 @@ public async Task<int> ExecuteAsync(
7682
return ExitCodes.Core.NoRecipes;
7783
}
7884

85+
if (printPlan)
86+
{
87+
var plan = new StringBuilder()
88+
.AppendLine(new string('=', 40))
89+
.AppendLine(await _yaml.SerializeAsync(book, cancellationToken))
90+
.AppendLine(new string('=', 40))
91+
.ToString();
92+
Console.WriteLine(plan);
93+
}
94+
7995
var success = await _kitchen.CookAsync(
8096
content,
8197
book,

0 commit comments

Comments
 (0)