1
1
// 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
7
6
8
7
// 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
14
12
15
13
#r "System.Text.Json"
16
14
#r "System . IO "
@@ -83,15 +81,15 @@ Task("SonarBegin")
83
81
Url = "https://sonarcloud.io" ,
84
82
Exclusions = "test/**,examples/**" ,
85
83
OpenCoverReportsPath = $ "{ coveragePath } /*.xml",
86
- Login = sonarToken ,
84
+ Token = sonarToken ,
87
85
VsTestReportsPath = $ "{ artifactsPath } /*.TestResults.xml",
88
86
} ) ;
89
87
} ) ;
90
88
91
89
Task( "Build" )
92
90
. Does ( ( ) =>
93
91
{
94
- DotNetCoreBuild ( "TrueLayer.sln" , new DotNetCoreBuildSettings
92
+ DotNetBuild ( "TrueLayer.sln" , new DotNetBuildSettings
95
93
{
96
94
Configuration = configuration
97
95
} ) ;
@@ -104,7 +102,7 @@ Task("Test")
104
102
{
105
103
var projectName = project . GetFilenameWithoutExtension ( ) ;
106
104
107
- var testSettings = new DotNetCoreTestSettings
105
+ var testSettings = new DotNetTestSettings
108
106
{
109
107
NoBuild = true ,
110
108
Configuration = configuration ,
@@ -122,15 +120,15 @@ Task("Test")
122
120
//Threshold = coverageThreshold
123
121
} ;
124
122
125
- DotNetCoreTest ( project . ToString ( ) , testSettings , coverletSettings ) ;
123
+ DotNetTest ( project . ToString ( ) , testSettings , coverletSettings ) ;
126
124
}
127
125
} ) ;
128
126
129
127
130
128
Task( "Pack" )
131
129
. Does ( ( ) =>
132
130
{
133
- var settings = new DotNetCorePackSettings
131
+ var settings = new DotNetPackSettings
134
132
{
135
133
Configuration = configuration ,
136
134
OutputDirectory = artifactsPath ,
@@ -139,7 +137,7 @@ Task("Pack")
139
137
140
138
foreach ( var file in GetFiles ( packFiles ) )
141
139
{
142
- DotNetCorePack ( file . ToString ( ) , settings ) ;
140
+ DotNetPack ( file . ToString ( ) , settings ) ;
143
141
}
144
142
} ) ;
145
143
@@ -202,7 +200,7 @@ Task("PublishPackages")
202
200
{
203
201
foreach ( var package in GetFiles ( packages ) )
204
202
{
205
- DotNetCoreNuGetPush ( package . ToString ( ) , new DotNetCoreNuGetPushSettings {
203
+ DotNetNuGetPush ( package . ToString ( ) , new DotNetNuGetPushSettings {
206
204
ApiKey = BuildContext . NugetApiKey ,
207
205
Source = BuildContext . NugetApiUrl ,
208
206
SkipDuplicate = true
@@ -216,77 +214,10 @@ Task("SonarEnd")
216
214
{
217
215
SonarEnd ( new SonarEndSettings
218
216
{
219
- Login = sonarToken
217
+ Token = sonarToken
220
218
} ) ;
221
219
} ) ;
222
220
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
-
290
221
Task( "Dump" ) . Does ( ( ) => BuildContext . PrintParameters ( Context ) ) ;
291
222
292
223
Task( "Default" )
@@ -295,7 +226,6 @@ Task("Default")
295
226
. IsDependentOn ( "Test" )
296
227
. IsDependentOn ( "Pack" )
297
228
. IsDependentOn ( "GenerateReports" )
298
- . IsDependentOn ( "BuildDocs" ) ;
299
229
300
230
Task( "CI" )
301
231
//.IsDependentOn("SonarBegin")
@@ -306,11 +236,9 @@ Task("CI")
306
236
Task( "Publish" )
307
237
. IsDependentOn ( "CI" )
308
238
. IsDependentOn ( "PublishPackages" ) ;
309
- //.IsDependentOn("PublishDocs");
310
239
311
240
RunTarget( target ) ;
312
241
313
-
314
242
public static class BuildContext
315
243
{
316
244
public static bool IsTag { get ; private set ; }
0 commit comments