7
7
[String []]$Tag ,
8
8
[String []]$ExcludeTag ,
9
9
[String ]$PSGalleryAPIKey ,
10
- [String ]$GithubAccessToken ,
11
- [String ]$WikiUri = $env: WikiURI ,
12
- [String ]$WikiUser = $env: WikiUser ,
13
- [String ]$WikiPassword = $env: WikiPass
10
+ [String ]$GithubAccessToken
14
11
)
15
12
16
13
$WarningPreference = " Continue"
@@ -37,25 +34,14 @@ if ($BuildTask -notin @("SetUp", "InstallDependencies")) {
37
34
Import-Module BuildHelpers - Force - ErrorAction Stop
38
35
Invoke-Init
39
36
}
40
- if (' AppVeyor' -eq $env: BHBuildSystem ) {
41
- $project = Get-AppVeyorProject
42
- }
43
-
44
- $env: WikiURI = $WikiUri
45
- $env: WikiUser = $WikiUser
46
- $env: WikiPass = $WikiPassword
47
37
48
38
$shouldDeploy = (
49
39
# only deploy master branch
50
40
(' master' -eq $env: BHBranchName ) -and
51
41
# it cannot be a PR
52
- # ( -not $env:APPVEYOR_PULL_REQUEST_NUMBER ) -and
53
- # only deploy from AppVeyor
42
+ ( -not $env: SYSTEM_PULLREQUEST_PULLREQUESTID ) -and
43
+ # only deploy from VSTS
54
44
(' VSTS' -eq $env: BHBuildSystem ) -and
55
- # must be last job of AppVeyor
56
- # (Test-IsLastJob) -and
57
- # Travis-CI must be finished (if used)
58
- # TODO: ( -not Test-TravisProgress) -and
59
45
# it cannot have a commit message that contains "skip-deploy"
60
46
($env: BHCommitMessage -notlike ' *skip-deploy*' )
61
47
)
@@ -148,10 +134,10 @@ task ShowInfo Init, GetNextVersion, {
148
134
149
135
# region BuildRelease
150
136
# Synopsis: Build a shippable release
151
- task Build Init, GenerateRelease , UpdateManifest, CompileModule
137
+ task Build Init, GenerateExternalHelp , CopyModuleFiles , UpdateManifest, CompileModule, PrepareTests
152
138
153
139
# Synopsis: Generate ./Release structure
154
- task GenerateRelease GenerateExternalHelp , {
140
+ task CopyModuleFiles {
155
141
# Setup
156
142
if (-not (Test-Path " $env: BHBuildOutput /$env: BHProjectName " )) {
157
143
$null = New-Item - Path " $env: BHBuildOutput /$env: BHProjectName " - ItemType Directory
@@ -165,16 +151,17 @@ task GenerateRelease GenerateExternalHelp, {
165
151
" $env: BHProjectPath /LICENSE"
166
152
" $env: BHProjectPath /README.md"
167
153
) - Destination " $env: BHBuildOutput /$env: BHProjectName " - Force
168
- # Copy Tests
169
- Copy-Item - Path " $env: BHProjectPath /PSScriptAnalyzerSettings.psd1" - Destination $env: BHBuildOutput - Force
154
+ }
155
+
156
+ # Synopsis: Prepare tests for ./Release
157
+ task PrepareTests Init, {
170
158
$null = New-Item - Path " $env: BHBuildOutput /Tests" - ItemType Directory - ErrorAction SilentlyContinue
171
159
Copy-Item - Path " $env: BHProjectPath /Tests" - Destination $env: BHBuildOutput - Recurse - Force
172
- # Remove all execptions from PSScriptAnalyzer
173
- BuildHelpers\Update-Metadata - Path " $env: BHBuildOutput /PSScriptAnalyzerSettings.psd1" - PropertyName ExcludeRules - Value ' '
160
+ Copy-Item - Path " $env: BHProjectPath /PSScriptAnalyzerSettings.psd1" - Destination $env: BHBuildOutput - Force
174
161
}
175
162
176
163
# Synopsis: Compile all functions into the .psm1 file
177
- task CompileModule {
164
+ task CompileModule Init , {
178
165
$regionsToKeep = @ (' Dependencies' , ' ModuleConfig' )
179
166
180
167
$targetFile = " $env: BHBuildOutput /$env: BHProjectName /$env: BHProjectName .psm1"
@@ -210,7 +197,7 @@ task CompileModule {
210
197
}
211
198
212
199
# Synopsis: Use PlatyPS to generate External-Help
213
- task GenerateExternalHelp {
200
+ task GenerateExternalHelp Init , {
214
201
Import-Module platyPS - Force
215
202
foreach ($locale in (Get-ChildItem " $env: BHProjectPath /docs" - Attribute Directory)) {
216
203
New-ExternalHelp - Path " $ ( $locale.FullName ) " - OutputPath " $env: BHModulePath /$ ( $locale.Basename ) " - Force
@@ -250,13 +237,13 @@ task Test Init, {
250
237
251
238
Remove-Module $env: BHProjectName - ErrorAction SilentlyContinue
252
239
253
- $params = @ {
240
+ <# $params = @{
254
241
Path = "$env:BHBuildOutput/$env:BHProjectName"
255
242
Include = '*.ps1', '*.psm1'
256
243
Recurse = $True
257
- # Exclude = $CodeCoverageExclude
244
+ Exclude = $CodeCoverageExclude
258
245
}
259
- $codeCoverageFiles = Get-ChildItem @params
246
+ $codeCoverageFiles = Get-ChildItem @params #>
260
247
261
248
try {
262
249
$parameter = @ {
@@ -271,10 +258,6 @@ task Test Init, {
271
258
}
272
259
$testResults = Invoke-Pester @parameter
273
260
274
- if (' AppVeyor' -eq $env: BHBuildSystem ) {
275
- BuildHelpers\Add-TestResultToAppveyor - TestFile $parameter [" OutputFile" ]
276
- }
277
-
278
261
Assert-True ($testResults.FailedCount -eq 0 ) " $ ( $testResults.FailedCount ) Pester test(s) failed."
279
262
}
280
263
catch {
0 commit comments