Skip to content

Commit fea0168

Browse files
authored
Merge pull request #1048 from manandre/ci-build
Regenerate ci github workflows from Nuke build
2 parents 72323fd + 7023c31 commit fea0168

File tree

6 files changed

+39
-120
lines changed

6 files changed

+39
-120
lines changed

.build/Build.cs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ namespace Build;
1717
[DotNetVerbosityMapping]
1818
[MSBuildVerbosityMapping]
1919
[NuGetVerbosityMapping]
20+
[LocalBuildConventions]
2021
public sealed partial class Solution : NukeBuild,
2122
ICanRestoreWithDotNetCore,
2223
ICanBuildWithDotNetCore,
@@ -28,6 +29,7 @@ public sealed partial class Solution : NukeBuild,
2829
IGenerateCodeCoverageReport,
2930
IGenerateCodeCoverageSummary,
3031
IGenerateCodeCoverageBadges,
32+
IGenerateDocFx,
3133
IHaveConfiguration<Configuration>
3234
{
3335
/// <summary>

.build/Configuration.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,8 @@ namespace Build;
66
[TypeConverter(typeof(TypeConverter<Configuration>))]
77
public class Configuration : Enumeration
88
{
9-
public static Configuration Debug => new() { Value = nameof(Debug) };
10-
public static Configuration Release => new() { Value = nameof(Release) };
9+
public static Configuration Debug = new() { Value = nameof(Debug) };
10+
public static Configuration Release = new() { Value = nameof(Release) };
1111

1212
public static implicit operator string(Configuration configuration) => configuration.Value;
1313
}

.build/Solution.cs

Lines changed: 13 additions & 103 deletions
Original file line numberDiff line numberDiff line change
@@ -70,18 +70,15 @@ internal class LocalConstants
7070
[PrintCIEnvironment]
7171
[UploadLogs]
7272
[TitleEvents]
73+
[ContinuousIntegrationConventions]
7374
public partial class Solution
7475
{
7576
public static RocketSurgeonGitHubActionsConfiguration CiIgnoreMiddleware(
7677
RocketSurgeonGitHubActionsConfiguration configuration
7778
)
7879
{
79-
foreach (var item in configuration.DetailedTriggers.OfType<RocketSurgeonGitHubActionsVcsTrigger>())
80-
{
81-
item.IncludePaths = LocalConstants.PathsIgnore;
82-
}
80+
configuration.IncludeRepositoryConfigurationFiles();
8381

84-
configuration.Jobs.RemoveAt(1);
8582
( (RocketSurgeonsGithubActionsJob)configuration.Jobs[0] ).Steps = new List<GitHubActionsStep>
8683
{
8784
new RunStep("N/A")
@@ -97,104 +94,17 @@ public static RocketSurgeonGitHubActionsConfiguration CiMiddleware(
9794
RocketSurgeonGitHubActionsConfiguration configuration
9895
)
9996
{
100-
foreach (var item in configuration.DetailedTriggers.OfType<RocketSurgeonGitHubActionsVcsTrigger>())
101-
{
102-
item.ExcludePaths = LocalConstants.PathsIgnore;
103-
}
104-
105-
var buildJob = configuration.Jobs.OfType<RocketSurgeonsGithubActionsJob>().First(z => z.Name == "Build");
106-
buildJob.FailFast = false;
107-
var checkoutStep = buildJob.Steps.OfType<CheckoutStep>().Single();
108-
// For fetch all
109-
checkoutStep.FetchDepth = 0;
110-
buildJob.Environment["NUGET_PACKAGES"] = "${{ github.workspace }}/.nuget/packages";
111-
buildJob.Steps.InsertRange(
112-
buildJob.Steps.IndexOf(checkoutStep) + 1,
113-
new BaseGitHubActionsStep[]
114-
{
115-
new RunStep("Fetch all history for all tags and branches")
116-
{
117-
Run = "git fetch --prune"
118-
},
119-
new UsingStep("NuGet Cache")
120-
{
121-
Uses = "actions/cache@v2",
122-
With =
123-
{
124-
["path"] = "${{ github.workspace }}/.nuget/packages",
125-
// keep in mind using central package versioning here
126-
["key"] =
127-
"${{ runner.os }}-nuget-${{ hashFiles('**/Directory.Packages.props') }}-${{ hashFiles('**/Directory.Packages.support.props') }}",
128-
["restore-keys"] = @"|
129-
${{ runner.os }}-nuget-"
130-
}
131-
},
132-
new SetupDotNetStep("Use .NET Core 3.1 SDK")
133-
{
134-
DotNetVersion = "3.1.x"
135-
},
136-
new SetupDotNetStep("Use .NET Core 7.0 SDK")
137-
{
138-
DotNetVersion = "7.0.x"
139-
},
140-
}
141-
);
142-
143-
buildJob.Steps.Add(
144-
new UsingStep("Publish Coverage")
145-
{
146-
Uses = "codecov/codecov-action@v1",
147-
With = new Dictionary<string, string>
148-
{
149-
["name"] = "actions-${{ matrix.os }}",
150-
}
151-
}
152-
);
153-
154-
buildJob.Steps.Add(
155-
new UploadArtifactStep("Publish logs")
156-
{
157-
Name = "logs",
158-
Path = "artifacts/logs/",
159-
If = "always()"
160-
}
161-
);
162-
163-
buildJob.Steps.Add(
164-
new UploadArtifactStep("Publish coverage data")
165-
{
166-
Name = "coverage",
167-
Path = "coverage/",
168-
If = "always()"
169-
}
170-
);
171-
172-
buildJob.Steps.Add(
173-
new UploadArtifactStep("Publish test data")
174-
{
175-
Name = "test data",
176-
Path = "artifacts/test/",
177-
If = "always()"
178-
}
179-
);
180-
181-
buildJob.Steps.Add(
182-
new UploadArtifactStep("Publish NuGet Packages")
183-
{
184-
Name = "nuget",
185-
Path = "artifacts/nuget/",
186-
If = "always()"
187-
}
188-
);
189-
190-
buildJob.Steps.Add(
191-
new UploadArtifactStep("Publish Docs")
192-
{
193-
Name = "docs",
194-
Path = "artifacts/docs/",
195-
If = "always()"
196-
}
197-
);
97+
configuration
98+
.ExcludeRepositoryConfigurationFiles()
99+
.AddNugetPublish()
100+
.Jobs.OfType<RocketSurgeonsGithubActionsJob>()
101+
.First(z => z.Name.Equals("Build", StringComparison.OrdinalIgnoreCase))
102+
.ConfigureStep<CheckoutStep>(step => step.FetchDepth = 0)
103+
.UseDotNetSdks("3.1", "7.0")
104+
.AddNuGetCache()
105+
.PublishLogs<Solution>()
106+
.PublishArtifacts<Solution>()
107+
.FailFast = false;
198108

199109
return configuration;
200110
}

.github/workflows/ci-ignore.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ on:
6969
- '.github/renovate.json'
7070

7171
jobs:
72-
Build:
72+
build:
7373
strategy:
7474
matrix:
7575
os: [windows-latest, ubuntu-latest]

.github/workflows/ci.yml

Lines changed: 15 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -69,23 +69,20 @@ on:
6969
- '.github/renovate.json'
7070

7171
jobs:
72-
Build:
72+
build:
7373
env:
7474
NUGET_PACKAGES: '${{ github.workspace }}/.nuget/packages'
7575
strategy:
7676
fail-fast: false
7777
matrix:
78-
os: [macOS-latest, windows-latest, ubuntu-latest]
78+
os: [macos-latest, windows-latest, ubuntu-latest]
7979
runs-on: ${{ matrix.os }}
8080
steps:
8181
- name: Checkout
8282
uses: actions/[email protected]
8383
with:
8484
clean: 'false'
8585
fetch-depth: '0'
86-
- name: Fetch all history for all tags and branches
87-
run: |
88-
git fetch --prune
8986
- name: NuGet Cache
9087
uses: actions/cache@v3
9188
with:
@@ -105,18 +102,29 @@ jobs:
105102
run: |
106103
dotnet tool restore
107104
- name: 🎁 Restore
105+
id: restore
108106
run: |
109107
dotnet nuke Restore --skip
110108
- name: ⚙ Build
109+
id: build
111110
run: |
112111
dotnet nuke Build --skip
113112
- name: 🚦 Test
113+
id: test
114114
run: |
115115
dotnet nuke Test TriggerCodeCoverageReports GenerateCodeCoverageReportCobertura GenerateCodeCoverageBadges GenerateCodeCoverageSummary GenerateCodeCoverageReport --skip
116116
- name: 📦 Pack
117+
id: pack
117118
run: |
118119
dotnet nuke Pack --skip
120+
- name: 🏺 Publish coverage data
121+
if: always()
122+
uses: actions/upload-artifact@v3
123+
with:
124+
name: 'coverage'
125+
path: 'coverage/'
119126
- name: 🐿 Publish Coverage
127+
if: (github.event_name != 'pull_request' && github.event_name != 'pull_request_target') || ((github.event_name == 'pull_request' || github.event_name == 'pull_request_target') && github.event.pull_request.user.login != 'renovate[bot]' && github.event.pull_request.user.login != 'dependabot[bot]')
120128
uses: codecov/[email protected]
121129
with:
122130
name: 'actions-${{ matrix.os }}'
@@ -126,12 +134,6 @@ jobs:
126134
with:
127135
name: 'logs'
128136
path: 'artifacts/logs/'
129-
- name: 🏺 Publish coverage data
130-
if: always()
131-
uses: actions/upload-artifact@v3
132-
with:
133-
name: 'coverage'
134-
path: 'coverage/'
135137
- name: 🏺 Publish test data
136138
if: always()
137139
uses: actions/upload-artifact@v3
@@ -144,16 +146,15 @@ jobs:
144146
with:
145147
name: 'nuget'
146148
path: 'artifacts/nuget/'
147-
- name: 🏺 Publish Docs
148-
if: always()
149+
- name: 🏺 Publish Documentation
149150
uses: actions/upload-artifact@v3
150151
with:
151152
name: 'docs'
152153
path: 'artifacts/docs/'
153154
Publish:
154155
needs:
155156
- Build
157+
uses: RocketSurgeonsGuild/actions/.github/workflows/[email protected]
156158
secrets:
157159
RSG_NUGET_API_KEY: '${{ secrets.RSG_NUGET_API_KEY }}'
158160
RSG_AZURE_DEVOPS: '${{ secrets.RSG_AZURE_DEVOPS }}'
159-
uses: RocketSurgeonsGuild/actions/.github/workflows/[email protected]

.nuke/build.schema.json

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,10 @@
7474
"type": "string",
7575
"description": "Root directory during build execution"
7676
},
77+
"Serve": {
78+
"type": "boolean",
79+
"description": "serve the docs"
80+
},
7781
"Skip": {
7882
"type": "array",
7983
"description": "List of targets to be skipped. Empty list skips all dependencies",
@@ -84,6 +88,7 @@
8488
"BuildVersion",
8589
"Clean",
8690
"CoreBuild",
91+
"CoreDocs",
8792
"CorePack",
8893
"CoreRestore",
8994
"CoreTest",
@@ -120,6 +125,7 @@
120125
"BuildVersion",
121126
"Clean",
122127
"CoreBuild",
128+
"CoreDocs",
123129
"CorePack",
124130
"CoreRestore",
125131
"CoreTest",

0 commit comments

Comments
 (0)