-
Notifications
You must be signed in to change notification settings - Fork 26
/
build-helpers.fsx
46 lines (30 loc) · 2.03 KB
/
build-helpers.fsx
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
module BuildHelpers
open Fake
open Fake.XamarinHelper
open System
open System.IO
open System.Linq
let Exec command args =
let result = Shell.Exec(command, args)
if result <> 0 then failwithf "%s exited with error %d" command result
let RestorePackages solutionFile =
Exec "tools/NuGet/NuGet.exe" ("restore " + solutionFile)
solutionFile |> RestoreComponents (fun defaults -> {defaults with ToolPath = "tools/xpkg/xamarin-component.exe" })
let RunNUnitTests dllPath xmlPath =
Exec "/Library/Frameworks/Mono.framework/Versions/Current/bin/nunit-console4" (dllPath + " -xml=" + xmlPath)
TeamCityHelper.sendTeamCityNUnitImport xmlPath
let RunUITests appPath =
let testAppFolder = Path.Combine("tests", "TipCalc.UITests", "testapps")
if Directory.Exists(testAppFolder) then Directory.Delete(testAppFolder, true)
Directory.CreateDirectory(testAppFolder) |> ignore
let testAppPath = Path.Combine(testAppFolder, DirectoryInfo(appPath).Name)
Directory.Move(appPath, testAppPath)
RestorePackages "tests/TipCalc.UITests/TipCalc.UITests.sln"
MSBuild "tests/TipCalc.UITests/bin/Debug" "Build" [ ("Configuration", "Debug"); ("Platform", "Any CPU") ] [ "tests/TipCalc.UITests/TipCalc.UITests.sln" ] |> ignore
RunNUnitTests "tests/TipCalc.UITests/bin/Debug/TipCalc.UITests.dll" "tests/TipCalc.UITests/bin/Debug/testresults.xml"
let RunTestCloudTests appFile deviceList =
MSBuild "tests/TipCalc.UITests/bin/Debug" "Build" [ ("Configuration", "Debug"); ("Platform", "Any CPU") ] [ "tests/TipCalc.UITests/TipCalc.UITests.sln" ] |> ignore
let testCloudToken = Environment.GetEnvironmentVariable("TestCloudApiToken")
let args = String.Format(@"submit ""{0}"" {1} --devices {2} --series ""main"" --locale ""en_US"" --assembly-dir ""tests/TipCalc.UITests/bin/Debug"" --nunit-xml tests/TipCalc.UITests/testapps/testresults.xml", appFile, testCloudToken, deviceList)
Exec "packages/Xamarin.UITest.0.6.1/tools/test-cloud.exe" args
TeamCityHelper.sendTeamCityNUnitImport "Apps/tests/apps/testresults.xml"