зеркало из https://github.com/akkadotnet/akka.net.git
added Azure Pipelines build system (#3794)
This commit is contained in:
Родитель
0fe3ea918e
Коммит
b48b1c62f5
|
@ -0,0 +1,3 @@
|
|||
**/*
|
||||
!TestResults/*
|
||||
!bin/incrementalist.txt
|
|
@ -0,0 +1,8 @@
|
|||
# Azure Pipelines Build Files
|
||||
These `.yaml` files are used by Windows Azure DevOps Pipelines to help execute the following types of builds:
|
||||
|
||||
- Pull request validation on Linux (Mono / .NET Core)
|
||||
- Pull request validation on Windows (.NET Framework / .NET Core)
|
||||
- NuGet releases with automatic release notes posted to a Github Release repository.
|
||||
|
||||
**NOTE**: you will need to change some of the pipeline variables inside the `windows-release.yaml` for your specific project and you will also want to create variable groups with your signing and NuGet push information.
|
|
@ -0,0 +1,54 @@
|
|||
parameters:
|
||||
name: ''
|
||||
displayName: ''
|
||||
vmImage: ''
|
||||
dependsOn: 'WindowsBuild'
|
||||
artifactName: 'akkaBuild'
|
||||
scriptFileName: ''
|
||||
scriptArgs: 'all'
|
||||
outputDirectory: ''
|
||||
timeoutInMinutes: 120
|
||||
|
||||
jobs:
|
||||
- job: ${{ parameters.name }}
|
||||
displayName: ${{ parameters.displayName }}
|
||||
timeoutInMinutes: ${{ parameters.timeoutInMinutes }}
|
||||
pool:
|
||||
vmImage: ${{ parameters.vmImage }}
|
||||
steps:
|
||||
- task: Bash@3
|
||||
displayName: Linux / OSX Build
|
||||
inputs:
|
||||
filePath: ${{ parameters.scriptFileName }}
|
||||
arguments: ${{ parameters.scriptArgs }}
|
||||
continueOnError: true
|
||||
condition: in( variables['Agent.OS'], 'Linux', 'Darwin' )
|
||||
# Windows
|
||||
- task: BatchScript@1
|
||||
displayName: Windows Build
|
||||
inputs:
|
||||
filename: ${{ parameters.scriptFileName }}
|
||||
arguments: ${{ parameters.scriptArgs }}
|
||||
continueOnError: true
|
||||
condition: eq( variables['Agent.OS'], 'Windows_NT' )
|
||||
- task: PublishTestResults@2
|
||||
inputs:
|
||||
testRunner: VSTest
|
||||
testResultsFiles: '**/*.trx' #TestResults folder usually
|
||||
testRunTitle: ${{ parameters.name }}
|
||||
mergeTestResults: true
|
||||
- script: 'echo 1>&2'
|
||||
failOnStderr: true
|
||||
displayName: 'If above is partially succeeded, then fail'
|
||||
condition: eq(variables['Agent.JobStatus'], 'SucceededWithIssues')
|
||||
- task: CopyFiles@2
|
||||
displayName: 'Copy Build Output'
|
||||
inputs:
|
||||
sourceFolder: ${{ parameters.outputDirectory }}
|
||||
contents: '*'
|
||||
targetFolder: $(Build.ArtifactStagingDirectory)
|
||||
continueOnError: boolean # 'true' if future steps should run even if this step fails; defaults to 'false'
|
||||
- task: PublishBuildArtifacts@1
|
||||
inputs:
|
||||
pathtoPublish: '$(Build.ArtifactStagingDirectory)'
|
||||
artifactName: ${{ parameters.name }}
|
|
@ -0,0 +1,22 @@
|
|||
# Pull request validation for Linux against the `dev` and `master` branches
|
||||
# See https://docs.microsoft.com/en-us/azure/devops/pipelines/yaml-schema for reference
|
||||
trigger:
|
||||
branches:
|
||||
include:
|
||||
- dev
|
||||
- master
|
||||
|
||||
name: $(Year:yyyy).$(Month).$(DayOfMonth)$(Rev:.r)
|
||||
|
||||
pr:
|
||||
autoCancel: true # indicates whether additional pushes to a PR should cancel in-progress runs for the same PR. Defaults to true
|
||||
branches:
|
||||
include: [ dev, master ] # branch names which will trigger a build
|
||||
|
||||
jobs:
|
||||
- template: azure-pipeline.template.yaml
|
||||
parameters:
|
||||
name: Ubuntu
|
||||
vmImage: 'ubuntu-16.04'
|
||||
scriptFileName: ./build.sh
|
||||
scriptArgs: all
|
|
@ -0,0 +1,103 @@
|
|||
# Pull request validation for Windows against the `dev` and `master` branches
|
||||
# See https://docs.microsoft.com/en-us/azure/devops/pipelines/yaml-schema for reference
|
||||
trigger:
|
||||
branches:
|
||||
include:
|
||||
- dev
|
||||
- test-dev
|
||||
- master
|
||||
|
||||
pr:
|
||||
autoCancel: true # indicates whether additional pushes to a PR should cancel in-progress runs for the same PR. Defaults to true
|
||||
branches:
|
||||
include: [ dev, test-dev, master ] # branch names which will trigger a build
|
||||
|
||||
name: $(Year:yyyy).$(Month).$(DayOfMonth)$(Rev:.r)
|
||||
|
||||
jobs:
|
||||
- job: WindowsBuild
|
||||
displayName: Windows Build
|
||||
pool:
|
||||
vmImage: vs2017-win2016
|
||||
demands: Cmd
|
||||
steps:
|
||||
- checkout: self # self represents the repo where the initial Pipelines YAML file was found
|
||||
clean: false # whether to fetch clean each time
|
||||
submodules: recursive # set to 'true' for a single level of submodules or 'recursive' to get submodules of submodules
|
||||
persistCredentials: true
|
||||
- task: BatchScript@1
|
||||
displayName: Windows Build
|
||||
inputs:
|
||||
filename: build.cmd
|
||||
arguments: 'buildRelease incremental' # Run an incremental build
|
||||
continueOnError: true
|
||||
condition: eq( variables['Agent.OS'], 'Windows_NT' )
|
||||
- task: CopyFiles@2
|
||||
displayName: 'Copy Build Output'
|
||||
inputs:
|
||||
sourceFolder: bin
|
||||
contents: '*'
|
||||
targetFolder: $(Build.ArtifactStagingDirectory)
|
||||
continueOnError: boolean # 'true' if future steps should run even if this step fails; defaults to 'false'
|
||||
- task: PublishBuildArtifacts@1
|
||||
inputs:
|
||||
pathtoPublish: $(Build.ArtifactStagingDirectory)
|
||||
artifactName: incrementalistOutput
|
||||
- script: 'echo 1>&2'
|
||||
failOnStderr: true
|
||||
displayName: 'If above is partially succeeded, then fail'
|
||||
condition: eq(variables['Agent.JobStatus'], 'SucceededWithIssues')
|
||||
|
||||
- template: azure-pipeline.template.yaml
|
||||
parameters:
|
||||
name: 'netfx_tests_windows'
|
||||
displayName: '.NET Framework Unit Tests (Windows)'
|
||||
vmImage: 'vs2017-win2016'
|
||||
scriptFileName: build.cmd
|
||||
scriptArgs: runTests incremental
|
||||
outputDirectory: 'TestResults'
|
||||
|
||||
- template: azure-pipeline.template.yaml
|
||||
parameters:
|
||||
name: 'net_core_tests_windows'
|
||||
displayName: '.NET Core Unit Tests (Windows)'
|
||||
vmImage: 'vs2017-win2016'
|
||||
scriptFileName: build.cmd
|
||||
scriptArgs: runTestsNetCore incremental
|
||||
outputDirectory: 'TestResults'
|
||||
|
||||
- template: azure-pipeline.template.yaml
|
||||
parameters:
|
||||
name: 'net_core_tests_linux'
|
||||
displayName: '.NET Core Unit Tests (Linux)'
|
||||
vmImage: 'ubuntu-16.04'
|
||||
scriptFileName: './build.sh'
|
||||
scriptArgs: runTestsNetCore incremental
|
||||
outputDirectory: 'TestResults'
|
||||
|
||||
- template: azure-pipeline.template.yaml
|
||||
parameters:
|
||||
name: 'net_core_mntr_windows'
|
||||
displayName: '.NET Core Multi-Node Tests (Windows)'
|
||||
vmImage: 'vs2017-win2016'
|
||||
scriptFileName: 'build.cmd'
|
||||
scriptArgs: MultiNodeTestsNetCore incremental
|
||||
outputDirectory: 'TestResults'
|
||||
|
||||
- template: azure-pipeline.template.yaml
|
||||
parameters:
|
||||
name: 'net_fx_mntr_windows'
|
||||
displayName: '.NET Framework Multi-Node Tests (Windows)'
|
||||
vmImage: 'vs2017-win2016'
|
||||
scriptFileName: 'build.cmd'
|
||||
scriptArgs: MultiNodeTests incremental
|
||||
outputDirectory: 'TestResults'
|
||||
|
||||
- template: azure-pipeline.template.yaml
|
||||
parameters:
|
||||
name: 'nuget_pack'
|
||||
displayName: 'NuGet Pack'
|
||||
vmImage: 'vs2017-win2016'
|
||||
scriptFileName: build.cmd
|
||||
scriptArgs: CreateNuget nugetprerelease=dev incremental
|
||||
outputDirectory: 'bin/nuget'
|
|
@ -0,0 +1,118 @@
|
|||
# Release task for PbLib projects
|
||||
# See https://docs.microsoft.com/en-us/azure/devops/pipelines/yaml-schema for reference
|
||||
trigger:
|
||||
branches:
|
||||
include:
|
||||
- refs/tags/*
|
||||
|
||||
variables:
|
||||
- name: githubConnectionName
|
||||
value: releases
|
||||
- name: projectName
|
||||
value: lighthouse
|
||||
- name: githubRepositoryName
|
||||
value: petabridge/lighthouse
|
||||
- name: dockerConnectionName
|
||||
value: PetabridgeDocker
|
||||
|
||||
jobs:
|
||||
- job: publishNetCore
|
||||
pool:
|
||||
vmImage: windows-2019
|
||||
demands: Cmd
|
||||
steps:
|
||||
- task: BatchScript@1
|
||||
displayName: 'dotnet publish'
|
||||
inputs:
|
||||
filename: build.cmd
|
||||
arguments: 'PublishCode'
|
||||
- task: CopyFiles@2
|
||||
displayName: 'Copy dotnet publish Output'
|
||||
inputs:
|
||||
sourceFolder: src/Lighthouse/bin/Release/netcoreapp2.1/publish/
|
||||
targetFolder: $(Build.ArtifactStagingDirectory)/bin/Release/netcoreapp2.1/publish/
|
||||
- task: CopyFiles@2
|
||||
displayName: 'Copy Dockerfiles'
|
||||
inputs:
|
||||
sourceFolder: src/Lighthouse
|
||||
contents: Dockerfile-*
|
||||
targetFolder: $(Build.ArtifactStagingDirectory)
|
||||
- task: PublishBuildArtifacts@1
|
||||
inputs:
|
||||
pathtoPublish: '$(Build.ArtifactStagingDirectory)'
|
||||
artifactName: drop
|
||||
- task: GitHubRelease@0
|
||||
displayName: 'GitHub release (create)'
|
||||
inputs:
|
||||
gitHubConnection: $(githubConnectionName)
|
||||
repositoryName: $(githubRepositoryName)
|
||||
title: '$(projectName) v$(Build.SourceBranchName)'
|
||||
releaseNotesFile: 'RELEASE_NOTES.md'
|
||||
assets: |
|
||||
bin\nuget\*.nupkg
|
||||
|
||||
- job: linuxImageDeploy
|
||||
pool:
|
||||
vmImage: ubuntu-16.04
|
||||
dependsOn: publishNetCore
|
||||
steps:
|
||||
- task: DownloadBuildArtifacts@0
|
||||
inputs:
|
||||
buildType: 'current'
|
||||
downloadType: 'single'
|
||||
artifactName: 'drop'
|
||||
itemPattern: drop/**
|
||||
downloadPath: '$(Agent.BuildDirectory)'
|
||||
- task: Docker@2
|
||||
displayName: "Login to Docker Hub"
|
||||
inputs:
|
||||
command: login
|
||||
containerRegistry: $(dockerConnectionName)
|
||||
- task: Docker@2
|
||||
displayName: Docker Build (Linux)
|
||||
inputs:
|
||||
command: buildAndPush
|
||||
Dockerfile: $(Agent.BuildDirectory)/drop/Dockerfile-linux
|
||||
repository: petabridge/lighthouse
|
||||
tags: |
|
||||
latest
|
||||
linux-latest
|
||||
$(Build.SourceBranchName)
|
||||
$(Build.SourceBranchName)-linux
|
||||
- task: Docker@2
|
||||
displayName: Logout of Docker Hub
|
||||
inputs:
|
||||
command: logout
|
||||
containerRegistry: $(dockerConnectionName)
|
||||
|
||||
- job: windowsImageDeploy
|
||||
pool:
|
||||
vmImage: windows-2019
|
||||
dependsOn: publishNetCore
|
||||
steps:
|
||||
- task: DownloadBuildArtifacts@0
|
||||
inputs:
|
||||
buildType: 'current'
|
||||
downloadType: 'single'
|
||||
artifactName: 'drop'
|
||||
itemPattern: drop/**
|
||||
downloadPath: '$(Agent.BuildDirectory)'
|
||||
- task: Docker@2
|
||||
displayName: "Login to Docker Hub"
|
||||
inputs:
|
||||
command: login
|
||||
containerRegistry: $(dockerConnectionName)
|
||||
- task: Docker@2
|
||||
displayName: Docker Build (Windows)
|
||||
inputs:
|
||||
command: buildAndPush
|
||||
Dockerfile: $(Agent.BuildDirectory)/drop/Dockerfile-windows
|
||||
repository: petabridge/lighthouse
|
||||
tags: |
|
||||
windows-latest
|
||||
$(Build.SourceBranchName)-nanoserver
|
||||
- task: Docker@2
|
||||
displayName: Logout of Docker Hub
|
||||
inputs:
|
||||
command: logout
|
||||
containerRegistry: $(dockerConnectionName)
|
551
build.fsx
551
build.fsx
|
@ -1,21 +1,19 @@
|
|||
#I @"tools/FAKE/tools"
|
||||
#r "FakeLib.dll"
|
||||
#load "./buildIncremental.fsx"
|
||||
|
||||
open System
|
||||
open System.IO
|
||||
open System.Text
|
||||
open System.Diagnostics
|
||||
|
||||
|
||||
open Fake
|
||||
open Fake.DotNetCli
|
||||
open Fake.DocFxHelper
|
||||
open Fake.Git
|
||||
open Fake.NuGet.Install
|
||||
|
||||
// Variables
|
||||
let configuration = "Release"
|
||||
let solution = "./src/Akka.sln"
|
||||
let solution = System.IO.Path.GetFullPath(string "./src/Akka.sln")
|
||||
|
||||
// Directories
|
||||
let toolsDir = __SOURCE_DIRECTORY__ @@ "tools"
|
||||
|
@ -29,6 +27,7 @@ let outputBinariesNet45 = outputBinaries @@ "net45"
|
|||
let outputBinariesNetStandard = outputBinaries @@ "netstandard1.6"
|
||||
|
||||
let buildNumber = environVarOrDefault "BUILD_NUMBER" "0"
|
||||
let hasTeamCity = (not (buildNumber = "0")) // check if we have the TeamCity environment variable for build # set
|
||||
let preReleaseVersionSuffix = "beta" + (if (not (buildNumber = "0")) then (buildNumber) else DateTime.UtcNow.Ticks.ToString())
|
||||
let versionSuffix =
|
||||
match (getBuildParam "nugetprerelease") with
|
||||
|
@ -39,6 +38,14 @@ let releaseNotes =
|
|||
File.ReadLines "./RELEASE_NOTES.md"
|
||||
|> ReleaseNotesHelper.parseReleaseNotes
|
||||
|
||||
// Incremental builds
|
||||
let runIncrementally = hasBuildParam "incremental"
|
||||
let incrementalistReport = output @@ "incrementalist.txt"
|
||||
|
||||
// Configuration values for tests
|
||||
let testNetFrameworkVersion = "net461"
|
||||
let testNetCoreVersion = "netcoreapp2.1"
|
||||
|
||||
Target "Clean" (fun _ ->
|
||||
ActivateFinalTarget "KillCreatedProcesses"
|
||||
|
||||
|
@ -56,36 +63,141 @@ Target "Clean" (fun _ ->
|
|||
CleanDirs !! "./**/obj"
|
||||
)
|
||||
|
||||
|
||||
//--------------------------------------------------------------------------------
|
||||
// Incrementalist targets
|
||||
//--------------------------------------------------------------------------------
|
||||
// Pulls the set of all affected projects detected by Incrementalist from the cached file
|
||||
let getAffectedProjectsTopology =
|
||||
lazy(
|
||||
log (sprintf "Checking inside %s for changes" incrementalistReport)
|
||||
|
||||
let incrementalistFoundChanges = File.Exists incrementalistReport
|
||||
|
||||
log (sprintf "Found changes via Incrementalist? %b - searched inside %s" incrementalistFoundChanges incrementalistReport)
|
||||
if not incrementalistFoundChanges then None
|
||||
else
|
||||
let sortedItems = (File.ReadAllLines incrementalistReport) |> Seq.map (fun x -> (x.Split ','))
|
||||
|> Seq.map (fun items -> (items.[0], items))
|
||||
let d = dict sortedItems
|
||||
Some(d)
|
||||
)
|
||||
|
||||
let getAffectedProjects =
|
||||
lazy(
|
||||
let finalProjects = getAffectedProjectsTopology.Value
|
||||
match finalProjects with
|
||||
| None -> None
|
||||
| Some p -> Some (p.Values |> Seq.concat)
|
||||
)
|
||||
|
||||
Target "ComputeIncrementalChanges" (fun _ ->
|
||||
if runIncrementally then
|
||||
let targetBranch = match getBuildParam "targetBranch" with
|
||||
| "" -> "dev"
|
||||
| null -> "dev"
|
||||
| b -> b
|
||||
let incrementalistPath =
|
||||
let incrementalistDir = toolsDir @@ "incrementalist"
|
||||
let globalTool = tryFindFileOnPath "incrementalist.exe"
|
||||
match globalTool with
|
||||
| Some t -> t
|
||||
| None -> if isWindows then findToolInSubPath "incrementalist.exe" incrementalistDir
|
||||
elif isMacOS then incrementalistDir @@ "incrementalist"
|
||||
else incrementalistDir @@ "incrementalist"
|
||||
|
||||
|
||||
let args = StringBuilder()
|
||||
|> append "-b"
|
||||
|> append targetBranch
|
||||
|> append "-s"
|
||||
|> append solution
|
||||
|> append "-f"
|
||||
|> append incrementalistReport
|
||||
|> toText
|
||||
|
||||
let result = ExecProcess(fun info ->
|
||||
info.FileName <- incrementalistPath
|
||||
info.WorkingDirectory <- __SOURCE_DIRECTORY__
|
||||
info.Arguments <- args) (System.TimeSpan.FromMinutes 5.0) (* Reasonably long-running task. *)
|
||||
|
||||
if result <> 0 then failwithf "Incrementalist failed. %s" args
|
||||
else
|
||||
log "Skipping Incrementalist - not enabled for this build"
|
||||
)
|
||||
|
||||
let filterProjects selectedProject =
|
||||
if runIncrementally then
|
||||
let affectedProjects = getAffectedProjects.Value
|
||||
|
||||
(*
|
||||
if affectedProjects.IsSome then
|
||||
log (sprintf "Searching for %s inside [%s]" selectedProject (String.Join(",", affectedProjects.Value)))
|
||||
else
|
||||
log "No affected projects found"
|
||||
*)
|
||||
|
||||
match affectedProjects with
|
||||
| None -> None
|
||||
| Some x when x |> Seq.exists (fun n -> n.Contains (System.IO.Path.GetFileName(string selectedProject))) -> Some selectedProject
|
||||
| _ -> None
|
||||
else
|
||||
log "Not running incrementally"
|
||||
Some selectedProject
|
||||
|
||||
//--------------------------------------------------------------------------------
|
||||
// Build targets
|
||||
//--------------------------------------------------------------------------------
|
||||
let skipBuild =
|
||||
lazy(
|
||||
match getAffectedProjects.Value with
|
||||
| None when runIncrementally -> true
|
||||
| _ -> false
|
||||
)
|
||||
|
||||
let headProjects =
|
||||
lazy(
|
||||
match getAffectedProjectsTopology.Value with
|
||||
| None when runIncrementally -> [||]
|
||||
| None -> [|solution|]
|
||||
| Some p -> p.Keys |> Seq.toArray
|
||||
)
|
||||
|
||||
Target "AssemblyInfo" (fun _ ->
|
||||
XmlPokeInnerText "./src/common.props" "//Project/PropertyGroup/VersionPrefix" releaseNotes.AssemblyVersion
|
||||
XmlPokeInnerText "./src/common.props" "//Project/PropertyGroup/PackageReleaseNotes" (releaseNotes.Notes |> String.concat "\n")
|
||||
)
|
||||
|
||||
Target "RestorePackages" (fun _ ->
|
||||
let additionalArgs = if versionSuffix.Length > 0 then [sprintf "/p:VersionSuffix=%s" versionSuffix] else []
|
||||
|
||||
DotNetCli.Restore
|
||||
(fun p ->
|
||||
{ p with
|
||||
Project = solution
|
||||
NoCache = false
|
||||
AdditionalArgs = additionalArgs })
|
||||
)
|
||||
|
||||
Target "Build" (fun _ ->
|
||||
let additionalArgs = if versionSuffix.Length > 0 then [sprintf "/p:VersionSuffix=%s" versionSuffix] else []
|
||||
if not skipBuild.Value then
|
||||
let additionalArgs = if versionSuffix.Length > 0 then [sprintf "/p:VersionSuffix=%s" versionSuffix] else []
|
||||
let buildProject proj =
|
||||
DotNetCli.Build
|
||||
(fun p ->
|
||||
{ p with
|
||||
Project = proj
|
||||
Configuration = configuration
|
||||
AdditionalArgs = additionalArgs })
|
||||
|
||||
DotNetCli.Build
|
||||
(fun p ->
|
||||
{ p with
|
||||
Project = solution
|
||||
Configuration = configuration
|
||||
AdditionalArgs = additionalArgs })
|
||||
getAffectedProjects.Value.Value|> Seq.iter buildProject
|
||||
)
|
||||
|
||||
//--------------------------------------------------------------------------------
|
||||
// Tests targets
|
||||
//--------------------------------------------------------------------------------
|
||||
type Runtime =
|
||||
| NetCore
|
||||
| NetFramework
|
||||
|
||||
let getTestAssembly runtime project =
|
||||
let assemblyPath = match runtime with
|
||||
| NetCore -> !! ("src" @@ "**" @@ "bin" @@ "Release" @@ testNetCoreVersion @@ fileNameWithoutExt project + ".dll")
|
||||
| NetFramework -> !! ("src" @@ "**" @@ "bin" @@ "Release" @@ testNetFrameworkVersion @@ fileNameWithoutExt project + ".dll")
|
||||
|
||||
if Seq.isEmpty assemblyPath then
|
||||
None
|
||||
else
|
||||
Some (assemblyPath |> Seq.head)
|
||||
|
||||
module internal ResultHandling =
|
||||
let (|OK|Failure|) = function
|
||||
|
@ -105,254 +217,245 @@ module internal ResultHandling =
|
|||
buildErrorMessage
|
||||
>> Option.iter (failBuildWithMessage errorLevel)
|
||||
|
||||
open BuildIncremental.IncrementalTests
|
||||
|
||||
Target "RunTests" (fun _ ->
|
||||
ActivateFinalTarget "KillCreatedProcesses"
|
||||
let projects =
|
||||
match getBuildParamOrDefault "incremental" "" with
|
||||
| "true" -> log "The following test projects would be run under Incremental Test config..."
|
||||
getIncrementalUnitTests Net |> Seq.map (fun x -> printfn "\t%s" x; x)
|
||||
| "experimental" -> log "The following test projects would be run under Incremental Test config..."
|
||||
(getIncrementalUnitTests Net) |> Seq.iter log
|
||||
getUnitTestProjects Net
|
||||
| _ -> log "All test projects will be run..."
|
||||
getUnitTestProjects Net
|
||||
let projects =
|
||||
let rawProjects = match (isWindows) with
|
||||
| true -> !! "./src/**/*.Tests.csproj"
|
||||
| _ -> !! "./src/**/*.Tests.csproj" // if you need to filter specs for Linux vs. Windows, do it here
|
||||
rawProjects |> Seq.choose filterProjects
|
||||
|
||||
let runSingleProject project =
|
||||
let arguments =
|
||||
match (hasTeamCity) with
|
||||
| true -> (sprintf "test -c Release --no-build --logger:trx --logger:\"console;verbosity=normal\" --framework %s --results-directory %s -- -parallel none -teamcity" testNetFrameworkVersion outputTests)
|
||||
| false -> (sprintf "test -c Release --no-build --logger:trx --logger:\"console;verbosity=normal\" --framework %s --results-directory %s -- -parallel none" testNetFrameworkVersion outputTests)
|
||||
|
||||
let result = ExecProcess(fun info ->
|
||||
info.FileName <- "dotnet"
|
||||
info.WorkingDirectory <- (Directory.GetParent project).FullName
|
||||
info.Arguments <- (sprintf "xunit -f net452 -c Release -nobuild -parallel none -teamcity -xml %s_xunit.xml" (outputTests @@ fileNameWithoutExt project))) (TimeSpan.FromMinutes 30.)
|
||||
info.Arguments <- arguments) (TimeSpan.FromMinutes 30.0)
|
||||
|
||||
ResultHandling.failBuildIfXUnitReportedError TestRunnerErrorLevel.DontFailBuild result
|
||||
|
||||
// dotnet process will be killed by ExecProcess (or throw if can't) '
|
||||
// but per https://github.com/xunit/xunit/issues/1338 xunit.console may not
|
||||
killProcess "xunit.console"
|
||||
killProcess "dotnet"
|
||||
ResultHandling.failBuildIfXUnitReportedError TestRunnerErrorLevel.Error result
|
||||
|
||||
CreateDir outputTests
|
||||
projects |> Seq.iter (runSingleProject)
|
||||
)
|
||||
|
||||
Target "RunTestsNetCore" (fun _ ->
|
||||
ActivateFinalTarget "KillCreatedProcesses"
|
||||
let projects =
|
||||
match getBuildParamOrDefault "incremental" "" with
|
||||
| "true" -> log "The following test projects would be run under Incremental Test config..."
|
||||
getIncrementalUnitTests NetCore |> Seq.map (fun x -> printfn "\t%s" x; x)
|
||||
| "experimental" -> log "The following test projects would be run under Incremental Test config..."
|
||||
getIncrementalUnitTests NetCore |> Seq.iter log
|
||||
getUnitTestProjects NetCore
|
||||
| _ -> log "All test projects will be run..."
|
||||
getUnitTestProjects NetCore
|
||||
if not skipBuild.Value then
|
||||
let projects =
|
||||
let rawProjects = match (isWindows) with
|
||||
| true -> !! "./src/**/*.Tests.csproj"
|
||||
| _ -> !! "./src/**/*.Tests.csproj" // if you need to filter specs for Linux vs. Windows, do it here
|
||||
rawProjects |> Seq.choose filterProjects
|
||||
|
||||
let runSingleProject project =
|
||||
let result = ExecProcess(fun info ->
|
||||
info.FileName <- "dotnet"
|
||||
info.WorkingDirectory <- (Directory.GetParent project).FullName
|
||||
info.Arguments <- (sprintf "xunit -f netcoreapp1.1 -c Release -parallel none -teamcity -xml %s_xunit_netcore.xml" (outputTests @@ fileNameWithoutExt project))) (TimeSpan.FromMinutes 30.)
|
||||
let runSingleProject project =
|
||||
let arguments =
|
||||
match (hasTeamCity) with
|
||||
| true -> (sprintf "test -c Release --no-build --logger:trx --logger:\"console;verbosity=normal\" --framework %s --results-directory %s -- -parallel none -teamcity" testNetCoreVersion outputTests)
|
||||
| false -> (sprintf "test -c Release --no-build --logger:trx --logger:\"console;verbosity=normal\" --framework %s --results-directory %s -- -parallel none" testNetCoreVersion outputTests)
|
||||
|
||||
let result = ExecProcess(fun info ->
|
||||
info.FileName <- "dotnet"
|
||||
info.WorkingDirectory <- (Directory.GetParent project).FullName
|
||||
info.Arguments <- arguments) (TimeSpan.FromMinutes 30.0)
|
||||
|
||||
ResultHandling.failBuildIfXUnitReportedError TestRunnerErrorLevel.DontFailBuild result
|
||||
ResultHandling.failBuildIfXUnitReportedError TestRunnerErrorLevel.Error result
|
||||
|
||||
// dotnet process will be killed by FAKE.ExecProcess (or throw if can't)
|
||||
// but per https://github.com/xunit/xunit/issues/1338 xunit.console may not be killed
|
||||
killProcess "xunit.console"
|
||||
killProcess "dotnet"
|
||||
|
||||
CreateDir outputTests
|
||||
projects |> Seq.iter (runSingleProject)
|
||||
CreateDir outputTests
|
||||
projects |> Seq.iter (runSingleProject)
|
||||
)
|
||||
|
||||
Target "MultiNodeTests" (fun _ ->
|
||||
ActivateFinalTarget "KillCreatedProcesses"
|
||||
let multiNodeTestPath = findToolInSubPath "Akka.MultiNodeTestRunner.exe" (currentDirectory @@ "src" @@ "core" @@ "Akka.MultiNodeTestRunner" @@ "bin" @@ "Release" @@ "net452")
|
||||
if not skipBuild.Value then
|
||||
let multiNodeTestPath = findToolInSubPath "Akka.MultiNodeTestRunner.exe" (currentDirectory @@ "src" @@ "core" @@ "Akka.MultiNodeTestRunner" @@ "bin" @@ "Release" @@ testNetFrameworkVersion)
|
||||
|
||||
let multiNodeTestAssemblies =
|
||||
match getBuildParamOrDefault "incremental" "" with
|
||||
| "true" -> log "The following test projects would be run under Incremental Test config..."
|
||||
getIncrementalMNTRTests() |> Seq.map (fun x -> printfn "\t%s" x; x)
|
||||
| "experimental" -> log "The following MNTR specs would be run under Incremental Test config..."
|
||||
getIncrementalMNTRTests() |> Seq.iter log
|
||||
getAllMntrTestAssemblies()
|
||||
| _ -> log "All test projects will be run"
|
||||
getAllMntrTestAssemblies()
|
||||
let projects =
|
||||
let rawProjects = match (isWindows) with
|
||||
| true -> !! "./src/**/*.Tests.MultiNode.csproj"
|
||||
| _ -> !! "./src/**/*.Tests.MulitNode.csproj" // if you need to filter specs for Linux vs. Windows, do it here
|
||||
rawProjects |> Seq.choose filterProjects
|
||||
|
||||
printfn "Using MultiNodeTestRunner: %s" multiNodeTestPath
|
||||
let multiNodeTestAssemblies =
|
||||
projects |> Seq.choose (getTestAssembly Runtime.NetFramework)
|
||||
|
||||
let runMultiNodeSpec assembly =
|
||||
let spec = getBuildParam "spec"
|
||||
printfn "Using MultiNodeTestRunner: %s" multiNodeTestPath
|
||||
|
||||
let args = StringBuilder()
|
||||
|> append assembly
|
||||
|> append "-Dmultinode.teamcity=true"
|
||||
|> append "-Dmultinode.enable-filesink=on"
|
||||
|> append (sprintf "-Dmultinode.output-directory=\"%s\"" outputMultiNode)
|
||||
|> appendIfNotNullOrEmpty spec "-Dmultinode.spec="
|
||||
|> toText
|
||||
|
||||
let result = ExecProcess(fun info ->
|
||||
info.FileName <- multiNodeTestPath
|
||||
info.WorkingDirectory <- (Path.GetDirectoryName (FullName multiNodeTestPath))
|
||||
info.Arguments <- args) (System.TimeSpan.FromMinutes 60.0) (* This is a VERY long running task. *)
|
||||
if result <> 0 then failwithf "MultiNodeTestRunner failed. %s %s" multiNodeTestPath args
|
||||
|
||||
multiNodeTestAssemblies |> Seq.iter (runMultiNodeSpec)
|
||||
)
|
||||
|
||||
Target "MultiNodeTestsNetCore" (fun _ ->
|
||||
ActivateFinalTarget "KillCreatedProcesses"
|
||||
let multiNodeTestPath = findToolInSubPath "Akka.MultiNodeTestRunner.dll" (currentDirectory @@ "src" @@ "core" @@ "Akka.MultiNodeTestRunner" @@ "bin" @@ "Release" @@ "netcoreapp1.1" @@ "win7-x64" @@ "publish")
|
||||
|
||||
let multiNodeTestAssemblies =
|
||||
match getBuildParamOrDefault "incremental" "" with
|
||||
| "true" -> log "The following test projects would be run under Incremental Test config..."
|
||||
getIncrementalNetCoreMNTRTests() |> Seq.map (fun x -> printfn "\t%s" x; x)
|
||||
| "experimental" -> log "The following MNTR specs would be run under Incremental Test config..."
|
||||
getIncrementalNetCoreMNTRTests() |> Seq.iter log
|
||||
getAllMntrTestNetCoreAssemblies()
|
||||
| _ -> log "All test projects will be run"
|
||||
getAllMntrTestNetCoreAssemblies()
|
||||
|
||||
printfn "Using MultiNodeTestRunner: %s" multiNodeTestPath
|
||||
|
||||
let runMultiNodeSpec assembly =
|
||||
match assembly with
|
||||
| null -> ()
|
||||
| _ ->
|
||||
let runMultiNodeSpec assembly =
|
||||
let spec = getBuildParam "spec"
|
||||
|
||||
let args = StringBuilder()
|
||||
|> append multiNodeTestPath
|
||||
|> append assembly
|
||||
|> append "-Dmultinode.teamcity=true"
|
||||
|> append "-Dmultinode.enable-filesink=on"
|
||||
|> append (sprintf "-Dmultinode.output-directory=\"%s\"" outputMultiNode)
|
||||
|> append "-Dmultinode.platform=netcore"
|
||||
|> appendIfNotNullOrEmpty spec "-Dmultinode.spec="
|
||||
|> toText
|
||||
|
||||
let result = ExecProcess(fun info ->
|
||||
info.FileName <- "dotnet"
|
||||
info.FileName <- multiNodeTestPath
|
||||
info.WorkingDirectory <- (Path.GetDirectoryName (FullName multiNodeTestPath))
|
||||
info.Arguments <- args) (System.TimeSpan.FromMinutes 60.0) (* This is a VERY long running task. *)
|
||||
if result <> 0 then failwithf "MultiNodeTestRunner failed. %s %s" multiNodeTestPath args
|
||||
|
||||
multiNodeTestAssemblies |> Seq.iter (runMultiNodeSpec)
|
||||
multiNodeTestAssemblies |> Seq.iter (runMultiNodeSpec)
|
||||
)
|
||||
|
||||
Target "MultiNodeTestsNetCore" (fun _ ->
|
||||
if not skipBuild.Value then
|
||||
let multiNodeTestPath = findToolInSubPath "Akka.MultiNodeTestRunner.dll" (currentDirectory @@ "src" @@ "core" @@ "Akka.MultiNodeTestRunner" @@ "bin" @@ "Release" @@ testNetCoreVersion @@ "win7-x64" @@ "publish")
|
||||
|
||||
let projects =
|
||||
let rawProjects = match (isWindows) with
|
||||
| true -> !! "./src/**/*.Tests.MultiNode.csproj"
|
||||
| _ -> !! "./src/**/*.Tests.MulitNode.csproj" // if you need to filter specs for Linux vs. Windows, do it here
|
||||
rawProjects |> Seq.choose filterProjects
|
||||
|
||||
let multiNodeTestAssemblies =
|
||||
projects |> Seq.choose (getTestAssembly Runtime.NetCore)
|
||||
|
||||
printfn "Using MultiNodeTestRunner: %s" multiNodeTestPath
|
||||
|
||||
let runMultiNodeSpec assembly =
|
||||
match assembly with
|
||||
| null -> ()
|
||||
| _ ->
|
||||
let spec = getBuildParam "spec"
|
||||
|
||||
let args = StringBuilder()
|
||||
|> append multiNodeTestPath
|
||||
|> append assembly
|
||||
|> append "-Dmultinode.teamcity=true"
|
||||
|> append "-Dmultinode.enable-filesink=on"
|
||||
|> append (sprintf "-Dmultinode.output-directory=\"%s\"" outputMultiNode)
|
||||
|> append "-Dmultinode.platform=netcore"
|
||||
|> appendIfNotNullOrEmpty spec "-Dmultinode.spec="
|
||||
|> toText
|
||||
|
||||
let result = ExecProcess(fun info ->
|
||||
info.FileName <- "dotnet"
|
||||
info.WorkingDirectory <- (Path.GetDirectoryName (FullName multiNodeTestPath))
|
||||
info.Arguments <- args) (System.TimeSpan.FromMinutes 60.0) (* This is a VERY long running task. *)
|
||||
if result <> 0 then failwithf "MultiNodeTestRunner failed. %s %s" multiNodeTestPath args
|
||||
|
||||
multiNodeTestAssemblies |> Seq.iter (runMultiNodeSpec)
|
||||
)
|
||||
|
||||
Target "NBench" <| fun _ ->
|
||||
ActivateFinalTarget "KillCreatedProcesses"
|
||||
CleanDir outputPerfTests
|
||||
if not skipBuild.Value then
|
||||
CleanDir outputPerfTests
|
||||
|
||||
let nbenchTestPath = findToolInSubPath "NBench.Runner.exe" (toolsDir @@ "NBench.Runner*")
|
||||
printfn "Using NBench.Runner: %s" nbenchTestPath
|
||||
let nbenchTestPath = findToolInSubPath "NBench.Runner.exe" (toolsDir @@ "NBench.Runner*")
|
||||
printfn "Using NBench.Runner: %s" nbenchTestPath
|
||||
|
||||
let nbenchTestAssemblies =
|
||||
match getBuildParamOrDefault "incremental" "" with
|
||||
| "true" -> log "The following test projects would be run under Incremental Test config..."
|
||||
getIncrementalPerfTests() |> Seq.map (fun x -> printfn "\t%s" x; x)
|
||||
| "experimental" -> log "The following test projects would be run under Incremental Test config..."
|
||||
getIncrementalPerfTests() |> Seq.iter log
|
||||
getAllPerfTestAssemblies()
|
||||
| _ -> getAllPerfTestAssemblies()
|
||||
let projects =
|
||||
let rawProjects = match (isWindows) with
|
||||
| true -> !! "./src/**/*.Tests.Peformance.csproj"
|
||||
| _ -> !! "./src/**/*.Tests.Performance.csproj" // if you need to filter specs for Linux vs. Windows, do it here
|
||||
rawProjects |> Seq.choose filterProjects
|
||||
|
||||
let runNBench assembly =
|
||||
let includes = getBuildParam "include"
|
||||
let excludes = getBuildParam "exclude"
|
||||
let teamcityStr = (getBuildParam "teamcity")
|
||||
let enableTeamCity =
|
||||
match teamcityStr with
|
||||
| null -> false
|
||||
| "" -> false
|
||||
| _ -> bool.Parse teamcityStr
|
||||
let nbenchTestAssemblies =
|
||||
projects |> Seq.choose (getTestAssembly Runtime.NetFramework)
|
||||
|
||||
let args = StringBuilder()
|
||||
|> append assembly
|
||||
|> append (sprintf "output-directory=\"%s\"" outputPerfTests)
|
||||
|> append (sprintf "concurrent=\"%b\"" true)
|
||||
|> append (sprintf "trace=\"%b\"" true)
|
||||
|> append (sprintf "teamcity=\"%b\"" enableTeamCity)
|
||||
|> appendIfNotNullOrEmpty includes "include="
|
||||
|> appendIfNotNullOrEmpty excludes "include="
|
||||
|> toText
|
||||
let runNBench assembly =
|
||||
let includes = getBuildParam "include"
|
||||
let excludes = getBuildParam "exclude"
|
||||
let teamcityStr = (getBuildParam "teamcity")
|
||||
let enableTeamCity =
|
||||
match teamcityStr with
|
||||
| null -> false
|
||||
| "" -> false
|
||||
| _ -> bool.Parse teamcityStr
|
||||
|
||||
let result = ExecProcess(fun info ->
|
||||
info.FileName <- nbenchTestPath
|
||||
info.WorkingDirectory <- (Path.GetDirectoryName (FullName nbenchTestPath))
|
||||
info.Arguments <- args) (System.TimeSpan.FromMinutes 45.0) (* Reasonably long-running task. *)
|
||||
if result <> 0 then failwithf "%s %s \nexited with code %i" nbenchTestPath args result
|
||||
let args = StringBuilder()
|
||||
|> append assembly
|
||||
|> append (sprintf "output-directory=\"%s\"" outputPerfTests)
|
||||
|> append (sprintf "concurrent=\"%b\"" true)
|
||||
|> append (sprintf "trace=\"%b\"" true)
|
||||
|> append (sprintf "teamcity=\"%b\"" enableTeamCity)
|
||||
|> appendIfNotNullOrEmpty includes "include="
|
||||
|> appendIfNotNullOrEmpty excludes "include="
|
||||
|> toText
|
||||
|
||||
let result = ExecProcess(fun info ->
|
||||
info.FileName <- nbenchTestPath
|
||||
info.WorkingDirectory <- (Path.GetDirectoryName (FullName nbenchTestPath))
|
||||
info.Arguments <- args) (System.TimeSpan.FromMinutes 45.0) (* Reasonably long-running task. *)
|
||||
if result <> 0 then failwithf "%s %s \nexited with code %i" nbenchTestPath args result
|
||||
|
||||
let failedRuns =
|
||||
nbenchTestAssemblies
|
||||
|> Seq.map (fun asm -> try runNBench asm; None with e -> Some(e.ToString()))
|
||||
|> Seq.filter Option.isSome
|
||||
|> Seq.map Option.get
|
||||
|> Seq.mapi (fun i s -> sprintf "%i: \"%s\"" (i + 1) s)
|
||||
|> Seq.toArray
|
||||
if failedRuns.Length > 0 then
|
||||
failwithf "NBench.Runner failed for %i run(s):\n%s\n\n" failedRuns.Length (String.concat "\n\n" failedRuns)
|
||||
let failedRuns =
|
||||
nbenchTestAssemblies
|
||||
|> Seq.map (fun asm -> try runNBench asm; None with e -> Some(e.ToString()))
|
||||
|> Seq.filter Option.isSome
|
||||
|> Seq.map Option.get
|
||||
|> Seq.mapi (fun i s -> sprintf "%i: \"%s\"" (i + 1) s)
|
||||
|> Seq.toArray
|
||||
if failedRuns.Length > 0 then
|
||||
failwithf "NBench.Runner failed for %i run(s):\n%s\n\n" failedRuns.Length (String.concat "\n\n" failedRuns)
|
||||
|
||||
//--------------------------------------------------------------------------------
|
||||
// Nuget targets
|
||||
//--------------------------------------------------------------------------------
|
||||
|
||||
Target "CreateNuget" (fun _ ->
|
||||
let projects = !! "src/**/*.*sproj"
|
||||
-- "src/**/*.Tests*.*sproj"
|
||||
-- "src/benchmark/**/*.*sproj"
|
||||
-- "src/examples/**/*.*sproj"
|
||||
-- "src/**/*.MultiNodeTestRunner.csproj"
|
||||
-- "src/**/*.MultiNodeTestRunner.Shared.csproj"
|
||||
-- "src/**/*.NodeTestRunner.csproj"
|
||||
if not skipBuild.Value then
|
||||
let projects =
|
||||
let rawProjects = !! "src/**/*.*sproj"
|
||||
-- "src/**/*.Tests*.*sproj"
|
||||
-- "src/benchmark/**/*.*sproj"
|
||||
-- "src/examples/**/*.*sproj"
|
||||
-- "src/**/*.MultiNodeTestRunner.csproj"
|
||||
-- "src/**/*.MultiNodeTestRunner.Shared.csproj"
|
||||
-- "src/**/*.NodeTestRunner.csproj"
|
||||
rawProjects |> Seq.choose filterProjects
|
||||
|
||||
let runSingleProject project =
|
||||
DotNetCli.Pack
|
||||
(fun p ->
|
||||
{ p with
|
||||
Project = project
|
||||
Configuration = configuration
|
||||
AdditionalArgs = ["--include-symbols"]
|
||||
VersionSuffix = versionSuffix
|
||||
OutputPath = outputNuGet })
|
||||
let runSingleProject project =
|
||||
DotNetCli.Pack
|
||||
(fun p ->
|
||||
{ p with
|
||||
Project = project
|
||||
Configuration = configuration
|
||||
AdditionalArgs = ["--include-symbols --no-build"]
|
||||
VersionSuffix = versionSuffix
|
||||
OutputPath = outputNuGet })
|
||||
|
||||
projects |> Seq.iter (runSingleProject)
|
||||
projects |> Seq.iter (runSingleProject)
|
||||
)
|
||||
open Fake.TemplateHelper
|
||||
|
||||
Target "PublishMntr" (fun _ ->
|
||||
let executableProjects = !! "./src/**/Akka.MultiNodeTestRunner.csproj"
|
||||
if not skipBuild.Value then
|
||||
let executableProjects = !! "./src/**/Akka.MultiNodeTestRunner.csproj"
|
||||
|
||||
// Windows .NET 4.5.2
|
||||
executableProjects |> Seq.iter (fun project ->
|
||||
DotNetCli.Restore
|
||||
(fun p ->
|
||||
{ p with
|
||||
Project = project
|
||||
AdditionalArgs = ["-r win7-x64"; sprintf "/p:VersionSuffix=%s" versionSuffix] })
|
||||
)
|
||||
// Windows .NET 4.5.2
|
||||
executableProjects |> Seq.iter (fun project ->
|
||||
DotNetCli.Restore
|
||||
(fun p ->
|
||||
{ p with
|
||||
Project = project
|
||||
AdditionalArgs = ["-r win7-x64"; sprintf "/p:VersionSuffix=%s" versionSuffix] })
|
||||
)
|
||||
|
||||
// Windows .NET 4.5.2
|
||||
executableProjects |> Seq.iter (fun project ->
|
||||
DotNetCli.Publish
|
||||
(fun p ->
|
||||
{ p with
|
||||
Project = project
|
||||
Configuration = configuration
|
||||
Runtime = "win7-x64"
|
||||
Framework = "net452"
|
||||
VersionSuffix = versionSuffix }))
|
||||
// Windows .NET 4.5.2
|
||||
executableProjects |> Seq.iter (fun project ->
|
||||
DotNetCli.Publish
|
||||
(fun p ->
|
||||
{ p with
|
||||
Project = project
|
||||
Configuration = configuration
|
||||
Runtime = "win7-x64"
|
||||
Framework = testNetFrameworkVersion
|
||||
VersionSuffix = versionSuffix }))
|
||||
|
||||
// Windows .NET Core
|
||||
executableProjects |> Seq.iter (fun project ->
|
||||
DotNetCli.Publish
|
||||
(fun p ->
|
||||
{ p with
|
||||
Project = project
|
||||
Configuration = configuration
|
||||
Runtime = "win7-x64"
|
||||
Framework = "netcoreapp1.1"
|
||||
VersionSuffix = versionSuffix }))
|
||||
// Windows .NET Core
|
||||
executableProjects |> Seq.iter (fun project ->
|
||||
DotNetCli.Publish
|
||||
(fun p ->
|
||||
{ p with
|
||||
Project = project
|
||||
Configuration = configuration
|
||||
Runtime = "win7-x64"
|
||||
Framework = testNetCoreVersion
|
||||
VersionSuffix = versionSuffix }))
|
||||
)
|
||||
|
||||
Target "CreateMntrNuget" (fun _ ->
|
||||
|
@ -490,14 +593,12 @@ Target "DocFx" (fun _ ->
|
|||
)
|
||||
|
||||
FinalTarget "KillCreatedProcesses" (fun _ ->
|
||||
log "Killing processes started by FAKE:"
|
||||
startedProcesses |> Seq.iter (fun (pid, _) -> logfn "%i" pid)
|
||||
killAllCreatedProcesses()
|
||||
log "Killing any remaining dotnet and xunit.console.exe processes:"
|
||||
getProcessesByName "dotnet" |> Seq.iter (fun p -> logfn "pid: %i; name: %s" p.Id p.ProcessName)
|
||||
killProcess "dotnet"
|
||||
getProcessesByName "xunit.console" |> Seq.iter (fun p -> logfn "pid: %i; name: %s" p.Id p.ProcessName)
|
||||
killProcess "xunit.console"
|
||||
log "Shutting down dotnet build-server"
|
||||
let result = ExecProcess(fun info ->
|
||||
info.FileName <- "dotnet"
|
||||
info.WorkingDirectory <- __SOURCE_DIRECTORY__
|
||||
info.Arguments <- "build-server shutdown") (System.TimeSpan.FromMinutes 2.0)
|
||||
if result <> 0 then failwithf "dotnet build-server shutdown failed"
|
||||
)
|
||||
|
||||
//--------------------------------------------------------------------------------
|
||||
|
@ -556,13 +657,20 @@ Target "HelpNuget" <| fun _ ->
|
|||
Target "BuildRelease" DoNothing
|
||||
Target "All" DoNothing
|
||||
Target "Nuget" DoNothing
|
||||
Target "RunTestsFull" DoNothing
|
||||
Target "RunTestsNetCoreFull" DoNothing
|
||||
|
||||
// build dependencies
|
||||
"Clean" ==> "RestorePackages" ==> "AssemblyInfo" ==> "Build" ==> "PublishMntr" ==> "BuildRelease"
|
||||
"Clean" ==> "AssemblyInfo" ==> "Build"
|
||||
"Build" ==> "PublishMntr" ==> "BuildRelease"
|
||||
"ComputeIncrementalChanges" ==> "Build" // compute incremental changes
|
||||
|
||||
// tests dependencies
|
||||
// "RunTests" step doesn't require Clean ==> "RestorePackages" step
|
||||
"Clean" ==> "RestorePackages" ==> "RunTestsNetCore"
|
||||
"Build" ==> "RunTests"
|
||||
"Build" ==> "RunTestsNetCore"
|
||||
|
||||
"BuildRelease" ==> "MultiNodeTestsNetCore"
|
||||
"BuildRelease" ==> "MultiNodeTests"
|
||||
|
||||
// nuget dependencies
|
||||
"BuildRelease" ==> "CreateMntrNuget" ==> "CreateNuget" ==> "PublishNuget" ==> "Nuget"
|
||||
|
@ -575,6 +683,7 @@ Target "Nuget" DoNothing
|
|||
"RunTests" ==> "All"
|
||||
"RunTestsNetCore" ==> "All"
|
||||
"MultiNodeTests" ==> "All"
|
||||
"MultiNodeTestsNetCore" ==> "All"
|
||||
"NBench" ==> "All"
|
||||
|
||||
RunTargetOrDefault "Help"
|
||||
|
|
22
build.ps1
22
build.ps1
|
@ -31,13 +31,15 @@ Param(
|
|||
|
||||
$FakeVersion = "4.63.0"
|
||||
$NBenchVersion = "1.0.1"
|
||||
$DotNetChannel = "preview";
|
||||
$DotNetVersion = "2.0.0";
|
||||
$DotNetChannel = "LTS";
|
||||
$DotNetVersion = "2.1.500";
|
||||
$DotNetInstallerUri = "https://raw.githubusercontent.com/dotnet/cli/v$DotNetVersion/scripts/obtain/dotnet-install.ps1";
|
||||
$NugetVersion = "4.3.0";
|
||||
$NugetUrl = "https://dist.nuget.org/win-x86-commandline/v$NugetVersion/nuget.exe"
|
||||
$ProtobufVersion = "3.4.0"
|
||||
$DocfxVersion = "2.21.1"
|
||||
$DocfxVersion = "2.40.5"
|
||||
|
||||
$IncrementalistVersion = "0.1.4";
|
||||
|
||||
# Make sure tools folder exists
|
||||
$PSScriptRoot = Split-Path $MyInvocation.MyCommand.Path -Parent
|
||||
|
@ -157,6 +159,20 @@ if (!(Test-Path $DocfxExePath)) {
|
|||
}
|
||||
}
|
||||
|
||||
###########################################################################
|
||||
# Incrementalist
|
||||
###########################################################################
|
||||
|
||||
# Make sure the Incrementalist has been installed
|
||||
if (Get-Command incrementalist -ErrorAction SilentlyContinue) {
|
||||
Write-Host "Found Incrementalist. Skipping install."
|
||||
}
|
||||
else{
|
||||
$IncrementalistFolder = Join-Path $ToolPath "incrementalist"
|
||||
Write-Host "Incrementalist not found. Installing to ... $IncrementalistFolder"
|
||||
dotnet tool install Incrementalist.Cmd --version $IncrementalistVersion --tool-path "$IncrementalistFolder"
|
||||
}
|
||||
|
||||
###########################################################################
|
||||
# RUN BUILD SCRIPT
|
||||
###########################################################################
|
||||
|
|
29
build.sh
29
build.sh
|
@ -6,14 +6,18 @@
|
|||
# Define directories.
|
||||
SCRIPT_DIR=$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )
|
||||
TOOLS_DIR=$SCRIPT_DIR/tools
|
||||
INCREMENTALIST_DIR=$TOOLS_DIR/incrementalist
|
||||
INCREMENTALIST_EXE=$INCREMENTALIST_DIR/Incrementalist.Cmd.exe
|
||||
NUGET_EXE=$TOOLS_DIR/nuget.exe
|
||||
NUGET_URL=https://dist.nuget.org/win-x86-commandline/v4.3.0/nuget.exe
|
||||
FAKE_VERSION=4.63.0
|
||||
FAKE_EXE=$TOOLS_DIR/FAKE/tools/FAKE.exe
|
||||
DOTNET_EXE=$SCRIPT_DIR/.dotnet/dotnet
|
||||
DOTNET_VERSION=1.1.0
|
||||
DOTNET_VERSION=2.1.500
|
||||
DOTNET_INSTALLER_URL=https://raw.githubusercontent.com/dotnet/cli/v$DOTNET_VERSION/scripts/obtain/dotnet-install.sh
|
||||
DOTNET_CHANNEL=LTS
|
||||
PROTOBUF_VERSION=3.4.0
|
||||
INCREMENTALIST_VERSION=0.1.4
|
||||
|
||||
# Define default arguments.
|
||||
TARGET="Default"
|
||||
|
@ -44,15 +48,12 @@ fi
|
|||
# INSTALL .NET CORE CLI
|
||||
###########################################################################
|
||||
|
||||
if [ ! -f "$DOTNET_EXE" ]; then
|
||||
echo "Installing .NET CLI..."
|
||||
if [ ! -d "$SCRIPT_DIR/.dotnet" ]; then
|
||||
mkdir "$SCRIPT_DIR/.dotnet"
|
||||
fi
|
||||
curl -Lsfo "$SCRIPT_DIR/.dotnet/dotnet-install.sh" $DOTNET_INSTALLER_URL
|
||||
bash "$SCRIPT_DIR/.dotnet/dotnet-install.sh" --version $DOTNET_VERSION --install-dir .dotnet --no-path
|
||||
echo "Installing .NET CLI..."
|
||||
if [ ! -d "$SCRIPT_DIR/.dotnet" ]; then
|
||||
mkdir "$SCRIPT_DIR/.dotnet"
|
||||
fi
|
||||
|
||||
curl -Lsfo "$SCRIPT_DIR/.dotnet/dotnet-install.sh" $DOTNET_INSTALLER_URL
|
||||
bash "$SCRIPT_DIR/.dotnet/dotnet-install.sh" --version $DOTNET_VERSION --channel $DOTNET_CHANNEL --install-dir .dotnet --no-path
|
||||
export PATH="$SCRIPT_DIR/.dotnet":$PATH
|
||||
export DOTNET_SKIP_FIRST_TIME_EXPERIENCE=1
|
||||
export DOTNET_CLI_TELEMETRY_OPTOUT=1
|
||||
|
@ -114,6 +115,16 @@ if [ ! -f "$PROTOC_EXE" ]; then
|
|||
fi
|
||||
fi
|
||||
|
||||
###########################################################################
|
||||
# INSTALL Incrementalist
|
||||
###########################################################################
|
||||
if [ ! -f "$INCREMENTALIST_EXE" ]; then
|
||||
"$SCRIPT_DIR/.dotnet/dotnet" tool install Incrementalist.Cmd --version $INCREMENTALIST_VERSION --tool-path "$INCREMENTALIST_DIR"
|
||||
if [ $? -ne 0 ]; then
|
||||
echo "Incrementalist already installed."
|
||||
fi
|
||||
fi
|
||||
|
||||
###########################################################################
|
||||
# WORKAROUND FOR MONO
|
||||
###########################################################################
|
||||
|
|
Загрузка…
Ссылка в новой задаче