Skip to content

Commit 95510ea

Browse files
authored
fix: the pipeline fails due to misconfiguration (#4)
* removed unnecessary changes to Source folder * ci: added nuke * removed nuke temp folder fixes #4
1 parent c328566 commit 95510ea

17 files changed

+463
-18
lines changed

.github/workflows/dotnet.yml

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,4 @@ jobs:
1313

1414
- name: Restore, Build, Test
1515
run: |
16-
cd Source
17-
dotnet --info
18-
dotnet restore
19-
dotnet build --no-restore
20-
dotnet test --no-build --verbosity normal
16+
./build.sh test

.github/workflows/nuget_deploy.yml

Lines changed: 3 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -12,15 +12,8 @@ jobs:
1212
steps:
1313
- uses: actions/checkout@v2
1414

15-
# - name: Setup .NET 6
16-
# uses: actions/setup-dotnet@v1
17-
# with:
18-
# dotnet-version: 6.0.x
19-
2015
- name: Build, Test, Pack, Push
16+
env:
17+
- NU_GET_API_KEY=${{ secrets.NUGET_API_KEY }}
2118
run: |
22-
cd Source
23-
dotnet test -c Release --verbosity quiet
24-
cd ./MarkdownUtil
25-
dotnet pack -c Release
26-
dotnet nuget push nupkg/*.nupkg --api-key ${{secrets.NUGET_API_KEY}} -s https://api.nuget.org/v3/index.json --skip-duplicate
19+
./build.sh deploy

.gitignore

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,4 +3,5 @@ obj/
33
/packages/
44
riderModule.iml
55
/_ReSharper.Caches/
6-
nupkg/
6+
nupkg/
7+
temp/

.nuke/build.schema.json

Lines changed: 119 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,119 @@
1+
{
2+
"$schema": "http://json-schema.org/draft-04/schema#",
3+
"title": "Build Schema",
4+
"$ref": "#/definitions/build",
5+
"definitions": {
6+
"build": {
7+
"type": "object",
8+
"properties": {
9+
"Configuration": {
10+
"type": "string",
11+
"description": "Configuration to build - Default is 'Debug' (local) or 'Release' (server)",
12+
"enum": [
13+
"Debug",
14+
"Release"
15+
]
16+
},
17+
"Continue": {
18+
"type": "boolean",
19+
"description": "Indicates to continue a previously failed build attempt"
20+
},
21+
"Help": {
22+
"type": "boolean",
23+
"description": "Shows the help text for this build assembly"
24+
},
25+
"Host": {
26+
"type": "string",
27+
"description": "Host for execution. Default is 'automatic'",
28+
"enum": [
29+
"AppVeyor",
30+
"AzurePipelines",
31+
"Bamboo",
32+
"Bitbucket",
33+
"Bitrise",
34+
"GitHubActions",
35+
"GitLab",
36+
"Jenkins",
37+
"Rider",
38+
"SpaceAutomation",
39+
"TeamCity",
40+
"Terminal",
41+
"TravisCI",
42+
"VisualStudio",
43+
"VSCode"
44+
]
45+
},
46+
"NoLogo": {
47+
"type": "boolean",
48+
"description": "Disables displaying the NUKE logo"
49+
},
50+
"NuGetApiKey": {
51+
"type": "string",
52+
"description": "NuGet Api key for publishing to nuget.org",
53+
"default": "Secrets must be entered via 'nuke :secrets [profile]'"
54+
},
55+
"Partition": {
56+
"type": "string",
57+
"description": "Partition to use on CI"
58+
},
59+
"Plan": {
60+
"type": "boolean",
61+
"description": "Shows the execution plan (HTML)"
62+
},
63+
"Profile": {
64+
"type": "array",
65+
"description": "Defines the profiles to load",
66+
"items": {
67+
"type": "string"
68+
}
69+
},
70+
"Root": {
71+
"type": "string",
72+
"description": "Root directory during build execution"
73+
},
74+
"Skip": {
75+
"type": "array",
76+
"description": "List of targets to be skipped. Empty list skips all dependencies",
77+
"items": {
78+
"type": "string",
79+
"enum": [
80+
"Clean",
81+
"Compile",
82+
"Deploy",
83+
"Info",
84+
"Pack",
85+
"Restore",
86+
"Test"
87+
]
88+
}
89+
},
90+
"Target": {
91+
"type": "array",
92+
"description": "List of targets to be invoked. Default is '{default_target}'",
93+
"items": {
94+
"type": "string",
95+
"enum": [
96+
"Clean",
97+
"Compile",
98+
"Deploy",
99+
"Info",
100+
"Pack",
101+
"Restore",
102+
"Test"
103+
]
104+
}
105+
},
106+
"Verbosity": {
107+
"type": "string",
108+
"description": "Logging verbosity during build execution. Default is 'Normal'",
109+
"enum": [
110+
"Minimal",
111+
"Normal",
112+
"Quiet",
113+
"Verbose"
114+
]
115+
}
116+
}
117+
}
118+
}
119+
}

.nuke/parameters.json

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
{
2+
"$schema": "./build.schema.json",
3+
"Solution": "MarkdownUtils.sln"
4+
}

MarkdownUtils.sln

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,12 +21,16 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Docs", "Docs", "{F60C932C-8
2121
..\README.md = ..\README.md
2222
EndProjectSection
2323
EndProject
24+
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "_build", "Source\_build\_build.csproj", "{FC820075-0242-4C27-BB6D-43E82A014190}"
25+
EndProject
2426
Global
2527
GlobalSection(SolutionConfigurationPlatforms) = preSolution
2628
Debug|Any CPU = Debug|Any CPU
2729
Release|Any CPU = Release|Any CPU
2830
EndGlobalSection
2931
GlobalSection(ProjectConfigurationPlatforms) = postSolution
32+
{FC820075-0242-4C27-BB6D-43E82A014190}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
33+
{FC820075-0242-4C27-BB6D-43E82A014190}.Release|Any CPU.ActiveCfg = Release|Any CPU
3034
{6023348C-D873-4909-8D23-B22839B1C671}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
3135
{6023348C-D873-4909-8D23-B22839B1C671}.Debug|Any CPU.Build.0 = Debug|Any CPU
3236
{6023348C-D873-4909-8D23-B22839B1C671}.Release|Any CPU.ActiveCfg = Release|Any CPU

Source/MarkdownUtil/MarkdownUtil.csproj

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
<PackageLicenseExpression>MIT</PackageLicenseExpression>
1313
<PackageOutputPath>./nupkg</PackageOutputPath>
1414
<DockerDefaultTargetOS>Linux</DockerDefaultTargetOS>
15-
<Version>2.5.0</Version>
15+
<Version>2.5.1</Version>
1616
<AssemblyName>mdu</AssemblyName>
1717
<Authors>Jan Ruhlaender</Authors>
1818
<Description>Commandline Tool to lint and render a Markdown based documentation</Description>
@@ -31,7 +31,7 @@
3131
</ItemGroup>
3232

3333
<ItemGroup>
34-
<None Include="..\..\README.md" Pack="true" PackagePath="\"/>
34+
<None Include="..\..\README.md" Pack="true" PackagePath="\" />
3535
<ProjectReference Include="..\Markdown.Document\Markdown.Document.csproj" />
3636
<ProjectReference Include="..\Markdown.Renderer\Markdown.Renderer.csproj" />
3737
</ItemGroup>

Source/_build/.editorconfig

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
[*.cs]
2+
dotnet_style_qualification_for_field = false:warning
3+
dotnet_style_qualification_for_property = false:warning
4+
dotnet_style_qualification_for_method = false:warning
5+
dotnet_style_qualification_for_event = false:warning
6+
dotnet_style_require_accessibility_modifiers = never:warning
7+
8+
csharp_style_expression_bodied_methods = true:silent
9+
csharp_style_expression_bodied_properties = true:warning
10+
csharp_style_expression_bodied_indexers = true:warning
11+
csharp_style_expression_bodied_accessors = true:warning

Source/_build/Build.cs

Lines changed: 103 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,103 @@
1+
using System;
2+
using System.Linq;
3+
using Nuke.Common;
4+
using Nuke.Common.CI;
5+
using Nuke.Common.Execution;
6+
using Nuke.Common.IO;
7+
using Nuke.Common.ProjectModel;
8+
using Nuke.Common.Tooling;
9+
using Nuke.Common.Tools.DotNet;
10+
using Nuke.Common.Utilities.Collections;
11+
using Serilog;
12+
using static Nuke.Common.EnvironmentInfo;
13+
using static Nuke.Common.IO.FileSystemTasks;
14+
using static Nuke.Common.IO.PathConstruction;
15+
16+
class Build : NukeBuild
17+
{
18+
/// Support plugins are available for:
19+
/// - JetBrains ReSharper https://nuke.build/resharper
20+
/// - JetBrains Rider https://nuke.build/rider
21+
/// - Microsoft VisualStudio https://nuke.build/visualstudio
22+
/// - Microsoft VSCode https://nuke.build/vscode
23+
24+
public static int Main () => Execute<Build>(x => x.Compile);
25+
26+
[Parameter("Configuration to build - Default is 'Debug' (local) or 'Release' (server)")]
27+
readonly Configuration Configuration = IsLocalBuild ? Configuration.Debug : Configuration.Release;
28+
29+
readonly AbsolutePath CliProjectFolder = RootDirectory / "Source" / "MarkdownUtil";
30+
readonly AbsolutePath PackagePath = RootDirectory / "Source" / "MarkdownUtil" / "nupkg";
31+
32+
[Parameter("NuGet Api key for publishing to nuget.org")] [Secret] readonly string NuGetApiKey;
33+
34+
Target Clean => _ => _
35+
.Before(Restore)
36+
.Executes(() =>
37+
{
38+
DotNetTasks.DotNetClean(_ => _
39+
.SetConfiguration(Configuration));
40+
});
41+
42+
Target Info => _ => _
43+
.Executes(() =>
44+
{
45+
Log.Information("Configuration: {Configuration}", Configuration);
46+
});
47+
48+
Target Restore => _ => _
49+
.DependsOn(Info)
50+
.Executes(() =>
51+
{
52+
DotNetTasks.DotNetRestore();
53+
});
54+
55+
Target Compile => _ => _
56+
.DependsOn(Restore)
57+
.Executes(() =>
58+
{
59+
DotNetTasks.DotNetBuild(_ => _
60+
.SetConfiguration(Configuration)
61+
.EnableNoRestore());
62+
});
63+
64+
// Test are always executed in Release configuration
65+
Target Test => _ => _
66+
.DependsOn(Compile)
67+
.Executes(() =>
68+
{
69+
DotNetTasks.DotNetTest(_ => _
70+
.When(Configuration == global::Configuration.Release, _ => _
71+
.EnableNoRestore()
72+
.EnableNoBuild())
73+
.SetConfiguration(global::Configuration.Release));
74+
});
75+
76+
// We are forcing Release configuration for packaging, because we do not want any debug builds in the wild
77+
Target Pack => _ => _
78+
.DependsOn(Test)
79+
.Executes(() =>
80+
{
81+
PackagePath.GlobFiles("*.nupkg").ForEach(DeleteFile);
82+
DotNetTasks.DotNetPack(_ => _
83+
.SetProject(CliProjectFolder)
84+
.SetOutputDirectory(PackagePath)
85+
.When(Configuration == global::Configuration.Release, _ => _
86+
.EnableNoRestore()
87+
.EnableNoBuild())
88+
.SetConfiguration(Configuration.Release));
89+
});
90+
91+
Target Deploy => _ => _
92+
.DependsOn(Pack)
93+
.Requires(() => NuGetApiKey)
94+
.Executes(() =>
95+
{
96+
DotNetTasks.DotNetNuGetPush(_ => _
97+
.SetTargetPath(PackagePath / "*.nupkg")
98+
.SetApiKey(NuGetApiKey)
99+
.SetSource("https://api.nuget.org/v3/index.json")
100+
.EnableSkipDuplicate()
101+
);
102+
});
103+
}

Source/_build/Configuration.cs

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
using System;
2+
using System.ComponentModel;
3+
using System.Linq;
4+
using Nuke.Common.Tooling;
5+
6+
[TypeConverter(typeof(TypeConverter<Configuration>))]
7+
public class Configuration : Enumeration
8+
{
9+
public static Configuration Debug = new Configuration { Value = nameof(Debug) };
10+
public static Configuration Release = new Configuration { Value = nameof(Release) };
11+
12+
public static implicit operator string(Configuration configuration)
13+
{
14+
return configuration.Value;
15+
}
16+
}

0 commit comments

Comments
 (0)