@@ -5,68 +5,68 @@ open System
5
5
open System.IO
6
6
7
7
/// AppVeyor environment variables as [described](http://www.appveyor.com/docs/environment-variables)
8
- type AppVeyorEnvironment =
9
-
8
+ type AppVeyorEnvironment =
9
+
10
10
/// AppVeyor Build Agent API URL
11
11
static member ApiUrl = environVar " APPVEYOR_API_URL"
12
12
13
13
/// AppVeyor Account Name
14
14
static member AccountName = environVar " APPVEYOR_ACCOUNT_NAME"
15
-
15
+
16
16
/// AppVeyor unique project ID
17
17
static member ProjectId = environVar " APPVEYOR_PROJECT_ID"
18
-
18
+
19
19
/// Project name
20
20
static member ProjectName = environVar " APPVEYOR_PROJECT_NAME"
21
-
21
+
22
22
/// Project slug (as seen in project details URL)
23
23
static member ProjectSlug = environVar " APPVEYOR_PROJECT_SLUG"
24
-
24
+
25
25
/// Path to clone directory
26
26
static member BuildFolder = environVar " APPVEYOR_BUILD_FOLDER"
27
-
27
+
28
28
/// AppVeyor unique build ID
29
29
static member BuildId = environVar " APPVEYOR_BUILD_ID"
30
-
30
+
31
31
/// Build number
32
32
static member BuildNumber = environVar " APPVEYOR_BUILD_NUMBER"
33
-
33
+
34
34
/// Build version
35
35
static member BuildVersion = environVar " APPVEYOR_BUILD_VERSION"
36
-
36
+
37
37
/// GitHub Pull Request number
38
38
static member PullRequestNumber = environVar " APPVEYOR_PULL_REQUEST_NUMBER"
39
-
39
+
40
40
/// GitHub Pull Request title
41
41
static member PullRequestTitle = environVar " APPVEYOR_PULL_REQUEST_TITLE"
42
-
42
+
43
43
/// AppVeyor unique job ID
44
44
static member JobId = environVar " APPVEYOR_JOB_ID"
45
-
45
+
46
46
/// GitHub, BitBucket or Kiln
47
47
static member RepoProvider = environVar " APPVEYOR_REPO_PROVIDER"
48
-
48
+
49
49
/// git or mercurial
50
50
static member RepoScm = environVar " APPVEYOR_REPO_SCM"
51
-
51
+
52
52
/// Repository name in format owner-name/repo-name
53
53
static member RepoName = environVar " APPVEYOR_REPO_NAME"
54
-
54
+
55
55
/// Build branch
56
56
static member RepoBranch = environVar " APPVEYOR_REPO_BRANCH"
57
-
57
+
58
58
/// Commit ID (SHA)
59
59
static member RepoCommit = environVar " APPVEYOR_REPO_COMMIT"
60
-
60
+
61
61
/// Commit author's name
62
62
static member RepoCommitAuthor = environVar " APPVEYOR_REPO_COMMIT_AUTHOR"
63
-
63
+
64
64
/// Commit author's email address
65
65
static member RepoCommitAuthorEmail = environVar " APPVEYOR_REPO_COMMIT_AUTHOR_EMAIL"
66
-
66
+
67
67
/// Commit date/time
68
68
static member RepoCommitTimestamp = environVar " APPVEYOR_REPO_COMMIT_TIMESTAMP"
69
-
69
+
70
70
/// Commit message
71
71
static member RepoCommitMessage = environVar " APPVEYOR_REPO_COMMIT_MESSAGE"
72
72
@@ -81,7 +81,7 @@ type AppVeyorEnvironment =
81
81
82
82
/// If the build has been started by the "Re-Build commit/PR" button or from the same API
83
83
static member IsReBuild = environVar " APPVEYOR_RE_BUILD"
84
-
84
+
85
85
/// true if build has started by pushed tag; otherwise false
86
86
static member RepoTag =
87
87
let rt = environVar " APPVEYOR_REPO_TAG"
@@ -93,31 +93,35 @@ type AppVeyorEnvironment =
93
93
/// Platform name set on Build tab of project settings (or through platform parameter in appveyor.yml).
94
94
static member Platform = environVar " PLATFORM"
95
95
96
- /// Configuration name set on Build tab of project settings (or through configuration parameter in appveyor.yml).
96
+ /// Configuration name set on Build tab of project settings (or through configuration parameter in appveyor.yml).
97
97
static member Configuration = environVar " CONFIGURATION"
98
98
99
99
/// The job name
100
100
static member JobName = environVar " APPVEYOR_JOB_NAME"
101
-
102
- let private sendToAppVeyor args =
103
- ExecProcess ( fun info ->
101
+
102
+ let private sendToAppVeyor args =
103
+ ExecProcess ( fun info ->
104
104
info.FileName <- " appveyor"
105
105
info.Arguments <- args) ( System.TimeSpan.MaxValue)
106
106
|> ignore
107
107
108
- let private add msg category =
109
- sprintf " AddMessage %s -Category %s " ( quoteIfNeeded msg) ( quoteIfNeeded category) |> sendToAppVeyor
108
+ let private add msg category =
109
+ let enableProcessTracingPreviousValue = enableProcessTracing
110
+ enableProcessTracing <- false
111
+ if not <| isNullOrEmpty msg then
112
+ sprintf " AddMessage %s -Category %s " ( quoteIfNeeded msg) ( quoteIfNeeded category) |> sendToAppVeyor
113
+ enableProcessTracing <- enableProcessTracingPreviousValue
110
114
let private addNoCategory msg = sprintf " AddMessage %s " ( quoteIfNeeded msg) |> sendToAppVeyor
111
115
112
116
// Add trace listener to track messages
113
- if buildServer = BuildServer.AppVeyor then
117
+ if buildServer = BuildServer.AppVeyor then
114
118
{ new ITraceListener with
115
- member this.Write msg =
119
+ member this.Write msg =
116
120
match msg with
117
121
| ErrorMessage x -> add x " Error"
118
122
| ImportantMessage x -> add x " Warning"
119
123
| LogMessage( x, _) -> add x " Information"
120
- | TraceMessage( x, _) ->
124
+ | TraceMessage( x, _) ->
121
125
if not enableProcessTracing then addNoCategory x
122
126
| StartMessage | FinishedMessage | OpenTag(_, _) | CloseTag _ -> () }
123
127
|> listeners.Add
@@ -129,23 +133,23 @@ let FinishTestSuite testSuiteName = () // Nothing in API yet
129
133
let StartTestSuite testSuiteName = () // Nothing in API yet
130
134
131
135
/// Starts the test case.
132
- let StartTestCase testSuiteName testCaseName =
136
+ let StartTestCase testSuiteName testCaseName =
133
137
sendToAppVeyor <| sprintf " AddTest \" %s \" -Outcome Running" ( testSuiteName + " - " + testCaseName)
134
138
135
139
/// Reports a failed test.
136
- let TestFailed testSuiteName testCaseName message details =
140
+ let TestFailed testSuiteName testCaseName message details =
137
141
sendToAppVeyor <| sprintf " UpdateTest \" %s \" -Outcome Failed -ErrorMessage %s -ErrorStackTrace %s " ( testSuiteName + " - " + testCaseName)
138
142
( EncapsulateSpecialChars message) ( EncapsulateSpecialChars details)
139
143
140
- /// Ignores the test case.
144
+ /// Ignores the test case.
141
145
let IgnoreTestCase testSuiteName testCaseName message = sendToAppVeyor <| sprintf " UpdateTest \" %s \" -Outcome Ignored" ( testSuiteName + " - " + testCaseName)
142
146
143
147
/// Reports a succeeded test.
144
148
let TestSucceeded testSuiteName testCaseName = sendToAppVeyor <| sprintf " UpdateTest \" %s \" -Outcome Passed" ( testSuiteName + " - " + testCaseName)
145
149
146
150
/// Finishes the test case.
147
- let FinishTestCase testSuiteName testCaseName ( duration : System.TimeSpan ) =
148
- let duration =
151
+ let FinishTestCase testSuiteName testCaseName ( duration : System.TimeSpan ) =
152
+ let duration =
149
153
duration.TotalMilliseconds
150
154
|> round
151
155
|> string
@@ -238,7 +242,7 @@ let PushArtifacts paths =
238
242
239
243
/// AppVeyor parameters for update build as [described](https://www.appveyor.com/docs/build-worker-api/#update-build-details)
240
244
[<CLIMutable>]
241
- type UpdateBuildParams =
245
+ type UpdateBuildParams =
242
246
{ /// Build version; must be unique for the current project
243
247
Version : string
244
248
/// Commit message
@@ -271,7 +275,7 @@ let UpdateBuild (setParams : UpdateBuildParams -> UpdateBuildParams) =
271
275
if buildServer = BuildServer.AppVeyor then
272
276
let parameters = setParams defaultUpdateBuildParams
273
277
274
- let committedStr =
278
+ let committedStr =
275
279
match parameters.Committed with
276
280
| Some x -> x.ToString( " o" )
277
281
| None -> " "
@@ -290,5 +294,5 @@ let UpdateBuild (setParams : UpdateBuildParams -> UpdateBuildParams) =
290
294
|> sendToAppVeyor
291
295
292
296
/// Update build version. This must be unique for the current project.
293
- let UpdateBuildVersion version =
297
+ let UpdateBuildVersion version =
294
298
UpdateBuild ( fun p -> { p with Version = version })
0 commit comments