Skip to content

Commit eb782de

Browse files
authored
Update CI system for PsPackageProject release 0.1.13 (#23)
1 parent 6816ead commit eb782de

File tree

5 files changed

+55
-6
lines changed

5 files changed

+55
-6
lines changed

build.ps1

Lines changed: 27 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
# Copyright (c) Microsoft Corporation. All rights reserved.
22
# Licensed under the MIT License.
33

4+
# Do NOT edit this file. Edit dobuild.ps1
5+
[System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("PSAvoidUsingWriteHost", "")]
46
param (
57
[Parameter(ParameterSetName="build")]
68
[switch]
@@ -10,6 +12,13 @@ param (
1012
[switch]
1113
$Build,
1214

15+
[Parameter(ParameterSetName="publish")]
16+
[switch]
17+
$Publish,
18+
[Parameter(ParameterSetName="publish")]
19+
[switch]
20+
$Signed,
21+
1322
[Parameter(ParameterSetName="build")]
1423
[switch]
1524
$Test,
@@ -29,13 +38,24 @@ $config = Get-PSPackageProjectConfiguration -ConfigPath $PSScriptRoot
2938
$script:ModuleName = $config.ModuleName
3039
$script:SrcPath = $config.SourcePath
3140
$script:OutDirectory = $config.BuildOutputPath
41+
$script:SignedDirectory = $config.SignedOutputPath
3242
$script:TestPath = $config.TestPath
3343

3444
$script:ModuleRoot = $PSScriptRoot
3545
$script:Culture = $config.Culture
3646
$script:HelpPath = $config.HelpPath
3747

38-
. "$PSScriptRoot\dobuild.ps1"
48+
if ($env:TF_BUILD) {
49+
$vstsCommandString = "vso[task.setvariable variable=BUILD_OUTPUT_PATH]$OutDirectory"
50+
Write-Host ("sending " + $vstsCommandString)
51+
Write-Host "##$vstsCommandString"
52+
53+
$vstsCommandString = "vso[task.setvariable variable=SIGNED_OUTPUT_PATH]$SignedDirectory"
54+
Write-Host ("sending " + $vstsCommandString)
55+
Write-Host "##$vstsCommandString"
56+
}
57+
58+
. $PSScriptRoot\dobuild.ps1
3959

4060
if ( ! ( Get-Module -ErrorAction SilentlyContinue PSPackageProject) ) {
4161
Install-Module PSPackageProject
@@ -58,7 +78,12 @@ else
5878
if ($Build.IsPresent)
5979
{
6080
$sb = (Get-Item Function:DoBuild).ScriptBlock
61-
Invoke-PSPackageProjectBuild -BuildScript $sb
81+
Invoke-PSPackageProjectBuild -BuildScript $sb -SkipPublish
82+
}
83+
84+
if ($Publish.IsPresent)
85+
{
86+
Invoke-PSPackageProjectPublish -Signed:$Signed.IsPresent
6287
}
6388

6489
if ( $Test.IsPresent ) {

dobuild.ps1

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,11 @@
1+
# Copyright (c) Microsoft Corporation. All rights reserved.
2+
# Licensed under the MIT License.
3+
4+
#####################################################
5+
# Do NOT edit anything outside the DoBuild function.
6+
# You can define functions inside the scope of DoBuild.
7+
#####################################################
8+
19
<#
210
.DESCRIPTION
311
Implement build and packaging of the package and place the output $OutDirectory/$ModuleName

pspackageproject.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
"HelpPath": "help",
33
"ModuleName": "PSDesiredStateConfiguration",
44
"BuildOutputPath": "out",
5+
"SignedOutputPath": "signed",
56
"SourcePath": "src/PSDesiredStateConfiguration",
67
"TestPath": "test",
78
"Culture": "en-US"

src/.ci/ci.yml

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,15 +23,27 @@ stages:
2323
- pwsh: |
2424
Install-Module -Name "platyPS","Pester" -Force
2525
displayName: Install dependencies
26+
timeoutInMinutes: 10
2627
- pwsh: |
2728
Install-Module -Name "PSScriptAnalyzer" -RequiredVersion 1.18.0 -Force
2829
displayName: Install PSScriptAnalyzer
30+
timeoutInMinutes: 10
2931
- pwsh: |
3032
Install-Module -Name PSPackageProject -Force
3133
displayName: Install PSPackageProject module
34+
timeoutInMinutes: 10
3235
- pwsh: |
3336
$(Build.SourcesDirectory)/build.ps1 -Build
34-
displayName: Build and publish artifact
37+
displayName: Build
38+
- pwsh: |
39+
Write-Verbose "BUILD_OUTPUT_PATH- $env:BUILD_OUTPUT_PATH" -Verbose
40+
Write-Verbose "SIGNED_OUTPUT_PATH- $env:SIGNED_OUTPUT_PATH" -Verbose
41+
Copy-Item $env:BUILD_OUTPUT_PATH $env:SIGNED_OUTPUT_PATH -Recurse -Force
42+
displayName: Build Signing Placeholder
43+
- pwsh: |
44+
$(Build.SourcesDirectory)/build.ps1 -Publish -Signed
45+
displayName: Publish
46+
timeoutInMinutes: 10
3547
3648
- stage: Test
3749
displayName: Test Package

src/.ci/test.yml

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -59,11 +59,13 @@ jobs:
5959
- ${{ parameters.powershellExecutable }}: |
6060
Install-Module -Name "platyPS","Pester" -Force
6161
displayName: Install dependencies
62+
timeoutInMinutes: 10
6263
6364
- ${{ parameters.powershellExecutable }}: |
6465
Install-Module -Name "PSScriptAnalyzer" -RequiredVersion 1.18.0 -Force
6566
displayName: Install dependencies
66-
67+
timeoutInMinutes: 10
68+
6769
- ${{ parameters.powershellExecutable }}: |
6870
Install-Module -Name PSPackageProject -Force
6971
displayName: Install PSPackageProject module
@@ -85,6 +87,7 @@ jobs:
8587
$moduleName = $config.ModuleName
8688
Save-Module -Repository $sourceName -Name $moduleName -Path $config.BuildOutputPath
8789
displayName: Extract product artifact
90+
timeoutInMinutes: 10
8891
8992
- ${{ parameters.powershellExecutable }}: |
9093
Invoke-PSPackageProjectTest -Type Functional
@@ -96,10 +99,10 @@ jobs:
9699
displayName: Execute static analysis tests
97100
errorActionPreference: continue
98101
condition: succeededOrFailed()
99-
continueOnError: true
102+
100103
101104
- ${{ parameters.powershellExecutable }}: |
102105
Unregister-PSRepository -Name 'pspackageproject-local-repo' -ErrorAction Ignore
103106
displayName: Unregister temporary PSRepository
104107
condition: always()
105-
108+
timeoutInMinutes: 10

0 commit comments

Comments
 (0)