@@ -37,10 +37,17 @@ let toolsDir = __SOURCE_DIRECTORY__ @@ "tools"
37
37
let output = __ SOURCE_ DIRECTORY__ @@ " bin"
38
38
let outputTests = __ SOURCE_ DIRECTORY__ @@ " TestResults"
39
39
let outputPerfTests = __ SOURCE_ DIRECTORY__ @@ " PerfResults"
40
+ let dockerScriptDir = __ SOURCE_ DIRECTORY__ @@ " src" @@ " Lighthouse"
40
41
let outputNuGet = output @@ " nuget"
41
42
42
43
exception ConnectionFailure of string
43
44
45
+ let composedGetDirName ( p : string ) =
46
+ System.IO.Path.GetDirectoryName p
47
+
48
+ let composedGetFileNameWithoutExtension ( p : string ) =
49
+ System.IO.Path.GetFileNameWithoutExtension p
50
+
44
51
Target " Clean" ( fun _ ->
45
52
ActivateFinalTarget " KillCreatedProcesses"
46
53
@@ -131,24 +138,24 @@ Target "NBench" <| fun _ ->
131
138
132
139
projects |> Seq.iter runSingleProject
133
140
141
+ let dockerFilesWithTags =
142
+ match ( isWindows) with
143
+ | true -> [( " src/Lighthouse/Dockerfile-windows" , [ " windows-latest" ])]
144
+ | _ -> [( " src/Lighthouse/Dockerfile-linux" , [ " latest" ; " linux-latest" ]); ( " src/Lighthouse/Dockerfile-arm64" , [ " arm64-latest" ])]
145
+
134
146
Target " RunTestsOnRuntimes" ( fun _ ->
135
147
136
148
let LighthouseConnectTimeout = 20.0 // in seconds
137
-
138
- let dockerFileForTest =
139
- match ( isWindows) with
140
- | true -> " src/Lighthouse/Dockerfile-windows"
141
- | _ -> " src/Lighthouse/Dockerfile-linux"
142
149
143
150
let installPbm () =
144
151
// Install pbm client to test connections
145
152
ExecProcess( fun info ->
146
153
info.FileName <- " dotnet"
147
154
info.Arguments <- " tool install --global pbm" ) ( TimeSpan.FromMinutes 5.0 ) |> ignore // this is fine if tool is already installed
148
155
149
- let startLighthouseDocker dockerFile =
150
- printfn " Starting Lighthouse... "
151
- let runArgs = " run -d --name lighthouse --hostname lighthouse1 -p 4053:4053 -p 9110:9110 --env CLUSTER_IP=127.0.0.1 --env CLUSTER_SEEDS=akka.tcp://some@lighthouse1 :4053 --env CLUSTER_PORT=4053 lighthouse:latest "
156
+ let startLighthouseDocker dockerFile tag =
157
+ printfn " Starting Lighthouse w/ Dockerfile %s " dockerFile
158
+ let runArgs = sprintf " run -d --name lighthouse --hostname lighthouse1 -p 4053:4053 -p 9110:9110 --env ACTORSYSTEM=some --env CLUSTER_IP=127.0.0.1 --env CLUSTER_SEEDS=akka.tcp://some@127.0.0.1 :4053 --env CLUSTER_PORT=4053 lighthouse:%s " tag
152
159
let runResult = ExecProcess( fun info ->
153
160
info.FileName <- " docker"
154
161
info.WorkingDirectory <- ( Directory.GetParent dockerFile) .FullName
@@ -162,7 +169,7 @@ Target "RunTestsOnRuntimes" (fun _ ->
162
169
info.WorkingDirectory <- ( Directory.GetParent dockerFile) .FullName
163
170
info.Arguments <- " rm -f lighthouse" ) ( System.TimeSpan.FromMinutes 5.0 ) |> ignore // cleanup failure should not fail the test
164
171
165
- let startLighhouseLocally exePath =
172
+ let startLighthouseLocally exePath =
166
173
printfn " Starting Lighthouse locally..."
167
174
try
168
175
let runResult = ExecProcess( fun info ->
@@ -184,21 +191,15 @@ Target "RunTestsOnRuntimes" (fun _ ->
184
191
| _ -> printfn " Lighthouse was connected successfully"
185
192
186
193
installPbm()
187
- startLighthouseDocker dockerFileForTest
188
- try
189
- connectLighthouse()
190
- finally
191
- stopLighthouseDocker dockerFileForTest
192
-
193
- // Test Full .NET Framework version under windows only
194
- // TODO: To make this work, need to start lighthouse and pbm as two parallel processes
195
- (*
196
- match (isWindows) with
197
- | true ->
198
- startLighhouseLocally "src/Lighthouse/bin/Release/net461/Lighthouse.exe"
199
- connectLighthouse()
200
- | _ -> ()
201
- *)
194
+
195
+ let runSpec ( dockerFile , tags ) =
196
+ startLighthouseDocker dockerFile ( tags |> List.head)
197
+ try
198
+ connectLighthouse()
199
+ finally
200
+ stopLighthouseDocker dockerFile
201
+
202
+ dockerFilesWithTags |> Seq.iter runSpec
202
203
)
203
204
204
205
@@ -243,7 +244,7 @@ Target "SignPackages" (fun _ ->
243
244
info.FileName <- signPath
244
245
info.WorkingDirectory <- __ SOURCE_ DIRECTORY__
245
246
info.Arguments <- args) ( System.TimeSpan.FromMinutes 5.0 ) (* Reasonably long-running task. *)
246
- if result <> 0 then failwithf " SignClient failed.%s " args
247
+ if result <> 0 then failwithf " SignClient failed. %s " args
247
248
248
249
assemblies |> Seq.iter ( signAssembly)
249
250
else
@@ -315,7 +316,7 @@ Target "PublishCode" (fun _ ->
315
316
Project = project
316
317
Configuration = configuration
317
318
VersionSuffix = overrideVersionSuffix project
318
- Framework = " netcoreapp3.1 "
319
+ Framework = " net6.0 "
319
320
})
320
321
321
322
projects |> Seq.iter ( runSingleProject)
@@ -326,74 +327,19 @@ let mapDockerImageName (projectName:string) =
326
327
| " Lighthouse" -> Some( " lighthouse" )
327
328
| _ -> None
328
329
329
- let composedGetDirName ( p : string ) =
330
- System.IO.Path.GetDirectoryName p
331
-
332
- let composedGetFileNameWithoutExtension ( p : string ) =
333
- System.IO.Path.GetFileNameWithoutExtension p
334
-
335
330
Target " BuildDockerImages" ( fun _ ->
336
- let projects = !! " src/**/*.csproj"
337
- -- " src/**/*Tests.csproj" // Don't publish unit tests
338
- -- " src/**/*Tests*.csproj"
339
-
340
- let dockerFile =
341
- match ( isWindows) with
342
- | true -> " Dockerfile-windows"
343
- | _ -> " Dockerfile-linux"
344
-
345
- let dockerTags ( imageName : string , assemblyVersion : string ) =
346
- match ( isWindows) with
347
- | true -> [| imageName + " :" + releaseNotes.AssemblyVersion; imageName + " :" + releaseNotes.AssemblyVersion + " -nanoserver1803" ; imageName + " :latest" |]
348
- | _ -> [| imageName + " :" + releaseNotes.AssemblyVersion; imageName + " :" + releaseNotes.AssemblyVersion + " -linux" ; imageName + " :latest" |]
349
-
350
-
351
- let remoteRegistryUrl = getBuildParamOrDefault " remoteRegistry" " "
352
-
353
- let buildDockerImage imageName projectPath =
354
-
355
- let args =
356
- if ( hasBuildParam " remoteRegistry" ) then
357
- StringBuilder()
358
- |> append " build"
359
- |> append " -f"
360
- |> append dockerFile
361
- |> append " -t"
362
- |> append ( imageName + " :" + releaseNotes.AssemblyVersion)
363
- |> append " -t"
364
- |> append ( imageName + " :latest" )
365
- |> append " -t"
366
- |> append ( remoteRegistryUrl + " /" + imageName + " :" + releaseNotes.AssemblyVersion)
367
- |> append " -t"
368
- |> append ( remoteRegistryUrl + " /" + imageName + " :latest" )
369
- |> append " ."
370
- |> toText
371
- else
372
- StringBuilder()
373
- |> append " build"
374
- |> append " -f"
375
- |> append dockerFile
376
- |> append " -t"
377
- |> append ( imageName + " :" + releaseNotes.AssemblyVersion)
378
- |> append " -t"
379
- |> append ( imageName + " :latest" )
380
- |> append " ."
381
- |> toText
382
-
383
- ExecProcess( fun info ->
384
- info.FileName <- " docker"
385
- info.WorkingDirectory <- composedGetDirName projectPath
386
- info.Arguments <- args) ( System.TimeSpan.FromMinutes 5.0 ) (* Reasonably long-running task. *)
387
-
388
- let runSingleProject project =
389
- let projectName = composedGetFileNameWithoutExtension project
390
- let imageName = mapDockerImageName projectName
391
- let result = match imageName with
392
- | None -> 0
393
- | Some( name) -> buildDockerImage name project
394
- if result <> 0 then failwithf " docker build failed. %s " project
395
-
396
- projects |> Seq.iter ( runSingleProject)
331
+ if ( isWindows) then
332
+ let result = ExecProcess( fun info ->
333
+ info.FileName <- " powershell"
334
+ info.WorkingDirectory <- dockerScriptDir
335
+ info.Arguments <- sprintf " ./buildWindowsDockerImages.ps1 -tagVersion %s " releaseNotes.AssemblyVersion) ( System.TimeSpan.FromMinutes 5.0 ) (* Reasonably long-running task. *)
336
+ if result <> 0 then failwithf " Unable to build Lighthouse Dockerfiles"
337
+ else
338
+ let result = ExecProcess( fun info ->
339
+ info.FileName <- " sh"
340
+ info.WorkingDirectory <- dockerScriptDir
341
+ info.Arguments <- sprintf " ./buildLinuxDockerImages.sh %s " releaseNotes.AssemblyVersion) ( System.TimeSpan.FromMinutes 5.0 ) (* Reasonably long-running task. *)
342
+ if result <> 0 then failwithf " Unable to build Lighthouse Dockerfiles"
397
343
)
398
344
399
345
//--------------------------------------------------------------------------------
@@ -460,7 +406,7 @@ Target "Nuget" DoNothing
460
406
461
407
// tests dependencies
462
408
" Build" ==> " RunTests"
463
- " PublishCode " ==> " BuildDockerImages" ==> " RunTestsOnRuntimes"
409
+ " BuildDockerImages" ==> " RunTestsOnRuntimes"
464
410
465
411
// nuget dependencies
466
412
" Clean" ==> " Build" ==> " CreateNuget"
@@ -470,7 +416,7 @@ Target "Nuget" DoNothing
470
416
" Clean" ==> " BuildRelease" ==> " Docfx"
471
417
472
418
// Docker
473
- " BuildRelease " ==> " PublishCode " ==> " BuildDockerImages" ==> " Docker"
419
+ " BuildDockerImages" ==> " Docker"
474
420
475
421
// all
476
422
" BuildRelease" ==> " All"
0 commit comments