Skip to content

Commit f2719a2

Browse files
committed
GitTools#2874 - updated the workflows
1 parent d58fcf6 commit f2719a2

File tree

10 files changed

+101
-29
lines changed

10 files changed

+101
-29
lines changed

.github/actions/artifacts-restore/action.yml

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -18,12 +18,6 @@ runs:
1818
with:
1919
path: tools
2020
key: tools-${{ runner.os }}-${{ hashFiles('./build/**') }}
21-
-
22-
uses: actions/download-artifact@v3
23-
name: Download gitversion tool
24-
with:
25-
name: tool
26-
path: ${{ github.workspace }}/dogfood
2721
-
2822
name: Setup .NET SDK
2923
uses: actions/setup-dotnet@v3

.github/workflows/_prepare.yml

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -21,22 +21,22 @@ jobs:
2121
with:
2222
path: run
2323
key: run-${{ runner.os }}-${{ hashFiles('./build/**') }}
24+
- name: Use cached tools
25+
id: cache-tools
26+
uses: actions/cache@v3
27+
with:
28+
path: tools
29+
key: tools-${{ runner.os }}-${{ hashFiles('./build/**') }}
2430
-
2531
name: Setup .NET SDK
2632
uses: actions/setup-dotnet@v3
2733
with:
2834
global-json-file: global.json
2935
-
30-
name: '[Prepare]'
36+
name: '[Build]'
3137
if: steps.cache-cake.outputs.cache-hit != 'true'
3238
run: dotnet build build/CI.sln --configuration=Release
3339
-
34-
name: '[DogFood]'
40+
name: '[Prepare]'
3541
shell: pwsh
3642
run: dotnet run/build.dll --target=BuildPrepare
37-
-
38-
name: 'Upload gitversion tool'
39-
uses: actions/upload-artifact@v3
40-
with:
41-
name: tool
42-
path: ${{ github.workspace }}/dogfood

.github/workflows/docs.yml

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -80,19 +80,14 @@ jobs:
8080
with:
8181
global-json-file: global.json
8282
-
83-
name: '[Prepare]'
83+
name: '[Build]'
8484
if: steps.cache-cake.outputs.cache-hit != 'true'
8585
run: dotnet build build/CI.sln --configuration=Release
8686
-
87-
name: '[DogFood]'
87+
name: '[Prepare]'
8888
shell: pwsh
8989
run: dotnet run/build.dll --target=BuildPrepare
90-
-
91-
name: 'Upload gitversion tool'
92-
uses: actions/upload-artifact@v3
93-
with:
94-
name: tool
95-
path: ${{ github.workspace }}/dogfood
90+
9691
validate:
9792
name: Validates Html
9893
needs: [prepare]
@@ -145,6 +140,11 @@ jobs:
145140
-
146141
name: Restore State
147142
uses: ./.github/actions/artifacts-restore
143+
-
144+
name: '[Build Schemas]'
145+
shell: pwsh
146+
run: |
147+
dotnet run/docs.dll --target=BuildSchemas
148148
-
149149
name: '[Publish Documentation]'
150150
if: ${{ github.event_name == 'push' }}

build/.run/GenerateSchemas.run.xml

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
<component name="ProjectRunConfigurationManager">
2+
<configuration default="false" name="GenerateSchemas" type="DotNetProject" factoryName=".NET Project" folderName="Docs">
3+
<option name="EXE_PATH" value="$PROJECT_DIR$/../run/docs.exe" />
4+
<option name="PROGRAM_PARAMETERS" value="--target=GenerateSchemas" />
5+
<option name="WORKING_DIRECTORY" value="$PROJECT_DIR$/.." />
6+
<option name="PASS_PARENT_ENVS" value="1" />
7+
<option name="USE_EXTERNAL_CONSOLE" value="0" />
8+
<option name="USE_MONO" value="0" />
9+
<option name="RUNTIME_ARGUMENTS" value="" />
10+
<option name="PROJECT_PATH" value="$PROJECT_DIR$/docs/docs.csproj" />
11+
<option name="PROJECT_EXE_PATH_TRACKING" value="1" />
12+
<option name="PROJECT_ARGUMENTS_TRACKING" value="1" />
13+
<option name="PROJECT_WORKING_DIRECTORY_TRACKING" value="0" />
14+
<option name="PROJECT_KIND" value="DotNetCore" />
15+
<option name="PROJECT_TFM" value="net7.0" />
16+
<method v="2">
17+
<option name="Build" />
18+
</method>
19+
</configuration>
20+
</component>

build/CI.sln

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,32 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "docs", "docs\docs.csproj",
2222
EndProject
2323
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "release", "release\release.csproj", "{8DAB65D8-57E8-4185-96FC-8A7C7373FC23}"
2424
EndProject
25+
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "workflows", "workflows", "{8E5B758F-925A-49E4-9011-20AD2A9E1F43}"
26+
ProjectSection(SolutionItems) = preProject
27+
..\.github\workflows\ci.yml = ..\.github\workflows\ci.yml
28+
..\.github\workflows\codeql-analysis.yml = ..\.github\workflows\codeql-analysis.yml
29+
..\.github\workflows\docs.yml = ..\.github\workflows\docs.yml
30+
..\.github\workflows\format.yml = ..\.github\workflows\format.yml
31+
..\.github\workflows\homebrew.yml = ..\.github\workflows\homebrew.yml
32+
..\.github\workflows\release.yml = ..\.github\workflows\release.yml
33+
..\.github\workflows\_artifacts_linux.yml = ..\.github\workflows\_artifacts_linux.yml
34+
..\.github\workflows\_artifacts_windows.yml = ..\.github\workflows\_artifacts_windows.yml
35+
..\.github\workflows\_build.yml = ..\.github\workflows\_build.yml
36+
..\.github\workflows\_docker.yml = ..\.github\workflows\_docker.yml
37+
..\.github\workflows\_docker_manifests.yml = ..\.github\workflows\_docker_manifests.yml
38+
..\.github\workflows\_prepare.yml = ..\.github\workflows\_prepare.yml
39+
..\.github\workflows\_publish.yml = ..\.github\workflows\_publish.yml
40+
..\.github\workflows\_unit_tests.yml = ..\.github\workflows\_unit_tests.yml
41+
EndProjectSection
42+
EndProject
43+
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "actions", "actions", "{A9B92261-AB9C-47D6-A8A7-616A5A62B063}"
44+
ProjectSection(SolutionItems) = preProject
45+
..\.github\actions\artifacts-restore\action.yml = ..\.github\actions\artifacts-restore\action.yml
46+
..\.github\actions\docker-manifests\action.yml = ..\.github\actions\docker-manifests\action.yml
47+
..\.github\actions\docker-publish\action.yml = ..\.github\actions\docker-publish\action.yml
48+
..\.github\actions\docker-test\action.yml = ..\.github\actions\docker-test\action.yml
49+
EndProjectSection
50+
EndProject
2551
Global
2652
GlobalSection(SolutionConfigurationPlatforms) = preSolution
2753
Debug|Any CPU = Debug|Any CPU

build/build/Tasks/BuildPrepare.cs

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,20 +12,29 @@ public override void Run(BuildContext context)
1212
context.Information("Builds solution...");
1313

1414
const string sln = "./src/GitVersion.sln";
15-
const string project = "./src/GitVersion.App/GitVersion.App.csproj";
1615
context.DotNetRestore(sln,
1716
new()
1817
{
1918
Verbosity = DotNetVerbosity.Minimal,
2019
Sources = new[] { Constants.NugetOrgUrl },
2120
});
2221

23-
context.DotNetBuild(project,
22+
context.DotNetBuild("./src/GitVersion.App/GitVersion.App.csproj",
2423
new()
2524
{
2625
Verbosity = DotNetVerbosity.Minimal,
2726
Configuration = Constants.DefaultConfiguration,
28-
OutputDirectory = Paths.Dogfood,
27+
OutputDirectory = Paths.Tools.Combine("gitversion"),
28+
Framework = Constants.NetVersionLatest,
29+
NoRestore = true,
30+
});
31+
32+
context.DotNetBuild("./src/GitVersion.Schema/GitVersion.Schema.csproj",
33+
new()
34+
{
35+
Verbosity = DotNetVerbosity.Minimal,
36+
Configuration = Constants.DefaultConfiguration,
37+
OutputDirectory = Paths.Tools.Combine("schema"),
2938
Framework = Constants.NetVersionLatest,
3039
NoRestore = true,
3140
});

build/common/Lifetime/BuildLifetimeBase.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ public override void Setup(T context, ISetupContext info)
2929
context.Information("Running BuildPrepare...");
3030
return;
3131
}
32-
var gitversionTool = context.GetDogFoodGitVersionToolLocation();
32+
var gitversionTool = context.GetGitVersionDotnetToolLocation();
3333
var gitVersionSettings = new GitVersionSettings
3434
{
3535
OutputTypes = new HashSet<GitVersionOutput> { GitVersionOutput.Json, GitVersionOutput.BuildServer },

build/common/Utilities/ContextExtensions.cs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -166,6 +166,8 @@ public static string GetBranchName(this ICakeContext context)
166166

167167
public static FilePath? GetGitVersionToolLocation(this ICakeContext context) =>
168168
context.GetFiles($"src/GitVersion.App/bin/{Constants.DefaultConfiguration}/{Constants.NetVersionLatest}/gitversion.dll").SingleOrDefault();
169-
public static FilePath? GetDogFoodGitVersionToolLocation(this ICakeContext context) =>
170-
context.MakeAbsolute(Paths.Dogfood.CombineWithFilePath("gitversion.dll"));
169+
public static FilePath? GetGitVersionDotnetToolLocation(this ICakeContext context) =>
170+
context.MakeAbsolute(Paths.Tools.Combine("gitversion").CombineWithFilePath("gitversion.dll"));
171+
public static FilePath? GetSchemaDotnetToolLocation(this ICakeContext context) =>
172+
context.MakeAbsolute(Paths.Tools.Combine("schema").CombineWithFilePath("schema.dll"));
171173
}

build/common/Utilities/Paths.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ public class Paths
99
public static readonly DirectoryPath Docs = Root.Combine("docs");
1010
public static readonly DirectoryPath Build = Root.Combine("build");
1111
public static readonly DirectoryPath Schemas = Root.Combine("schemas");
12-
public static readonly DirectoryPath Dogfood = Root.Combine("dogfood");
12+
public static readonly DirectoryPath Tools = Root.Combine("tools");
1313
public static readonly DirectoryPath Integration = Root.Combine("tests").Combine("integration");
1414

1515
public static readonly DirectoryPath TestOutput = Artifacts.Combine("test-results");

build/docs/Tasks/GenerateSchemas.cs

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
using Common.Utilities;
2+
3+
namespace Docs.Tasks;
4+
5+
[TaskName(nameof(GenerateSchemas))]
6+
[TaskDescription("Generate schemas")]
7+
public sealed class GenerateSchemas : FrostingTask<BuildContext>
8+
{
9+
public override void Run(BuildContext context)
10+
{
11+
var schemaTool = context.GetSchemaDotnetToolLocation();
12+
var gitVersion = context.Version!.GitVersion;
13+
var version = $"{gitVersion.Major}.{gitVersion.Minor}";
14+
var schemaTargetDir = context.MakeAbsolute(Paths.Root.Combine("schemas"));
15+
context.EnsureDirectoryExists(schemaTargetDir);
16+
context.Information("Schema tool: {0}", schemaTool);
17+
context.Information("Schema target dir: {0}", schemaTargetDir);
18+
context.Information("Schema version: {0}", version);
19+
context.DotNetExecute(schemaTool, $"--Version {version} --OutputDirectory {schemaTargetDir}");
20+
}
21+
}

0 commit comments

Comments
 (0)