Skip to content

Commit 5de0fe2

Browse files
committed
Regenerate ci github workflows from Nuke build
1 parent 345d012 commit 5de0fe2

File tree

4 files changed

+29
-118
lines changed

4 files changed

+29
-118
lines changed

.build/Build.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ public sealed partial class Solution : NukeBuild,
2828
IGenerateCodeCoverageReport,
2929
IGenerateCodeCoverageSummary,
3030
IGenerateCodeCoverageBadges,
31+
IGenerateDocFx,
3132
IHaveConfiguration<Configuration>
3233
{
3334
/// <summary>

.build/Solution.cs

Lines changed: 12 additions & 103 deletions
Original file line numberDiff line numberDiff line change
@@ -76,12 +76,8 @@ public static RocketSurgeonGitHubActionsConfiguration CiIgnoreMiddleware(
7676
RocketSurgeonGitHubActionsConfiguration configuration
7777
)
7878
{
79-
foreach (var item in configuration.DetailedTriggers.OfType<RocketSurgeonGitHubActionsVcsTrigger>())
80-
{
81-
item.IncludePaths = LocalConstants.PathsIgnore;
82-
}
79+
configuration.IncludeRepositoryConfigurationFiles();
8380

84-
configuration.Jobs.RemoveAt(1);
8581
( (RocketSurgeonsGithubActionsJob)configuration.Jobs[0] ).Steps = new List<GitHubActionsStep>
8682
{
8783
new RunStep("N/A")
@@ -97,104 +93,17 @@ public static RocketSurgeonGitHubActionsConfiguration CiMiddleware(
9793
RocketSurgeonGitHubActionsConfiguration configuration
9894
)
9995
{
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-
);
96+
configuration
97+
.ExcludeRepositoryConfigurationFiles()
98+
.AddNugetPublish()
99+
.Jobs.OfType<RocketSurgeonsGithubActionsJob>()
100+
.First(z => z.Name.Equals("Build", StringComparison.OrdinalIgnoreCase))
101+
.ConfigureStep<CheckoutStep>(step => step.FetchDepth = 0)
102+
.UseDotNetSdks("3.1", "7.0")
103+
.AddNuGetCache()
104+
.PublishLogs<Solution>()
105+
.PublishArtifacts<Solution>()
106+
.FailFast = false;
198107

199108
return configuration;
200109
}

.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]

0 commit comments

Comments
 (0)