|
| 1 | +parameters: |
| 2 | + - name: usePipelineArtifact |
| 3 | + type: boolean |
| 4 | + default: false |
| 5 | + |
1 | 6 | steps: |
2 | | - # Setup |
3 | | - - powershell: | |
4 | | - Write-Host "Installing PowerShell Daily..." |
5 | | -
|
6 | | - # Use `AGENT_TEMPDIRECTORY` to make sure the downloaded PowerShell is cleaned up. |
7 | | - $powerShellPath = Join-Path -Path $env:AGENT_TEMPDIRECTORY -ChildPath 'powershell' |
8 | | - Invoke-WebRequest -Uri https://aka.ms/install-powershell.ps1 -OutFile ./install-powershell.ps1 |
9 | | -
|
10 | | - ./install-powershell.ps1 -Destination $powerShellPath -Daily |
11 | | -
|
12 | | - # Using `prependpath` to update the PATH just for this build. |
13 | | - Write-Host "##vso[task.prependpath]$powerShellPath" |
14 | | - continueOnError: true |
15 | | - displayName: Install PowerShell Daily |
16 | | -
|
17 | | - - pwsh: '$PSVersionTable' |
18 | | - displayName: Display PowerShell version information |
19 | | - |
20 | | - - pwsh: Write-Host "##vso[build.updatebuildnumber]$env:BUILD_SOURCEBRANCHNAME-$env:BUILD_SOURCEVERSION-$((get-date).ToString("yyyyMMddhhmmss"))" |
21 | | - displayName: Set Build Name for Non-PR |
22 | | - condition: ne(variables['Build.Reason'], 'PullRequest') |
23 | | - |
24 | | - # TODO: Use a submodule or some such so we can actually track a version here. |
25 | | - - pwsh: | |
26 | | - git clone https://github.com/PowerShell/PowerShellEditorServices.git ../PowerShellEditorServices |
27 | | - Install-Module InvokeBuild -Scope CurrentUser -Force |
28 | | - Install-Module PlatyPS -Scope CurrentUser -Force |
29 | | - New-Item -ItemType Directory $(Build.ArtifactStagingDirectory)/vscode-powershell |
30 | | -
|
31 | | - # Build |
32 | | - - pwsh: Invoke-Build |
33 | | - |
34 | | - - task: PublishTestResults@2 |
35 | | - inputs: |
36 | | - testRunner: JUnit |
37 | | - testResultsFiles: '**/test-results.xml' |
38 | | - condition: succeededOrFailed() |
39 | | - |
40 | | - - task: PublishBuildArtifacts@1 |
41 | | - inputs: |
42 | | - ArtifactName: vscode-powershell |
43 | | - PathtoPublish: '$(Build.ArtifactStagingDirectory)/vscode-powershell' |
44 | | - |
45 | | - # Rich Navigation |
46 | | - - task: RichCodeNavIndexer@0 |
47 | | - # Note, for now, this is Windows only. |
48 | | - condition: and(succeededOrFailed(), eq(variables['Agent.OS'], 'Windows_NT')) |
49 | | - continueOnError: true |
50 | | - inputs: |
51 | | - serviceConnection: 'rich-nav' |
52 | | - nugetServiceConnection: 'rich-nav-nuget' |
53 | | - githubServiceConnection: 'PowerShell' |
54 | | - languages: 'typescript,csharp' |
55 | | - serviceEndpoint: 'https://prod.richnav.vsengsaas.visualstudio.com' |
| 7 | +- pwsh: $PSVersionTable |
| 8 | + displayName: PowerShell version |
| 9 | + |
| 10 | +- checkout: self |
| 11 | + |
| 12 | +# NOTE: We either checkout the Git repo for PowerShellEditorServices, or we |
| 13 | +# download a pre-built artifact from the triggering pipeline and extract it to |
| 14 | +# the modules folder. In this way we do not accidentally build a release of the |
| 15 | +# server from this pipeline. |
| 16 | +- checkout: PowerShellEditorServices |
| 17 | + condition: not(${{ parameters.usePipelineArtifact }}) |
| 18 | + |
| 19 | +- task: DownloadPipelineArtifact@2 |
| 20 | + condition: ${{ parameters.usePipelineArtifact }} |
| 21 | + displayName: Download PowerShellEditorServices |
| 22 | + inputs: |
| 23 | + source: specific |
| 24 | + project: PowerShellEditorServices |
| 25 | + pipeline: 36 |
| 26 | + preferTriggeringPipeline: true |
| 27 | + allowPartiallySucceededBuilds: true |
| 28 | + artifact: PowerShellEditorServices |
| 29 | + |
| 30 | +- task: ExtractFiles@1 |
| 31 | + condition: ${{ parameters.usePipelineArtifact }} |
| 32 | + displayName: Extract PowerShellEditorServices module |
| 33 | + inputs: |
| 34 | + archiveFilePatterns: $(Pipeline.Workspace)/PowerShellEditorServices.zip |
| 35 | + destinationFolder: $(Build.SourcesDirectory)/vscode-powershell/modules |
| 36 | + |
| 37 | +- pwsh: | |
| 38 | + Install-Module InvokeBuild -Scope CurrentUser -Force |
| 39 | + Invoke-Build |
| 40 | + Write-Host "##vso[task.setvariable variable=vsixPath]$(Resolve-Path powershell-*.vsix)" |
| 41 | + displayName: Build and test |
| 42 | + workingDirectory: $(Build.SourcesDirectory)/vscode-powershell |
| 43 | + |
| 44 | +- publish: $(vsixPath) |
| 45 | + artifact: vscode-powershell-vsix-$(System.JobId) |
| 46 | + displayName: Publish extension artifact |
| 47 | + |
| 48 | +- publish: $(Build.SourcesDirectory)/vscode-powershell/scripts/Install-VSCode.ps1 |
| 49 | + artifact: vscode-powershell-unsigned-script-$(System.JobId) |
| 50 | + displayName: Publish unsigned script artifact |
| 51 | + |
| 52 | +- task: PublishTestResults@2 |
| 53 | + displayName: Publish test results |
| 54 | + inputs: |
| 55 | + testRunner: JUnit |
| 56 | + testResultsFiles: '**/test-results.xml' |
| 57 | + condition: succeededOrFailed() |
0 commit comments