Skip to content

Commit 22a23fa

Browse files
committed
added v1 build scripts and yaml files
1 parent 3480150 commit 22a23fa

File tree

6 files changed

+249
-0
lines changed

6 files changed

+249
-0
lines changed

Archive_v1/.azdevops/CI.yml

Lines changed: 77 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,77 @@
1+
name: $(BuildDefinitionName)_$(date:yyMM).$(date:dd)$(rev:rrr)
2+
3+
trigger: none
4+
5+
resources:
6+
repositories:
7+
- repository: ComplianceRepo
8+
type: github
9+
endpoint: ComplianceGHRepo
10+
name: PowerShell/compliance
11+
12+
variables:
13+
- name: PackageName
14+
value: 'Microsoft.PowerShell.Archive'
15+
- name: PackageVersion
16+
value: ''
17+
- name: BuildOutDir
18+
value: ''
19+
20+
stages:
21+
- stage: Build
22+
displayName: Build module
23+
pool:
24+
vmImage: windows-2019
25+
jobs:
26+
- job: BuildPkg
27+
displayName: Build module
28+
steps:
29+
30+
- pwsh: |
31+
& $(Build.SourcesDirectory)\SimpleBuild.ps1
32+
displayName: Build Microsoft.PowerShell.Archive module
33+
condition: succeededOrFailed()
34+
35+
- pwsh: |
36+
dir "$(BuildOutDir)\*" -Recurse
37+
displayName: Show BuildOutDirectory
38+
39+
- template: Sbom.yml@ComplianceRepo
40+
parameters:
41+
BuildDropPath: "$(BuildOutDir)"
42+
Build_Repository_Uri: 'https://github.com/PowerShell/Microsoft.PowerShell.Archive'
43+
PackageName: $(PackageName)
44+
PackageVersion: $(PackageVersion)
45+
46+
- pwsh: |
47+
dir "$(BuildOutDir)\*" -Recurse
48+
displayName: Show BuildOutDirectory
49+
50+
- pwsh: |
51+
$signSrcPath = "$(BuildOutDir)"
52+
# Set signing src path variable
53+
$vstsCommandString = "vso[task.setvariable variable=signSrcPath]${signSrcPath}"
54+
Write-Host "sending " + $vstsCommandString
55+
Write-Host "##$vstsCommandString"
56+
$signOutPath = "$(Build.SourcesDirectory)\signed\Microsoft.PowerShell.Archive"
57+
$null = New-Item -ItemType Directory -Path $signOutPath
58+
# Set signing out path variable
59+
$vstsCommandString = "vso[task.setvariable variable=signOutPath]${signOutPath}"
60+
Write-Host "sending " + $vstsCommandString
61+
Write-Host "##$vstsCommandString"
62+
# Set path variable for guardian codesign validation
63+
$vstsCommandString = "vso[task.setvariable variable=GDN_CODESIGN_TARGETDIRECTORY]${signOutPath}"
64+
Write-Host "sending " + $vstsCommandString
65+
Write-Host "##$vstsCommandString"
66+
displayName: Setup variables for signing
67+
68+
- pwsh: |
69+
Copy-Item -Path "$(signSrcPath)\*" -Destination "$(signOutPath)"
70+
displayName: Fake Signing
71+
72+
- pwsh: |
73+
Compress-Archive -Path "$(signOutPath)\*" -DestinationPath "$(System.ArtifactsDirectory)\Microsoft.PowerShell.Archive.zip"
74+
displayName: Create Microsoft.PowerShell.Archive.zip
75+
76+
- publish: $(System.ArtifactsDirectory)\Microsoft.PowerShell.Archive.zip
77+
artifact: SignedModule

Archive_v1/.travis.yml

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
language: csharp
2+
3+
git:
4+
depth: 1000
5+
6+
os:
7+
- linux
8+
sudo: required
9+
dist: trusty
10+
11+
matrix:
12+
fast_finish: true
13+
14+
install:
15+
- git clone https://github.com/PowerShell/PowerShell.git
16+
- pushd PowerShell/tools
17+
- ./install-powershell.sh
18+
- popd
19+
20+
script:
21+
- ulimit -n 4096
22+
- pwsh -File ./TravisCI.ps1

Archive_v1/SimpleBuild.ps1

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
if ((Test-Path "$PSScriptRoot\out")) {
2+
Remove-Item -Path $PSScriptRoot\out -Recurse -Force
3+
}
4+
5+
New-Item -ItemType directory -Path $PSScriptRoot\out | Out-Null
6+
New-Item -ItemType directory -Path $PSScriptRoot\out\Microsoft.PowerShell.Archive | Out-Null
7+
8+
$OutPath = Join-Path $PSScriptRoot "out"
9+
$OutModulePath = Join-Path $OutPath "Microsoft.PowerShell.Archive"
10+
11+
Copy-Item -Recurse -Path "$PSScriptRoot\Microsoft.PowerShell.Archive" -Destination $OutPath -Force
12+
13+
"Build module location: $OutModulePath" | Write-Verbose -Verbose
14+
15+
"Setting VSTS variable 'BuildOutDir' to '$OutModulePath'" | Write-Verbose -Verbose
16+
Write-Host "##vso[task.setvariable variable=BuildOutDir]$OutModulePath"
17+
18+
$psd1ModuleVersion = (Get-Content -Path "$OutModulePath\Microsoft.PowerShell.Archive.psd1" | Select-String 'ModuleVersion="(.*)"').Matches[0].Groups[1].Value
19+
"Setting VSTS variable 'PackageVersion' to '$psd1ModuleVersion'" | Write-Verbose -Verbose
20+
Write-Host "##vso[task.setvariable variable=PackageVersion]$psd1ModuleVersion"

Archive_v1/TravisCI.ps1

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
$testResultsFile = "./ArchiveTestResults.xml"
2+
Import-Module "./Microsoft.PowerShell.Archive/Microsoft.PowerShell.Archive.psd1" -Force
3+
$testResults = Invoke-Pester -Script "./Tests" -OutputFormat NUnitXml -OutputFile $testResultsFile -PassThru
4+
if ($testResults.FailedCount -gt 0) {
5+
throw "$($testResults.FailedCount) tests failed."
6+
}

Archive_v1/appveyor.yml

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
# Image with WMF5.0 RTM
2+
os: "WMF 5"
3+
4+
# clone directory
5+
clone_folder: c:\projects\Archive-Module
6+
7+
# Install Pester
8+
install:
9+
- cinst -y pester
10+
11+
build: false
12+
13+
# Run Pester tests and store the results
14+
test_script:
15+
- ps: |
16+
$testResultsFile = ".\ArchiveTestResults.xml"
17+
Import-Module "C:\projects\Archive-Module\Microsoft.PowerShell.Archive" -Force
18+
$testResults = Invoke-Pester -Script "C:\projects\Archive-Module\Tests" -OutputFormat NUnitXml -OutputFile $testResultsFile -PassThru
19+
(New-Object 'System.Net.WebClient').UploadFile("https://ci.appveyor.com/api/testresults/nunit/$($env:APPVEYOR_JOB_ID)", (Resolve-Path $testResultsFile))
20+
if ($testResults.FailedCount -gt 0) {
21+
throw "$($testResults.FailedCount) tests failed."
22+
}
Lines changed: 102 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,102 @@
1+
name: $(BuildDefinitionName)_$(date:yyMM).$(date:dd)$(rev:rrr)
2+
3+
trigger: none
4+
5+
resources:
6+
repositories:
7+
- repository: ComplianceRepo
8+
type: github
9+
endpoint: ComplianceGHRepo
10+
name: PowerShell/compliance
11+
12+
variables:
13+
- name: PackageName
14+
value: 'Microsoft.PowerShell.Archive'
15+
- name: PackageVersion
16+
value: ''
17+
- name: BuildOutDir
18+
value: ''
19+
20+
stages:
21+
- stage: Build
22+
displayName: Build module
23+
pool:
24+
name: 1ES
25+
demands:
26+
- ImageOverride -equals PSMMS2019-Secure
27+
jobs:
28+
- job: BuildPkg
29+
displayName: Build module
30+
variables:
31+
- group: ESRP
32+
steps:
33+
34+
- pwsh: |
35+
& $(Build.SourcesDirectory)\SimpleBuild.ps1
36+
displayName: Build Microsoft.PowerShell.Archive module
37+
condition: succeededOrFailed()
38+
39+
- pwsh: |
40+
dir "$(BuildOutDir)\*" -Recurse
41+
displayName: Show BuildOutDirectory
42+
43+
- template: Sbom.yml@ComplianceRepo
44+
parameters:
45+
BuildDropPath: "$(BuildOutDir)"
46+
Build_Repository_Uri: 'https://github.com/PowerShell/Microsoft.PowerShell.Archive'
47+
PackageName: $(PackageName)
48+
PackageVersion: $(PackageVersion)
49+
50+
- pwsh: |
51+
dir "$(BuildOutDir)\*" -Recurse
52+
displayName: Show BuildOutDirectory
53+
54+
- pwsh: |
55+
$signSrcPath = "$(BuildOutDir)"
56+
# Set signing src path variable
57+
$vstsCommandString = "vso[task.setvariable variable=signSrcPath]${signSrcPath}"
58+
Write-Host "sending " + $vstsCommandString
59+
Write-Host "##$vstsCommandString"
60+
$signOutPath = "$(Build.SourcesDirectory)\signed\Microsoft.PowerShell.Archive"
61+
$null = New-Item -ItemType Directory -Path $signOutPath
62+
# Set signing out path variable
63+
$vstsCommandString = "vso[task.setvariable variable=signOutPath]${signOutPath}"
64+
Write-Host "sending " + $vstsCommandString
65+
Write-Host "##$vstsCommandString"
66+
# Set path variable for guardian codesign validation
67+
$vstsCommandString = "vso[task.setvariable variable=GDN_CODESIGN_TARGETDIRECTORY]${signOutPath}"
68+
Write-Host "sending " + $vstsCommandString
69+
Write-Host "##$vstsCommandString"
70+
displayName: Setup variables for signing
71+
72+
- template: EsrpSign.yml@ComplianceRepo
73+
parameters:
74+
# the folder which contains the binaries to sign
75+
buildOutputPath: $(signSrcPath)
76+
# the location to put the signed output
77+
signOutputPath: $(signOutPath)
78+
# the certificate ID to use
79+
certificateId: "CP-230012"
80+
# the file pattern to use, comma separated
81+
pattern: '*.psd1,*.psm1'
82+
83+
- pwsh: |
84+
Compress-Archive -Path "$(signOutPath)\*" -DestinationPath "$(System.ArtifactsDirectory)\Microsoft.PowerShell.Archive.zip"
85+
displayName: Create Microsoft.PowerShell.Archive.zip
86+
87+
- publish: $(System.ArtifactsDirectory)\Microsoft.PowerShell.Archive.zip
88+
artifact: SignedModule
89+
90+
- template: script-module-compliance.yml@ComplianceRepo
91+
parameters:
92+
# component-governance
93+
sourceScanPath: '$(signOutPath)'
94+
# credscan
95+
suppressionsFile: ''
96+
# TermCheck
97+
optionsRulesDBPath: ''
98+
optionsFTPath: ''
99+
# tsa-upload
100+
codeBaseName: 'Microsoft_PowerShell_Archive_2_15_2022'
101+
# selections
102+
APIScan: false # set to false when not using Windows APIs.

0 commit comments

Comments
 (0)