Skip to content

Commit 774632b

Browse files
upgrade ci
1 parent 615c1ef commit 774632b

File tree

3 files changed

+28
-112
lines changed

3 files changed

+28
-112
lines changed

.github/workflows/build.yml

Lines changed: 6 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -16,29 +16,23 @@ jobs:
1616
build:
1717
runs-on: ubuntu-24.04
1818
steps:
19-
- uses: actions/checkout@v2
20-
with:
21-
fetch-depth: 0
22-
- name: Setup Java
23-
uses: actions/setup-java@v1
24-
with:
25-
java-version: 11.0.x
19+
- uses: actions/checkout@v4
2620
- name: Setup .NET 9.0
27-
uses: actions/setup-dotnet@v1
21+
uses: actions/setup-dotnet@v2
2822
with:
2923
dotnet-version: 9.0.x
3024
- name: Setup .NET 8.0
31-
uses: actions/setup-dotnet@v1
25+
uses: actions/setup-dotnet@v2
3226
with:
3327
dotnet-version: 8.0.x
3428
- name: Setup .NET 2.1
35-
uses: actions/setup-dotnet@v1
29+
uses: actions/setup-dotnet@v2
3630
with:
3731
dotnet-version: 2.1.x
3832
- name: Restore tools
3933
run: dotnet tool restore
4034
- name: Run the build script
41-
uses: cake-build/cake-action@v1
35+
uses: cake-build/cake-action@v2
4236
env:
4337
COVERALLS_TOKEN: ${{ secrets.COVERALLS_TOKEN }}
4438
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
@@ -47,7 +41,7 @@ jobs:
4741
TrueLayer__ClientSecret: ${{ secrets.TRUELAYER__CLIENTSECRET }}
4842
TrueLayer__Payments__SigningKey__KeyId: ${{ secrets.TRUELAYER__PAYMENTS__SIGNINGKEY__KEYID }}
4943
with:
50-
cake-version: 1.3.0
44+
cake-version: 5.0.0
5145
target: CI
5246
verbosity: ${{ github.event.inputs.verbosity }}
5347
- name: Upload pre-release packages

.github/workflows/publish.yml

Lines changed: 6 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -22,29 +22,23 @@ jobs:
2222
publish:
2323
runs-on: ubuntu-24.04
2424
steps:
25-
- uses: actions/checkout@v2
26-
with:
27-
fetch-depth: 0
28-
- name: Setup Java
29-
uses: actions/setup-java@v1
30-
with:
31-
java-version: 11.0.x
25+
- uses: actions/checkout@v4
3226
- name: Setup .NET 9.0
33-
uses: actions/setup-dotnet@v1
27+
uses: actions/setup-dotnet@v2
3428
with:
3529
dotnet-version: 9.0.x
3630
- name: Setup .NET 8.0
37-
uses: actions/setup-dotnet@v1
31+
uses: actions/setup-dotnet@v2
3832
with:
3933
dotnet-version: 8.0.x
4034
- name: Setup .NET 2.1
41-
uses: actions/setup-dotnet@v1
35+
uses: actions/setup-dotnet@v2
4236
with:
4337
dotnet-version: 2.1.x
4438
- name: Restore tools
4539
run: dotnet tool restore
4640
- name: Run the build script
47-
uses: cake-build/cake-action@v1
41+
uses: cake-build/cake-action@v2
4842
env:
4943
COVERALLS_TOKEN: ${{ secrets.COVERALLS_TOKEN }}
5044
NUGET_API_KEY: ${{ secrets.NUGET_API_KEY }}
@@ -58,7 +52,7 @@ jobs:
5852
TrueLayer__ClientSecret: ${{ secrets.TRUELAYER__CLIENTSECRET }}
5953
TrueLayer__Payments__SigningKey__KeyId: ${{ secrets.TRUELAYER__PAYMENTS__SIGNINGKEY__KEYID }}
6054
with:
61-
cake-version: 1.3.0
55+
cake-version: 5.0.0
6256
target: ${{ github.event.inputs.target || 'Publish' }}
6357
verbosity: ${{ github.event.inputs.verbosity || 'Normal' }}
6458
arguments: |

build.cake

Lines changed: 16 additions & 88 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,14 @@
11
// Install .NET Core Global tools.
2-
#tool "dotnet:?package=dotnet-reportgenerator-globaltool&version=5.0.0"
3-
#tool "dotnet:?package=coveralls.net&version=3.0.0"
4-
#tool "dotnet:?package=dotnet-sonarscanner&version=5.4.0"
5-
#tool nuget:?package=docfx.console&version=2.58.9
6-
#tool nuget:?package=KuduSync.NET&version=1.5.3
2+
#tool "dotnet:?package=dotnet-reportgenerator-globaltool&version=5.4.1"
3+
#tool "dotnet:?package=coveralls.net&version=4.0.1"
4+
#tool "dotnet:?package=dotnet-sonarscanner&version=9.0.2"
5+
#tool nuget:?package=KuduSync.NET&version=1.5.4
76

87
// Install addins
9-
#addin nuget:?package=Cake.Coverlet&version=2.5.4
10-
#addin nuget:?package=Cake.Sonar&version=1.1.26
11-
#addin nuget:?package=Cake.DocFx&version=1.0.0
12-
#addin nuget:?package=Cake.Git&version=1.1.0
13-
#addin nuget:?package=Cake.Kudu&version=1.3.0
8+
#addin nuget:?package=Cake.Coverlet&version=4.0.1
9+
#addin nuget:?package=Cake.Sonar&version=1.1.33
10+
#addin nuget:?package=Cake.Git&version=4.0.0
11+
#addin nuget:?package=Cake.Kudu&version=3.0.0
1412

1513
#r "System.Text.Json"
1614
#r "System.IO"
@@ -83,15 +81,15 @@ Task("SonarBegin")
8381
Url = "https://sonarcloud.io",
8482
Exclusions = "test/**,examples/**",
8583
OpenCoverReportsPath = $"{coveragePath}/*.xml",
86-
Login = sonarToken,
84+
Token = sonarToken,
8785
VsTestReportsPath = $"{artifactsPath}/*.TestResults.xml",
8886
});
8987
});
9088

9189
Task("Build")
9290
.Does(() =>
9391
{
94-
DotNetCoreBuild("TrueLayer.sln", new DotNetCoreBuildSettings
92+
DotNetBuild("TrueLayer.sln", new DotNetBuildSettings
9593
{
9694
Configuration = configuration
9795
});
@@ -104,7 +102,7 @@ Task("Test")
104102
{
105103
var projectName = project.GetFilenameWithoutExtension();
106104

107-
var testSettings = new DotNetCoreTestSettings
105+
var testSettings = new DotNetTestSettings
108106
{
109107
NoBuild = true,
110108
Configuration = configuration,
@@ -122,15 +120,15 @@ Task("Test")
122120
//Threshold = coverageThreshold
123121
};
124122

125-
DotNetCoreTest(project.ToString(), testSettings, coverletSettings);
123+
DotNetTest(project.ToString(), testSettings, coverletSettings);
126124
}
127125
});
128126

129127

130128
Task("Pack")
131129
.Does(() =>
132130
{
133-
var settings = new DotNetCorePackSettings
131+
var settings = new DotNetPackSettings
134132
{
135133
Configuration = configuration,
136134
OutputDirectory = artifactsPath,
@@ -139,7 +137,7 @@ Task("Pack")
139137

140138
foreach (var file in GetFiles(packFiles))
141139
{
142-
DotNetCorePack(file.ToString(), settings);
140+
DotNetPack(file.ToString(), settings);
143141
}
144142
});
145143

@@ -202,7 +200,7 @@ Task("PublishPackages")
202200
{
203201
foreach(var package in GetFiles(packages))
204202
{
205-
DotNetCoreNuGetPush(package.ToString(), new DotNetCoreNuGetPushSettings {
203+
DotNetNuGetPush(package.ToString(), new DotNetNuGetPushSettings {
206204
ApiKey = BuildContext.NugetApiKey,
207205
Source = BuildContext.NugetApiUrl,
208206
SkipDuplicate = true
@@ -216,77 +214,10 @@ Task("SonarEnd")
216214
{
217215
SonarEnd(new SonarEndSettings
218216
{
219-
Login = sonarToken
217+
Token = sonarToken
220218
});
221219
});
222220

223-
Task("BuildDocs")
224-
.Does(() =>
225-
{
226-
Information("Extracting API Metadata");
227-
DocFxMetadata(docFxConfig);
228-
229-
Information("Building Docs");
230-
DocFxBuild(docFxConfig);
231-
});
232-
233-
Task("ServeDocs")
234-
.IsDependentOn("BuildDocs")
235-
.Does(() =>
236-
{
237-
using (var process = DocFxServeStart(sitePath))
238-
{
239-
// Launch browser or other action based on the site
240-
process.WaitForExit();
241-
}
242-
});
243-
244-
Task("PublishDocs")
245-
.IsDependentOn("BuildDocs")
246-
.WithCriteria(!string.IsNullOrEmpty(gitHubPagesToken))// && currentBranch.FriendlyName == "main")
247-
.Does(() =>
248-
{
249-
// Get the current commit
250-
var sourceCommit = currentBranch.Tip;
251-
var publishFolder = $"./artifacts/docs-publish-{DateTime.Now.ToString("yyyyMMdd_HHmmss")}";
252-
Information("Publishing Folder: {0}", publishFolder);
253-
Information("Getting publish branch...");
254-
GitClone("https://github.com/TrueLayer/truelayer-dotnet.git",
255-
publishFolder,
256-
gitHubUser,
257-
gitHubPagesToken,
258-
new GitCloneSettings { BranchName = "gh-pages" }
259-
);
260-
261-
Information("Sync output files...");
262-
263-
Kudu.Sync(sitePath, publishFolder, new KuduSyncSettings {
264-
ArgumentCustomization = args => args.Append("--ignore").AppendQuoted(".git;CNAME")
265-
});
266-
267-
if (GitHasUncommitedChanges(publishFolder))
268-
{
269-
GitAddAll(publishFolder);
270-
Information("Stage all changes...");
271-
272-
// Only considers modified files - https://github.com/cake-contrib/Cake_Git/issues/77
273-
if (BuildContext.ForcePushDocs || GitHasStagedChanges(publishFolder))
274-
{
275-
Information("Commit all changes...");
276-
GitCommit(
277-
publishFolder,
278-
sourceCommit.Committer.Name,
279-
sourceCommit.Committer.Email,
280-
string.Format("Continuous Integration Publish: {0}\r\n{1}", sourceCommit.Sha, sourceCommit.Message)
281-
);
282-
283-
Information("Pushing all changes...");
284-
285-
GitPush(publishFolder, gitHubUser, gitHubPagesToken, "gh-pages");
286-
}
287-
}
288-
});
289-
290221
Task("Dump").Does(() => BuildContext.PrintParameters(Context));
291222

292223
Task("Default")
@@ -295,7 +226,6 @@ Task("Default")
295226
.IsDependentOn("Test")
296227
.IsDependentOn("Pack")
297228
.IsDependentOn("GenerateReports")
298-
.IsDependentOn("BuildDocs");
299229

300230
Task("CI")
301231
//.IsDependentOn("SonarBegin")
@@ -306,11 +236,9 @@ Task("CI")
306236
Task("Publish")
307237
.IsDependentOn("CI")
308238
.IsDependentOn("PublishPackages");
309-
//.IsDependentOn("PublishDocs");
310239

311240
RunTarget(target);
312241

313-
314242
public static class BuildContext
315243
{
316244
public static bool IsTag { get; private set; }

0 commit comments

Comments
 (0)