Skip to content

Commit 8373aca

Browse files
committed
added copyright header, removed usage of DS in tests, minor formatting changes
1 parent abeb7a2 commit 8373aca

27 files changed

+305
-1810
lines changed

.azdevops/CI.yml

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -35,12 +35,8 @@ stages:
3535
includePreviewVersions: true
3636

3737
- pwsh: |
38-
& $(Build.SourcesDirectory)\SimpleBuild.ps1
38+
& "$(Build.SourcesDirectory)\SimpleBuild.ps1"
3939
displayName: Build Microsoft.PowerShell.Archive module
40-
41-
- pwsh: |
42-
dir "$(BuildOutDir)/*" -Recurse
43-
displayName: Show BuildOutDirectory
4440
4541
- task: CopyFiles@2
4642
displayName: 'Copy build'
@@ -59,19 +55,19 @@ stages:
5955
dependsOn: Build
6056
displayName: Run tests
6157
jobs:
62-
- template: runtest.yml
58+
- template: TestsTemplate.yml
6359
parameters:
6460
vmImageName: windows-2019
6561
jobName: run_test_windows
6662
jobDisplayName: Run Windows tests
6763

68-
- template: runtest.yml
64+
- template: TestsTemplate.yml
6965
parameters:
7066
vmImageName: ubuntu-latest
7167
jobName: run_test_linux
7268
jobDisplayName: Run Linux tests
7369

74-
- template: runtest.yml
70+
- template: TestsTemplate.yml
7571
parameters:
7672
vmImageName: macos-latest
7773
jobName: run_test_macos

.azdevops/build.yml renamed to .azdevops/ReleaseBuildPipeline.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ stages:
4242
displayName: Build Microsoft.PowerShell.Archive module
4343
4444
- pwsh: |
45-
dir "$(BuildOutDir)\*" -Recurse
45+
Get-ChildItem "$(BuildOutDir)\*" -Recurse | Write-Verbose -Verbose
4646
displayName: Show BuildOutDirectory
4747
4848
- pwsh: |
@@ -99,7 +99,7 @@ stages:
9999
Set-Location "$(Build.SourcesDirectory)"
100100
# signOutPath points to directory with version number -- we want to point to the parent of that directory
101101
$ModulePath = Split-Path $(signOutPath) -Parent
102-
$(Build.SourcesDirectory)/Microsoft.PowerShell.Archive/.azdevops/build.ps1 -package -CopySBOM -signed -SignedPath $ModulePath
102+
$(Build.SourcesDirectory)/Microsoft.PowerShell.Archive/.azdevops/SignAndPackageModule.ps1 -SignedPath $ModulePath
103103
Get-ChildItem -recurse -file -name | Write-Verbose -Verbose
104104
displayName: package build
105105

.azdevops/RunTests.ps1

Lines changed: 5 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1+
# Copyright (c) Microsoft Corporation.
2+
# Licensed under the MIT License.
3+
14
# Load the module
25
$module = Get-Module -Name "Microsoft.PowerShell.Archive"
36
if ($null -ne $module)
@@ -8,7 +11,7 @@ if ($null -ne $module)
811
# Import the built module
912
Import-Module "$env:PIPELINE_WORKSPACE/ModuleBuild/Microsoft.PowerShell.Archive.psd1"
1013

11-
$pesterRequiredVersion = "5.3.3"
14+
$pesterRequiredVersion = "5.3"
1215

1316
# If Pester 5.3.3 is not installed, install it
1417
$shouldInstallPester = $true
@@ -37,11 +40,4 @@ Write-Host "##vso[artifact.upload containerfolder=testResults;artifactname=testR
3740
if(!$results -or $results.FailedCount -gt 0 -or !$results.TotalCount)
3841
{
3942
throw "Build or tests failed. Passed: $($results.PassedCount) Failed: $($results.FailedCount) Total: $($results.TotalCount)"
40-
}
41-
42-
# Unload module
43-
$module = Get-Module -Name "Microsoft.PowerShell.Archive"
44-
if ($null -ne $module)
45-
{
46-
Remove-Module $module
47-
}
43+
}

.azdevops/SignAndPackageModule.ps1

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
# Copyright (c) Microsoft Corporation.
2+
# Licensed under the MIT License.
3+
[CmdletBinding(SupportsShouldProcess=$true)]
4+
param (
5+
[string]$SignedPath
6+
)
7+
8+
9+
$root = (Resolve-Path -Path "${PSScriptRoot}/../")[0]
10+
$Name = "Microsoft.PowerShell.Archive"
11+
$BuildOutputDir = Join-Path $root "\src\bin\Release"
12+
$ManifestPath = "${BuildOutputDir}\${Name}.psd1"
13+
$ManifestData = Import-PowerShellDataFile -Path $ManifestPath
14+
$Version = $ManifestData.ModuleVersion
15+
16+
# this takes the files for the module and publishes them to a created, local repository
17+
# so the nupkg can be used to publish to the PSGallery
18+
function Export-Module
19+
{
20+
[System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("PSAvoidUsingWriteHost", "")]
21+
param()
22+
$packageRoot = $SignedPath
23+
24+
if ( -not (Test-Path $packageRoot)) {
25+
throw "'$PubDir' does not exist"
26+
}
27+
28+
# now constuct a nupkg by registering a local repository and calling publish module
29+
$repoName = [guid]::newGuid().ToString("N")
30+
Register-PSRepository -Name $repoName -SourceLocation $packageRoot -InstallationPolicy Trusted
31+
Publish-Module -Path $packageRoot -Repository $repoName
32+
Unregister-PSRepository -Name $repoName
33+
Get-ChildItem -Recurse -Name $packageRoot | Write-Verbose
34+
$nupkgName = "{0}.{1}-preview1.nupkg" -f ${Name},${Version}
35+
$nupkgPath = Join-Path $packageRoot $nupkgName
36+
if ($env:TF_BUILD) {
37+
# In Azure DevOps
38+
Write-Host "##vso[artifact.upload containerfolder=$nupkgName;artifactname=$nupkgName;]$nupkgPath"
39+
}
40+
}
41+
42+
# The SBOM should already be in -SignedPath, so there is no need to copy it
43+
44+
Export-Module
File renamed without changes.

.azdevops/build.ps1

Lines changed: 0 additions & 105 deletions
This file was deleted.

.travis.yml

Lines changed: 0 additions & 22 deletions
This file was deleted.

SimpleBuild.ps1 renamed to Build.ps1

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1+
# Copyright (c) Microsoft Corporation.
2+
# Licensed under the MIT License.
3+
14
$buildOutputDirectory = "$PSScriptRoot\src\bin\Release"
25

36
if ((Test-Path $buildOutputDirectory)) {
@@ -7,7 +10,7 @@ if ((Test-Path $buildOutputDirectory)) {
710
# Perform dotnet build
811
dotnet build "$PSScriptRoot\src\Microsoft.PowerShell.Archive.csproj" -c Release
912

10-
"Build module location: $buildOutputDirectory" | Write-Verbose -Verbose
13+
"Build module location: $buildOutputDirectory" | Write-Verbose -Verbose
1114

1215
# Get module version
1316
$ManifestData = Import-PowerShellDataFile -Path "$buildOutputDirectory\Microsoft.PowerShell.Archive.psd1"

0 commit comments

Comments
 (0)