Skip to content

Commit

Permalink
Merge pull request #103 from TheAngryByrd/101-coverage-threshold
Browse files Browse the repository at this point in the history
adding code coverage threshold defaulted to 80 percent
  • Loading branch information
TheAngryByrd authored Aug 27, 2018
2 parents b8c230e + 6f1c983 commit bcd2bc2
Showing 1 changed file with 18 additions and 9 deletions.
27 changes: 18 additions & 9 deletions Content/build.fsx
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,15 @@ let coverageReportDir = __SOURCE_DIRECTORY__ @@ "docs" @@ "coverage"
let gitOwner = "MyGithubUsername"
let gitRepoName = "MyLib.1"

let configuration =
EnvironmentHelper.environVarOrDefault "CONFIGURATION" "Release"
let isRelease () =
Fake.TargetHelper.CurrentTargetOrder
|> Seq.collect id
|> Seq.exists ((=)"Release")

let configuration () =
let defaultVal =
if isRelease () then "Release" else "Debug"
EnvironmentHelper.environVarOrDefault "CONFIGURATION" defaultVal


module dotnet =
Expand All @@ -37,10 +44,7 @@ module dotnet =
DotNetCli.RunCommand cmdParam (sprintf "watch %s %s" program argConcat)


let isRelease () =
Fake.TargetHelper.CurrentTargetOrder
|> Seq.collect id
|> Seq.exists ((=)"Release")


Target "Clean" (fun _ ->
["bin"; "temp" ; distDir; coverageReportDir]
Expand Down Expand Up @@ -72,29 +76,34 @@ Target "DotnetBuild" (fun _ ->
DotNetCli.Build (fun c ->
{ c with
Project = sln
Configuration = configuration
Configuration = configuration ()
//This makes sure that Proj2 references the correct version of Proj1
AdditionalArgs =
[
sprintf "/p:PackageVersion=%s" release.NugetVersion
sprintf "/p:SourceLinkCreate=%b" (isRelease ())

"--no-restore"
]
}))

let invokeAsync f = async { f () }

let coverageThresholdPercent = 80

Target "DotnetTest" (fun _ ->
!! testsGlob
|> Seq.iter (fun proj ->
DotNetCli.Test <| fun c ->
{ c with
Project = proj
Configuration = configuration
Configuration = configuration ()
AdditionalArgs =
[
"--no-build"
"/p:AltCover=true"
sprintf "/p:AltCoverThreshold=%d" coverageThresholdPercent
sprintf "/p:AltCoverAssemblyExcludeFilter=%s" (IO.Path.GetFileNameWithoutExtension(proj))
]
})
)
Expand Down Expand Up @@ -189,7 +198,7 @@ Target "DotnetPack" (fun _ ->
DotNetCli.Pack (fun c ->
{ c with
Project = proj
Configuration = configuration
Configuration = configuration ()
OutputPath = distDir
AdditionalArgs =
[
Expand Down

0 comments on commit bcd2bc2

Please sign in to comment.