Skip to content

Commit ff4fc51

Browse files
committed
Test GitHub Actions for CI
1 parent cddc961 commit ff4fc51

File tree

5 files changed

+103
-46
lines changed

5 files changed

+103
-46
lines changed

.github/workflows/ci-test.yml

+71
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,71 @@
1+
name: CI Tests
2+
3+
on:
4+
push:
5+
branches: [ main ]
6+
pull_request:
7+
# The branches below must be a subset of the branches above
8+
branches: [ main ]
9+
paths-ignore: [ '**/*.md' ]
10+
merge_group:
11+
types: [ checks_requested ]
12+
13+
jobs:
14+
os_matrix:
15+
strategy:
16+
matrix:
17+
os: [ windows-latest, macos-latest, ubuntu-latest ]
18+
runs-on: ${{ matrix.os }}
19+
env:
20+
DOTNET_NOLOGO: true
21+
DOTNET_CLI_TELEMETRY_OPTOUT: true
22+
DOTNET_GENERATE_ASPNET_CERTIFICATE: false
23+
DISPLAY: ':99.0'
24+
defaults:
25+
run:
26+
shell: pwsh
27+
working-directory: vscode-powershell
28+
steps:
29+
- name: Checkout PowerShellEditorServices
30+
uses: actions/checkout@v4
31+
with:
32+
repository: PowerShell/PowerShellEditorServices
33+
path: PowerShellEditorServices
34+
ref: andyleejordan/github-ci
35+
- name: Checkout vscode-powershell
36+
uses: actions/checkout@v4
37+
with:
38+
path: vscode-powershell
39+
- name: Install dotnet
40+
uses: actions/setup-dotnet@v4
41+
with:
42+
cache: true
43+
cache-dependency-path: PowerShellEditorServices/src/PowerShellEditorServices/packages.lock.json
44+
dotnet-version: |
45+
6.0.x
46+
7.0.x
47+
- name: Install PSResources
48+
run: ../PowerShellEditorServices/tools/installPSResources.ps1
49+
- uses: actions/setup-node@v4
50+
with:
51+
node-version: 18
52+
cache: npm
53+
cache-dependency-path: vscode-powershell/package-lock.json
54+
- name: Start X virtual framebuffer
55+
if: matrix.os == 'ubuntu-latest'
56+
shell: bash
57+
run: /usr/bin/Xvfb :99 -screen 0 1024x768x24 > /dev/null 2>&1 &
58+
- name: Build, test and package
59+
run: Invoke-Build
60+
- name: Upload build artifacts
61+
uses: actions/upload-artifact@v3
62+
if: always()
63+
with:
64+
name: vscode-powershell-vsix-${{ matrix.os }}
65+
path: vscode-powershell/powershell-*.vsix
66+
- name: Upload test results
67+
uses: actions/upload-artifact@v3
68+
if: always()
69+
with:
70+
name: vscode-powershell-test-results-${{ matrix.os }}
71+
path: '**/test-results.xml'

.vsts-ci/azure-pipelines-ci.yml

+11-28
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,22 @@
11
name: CI-$(Build.SourceBranchName)-$(Date:yyyyMMdd)$(Rev:.rr)
22

3+
pr: none
4+
35
trigger:
4-
- gh-readonly-queue/main/*
5-
pr:
6-
paths:
7-
exclude:
8-
- '**/*.md'
6+
branches:
7+
include:
8+
- release
99

1010
variables:
1111
# Don't download unneeded packages
12-
- name: DOTNET_SKIP_FIRST_TIME_EXPERIENCE
12+
- name: DOTNET_NOLOGO
1313
value: 'true'
1414
# Improve performance by not sending telemetry
1515
- name: DOTNET_CLI_TELEMETRY_OPTOUT
1616
value: 'true'
17+
# Improve performance by not generating certificates
18+
- name: DOTNET_GENERATE_ASPNET_CERTIFICATE
19+
value: 'false'
1720

1821
resources:
1922
repositories:
@@ -25,34 +28,14 @@ resources:
2528

2629
jobs:
2730
- job: windows2022
28-
displayName: Windows 2022 PowerShell 5.1
29-
pool:
30-
vmImage: windows-2022
31-
steps:
32-
- template: templates/ci-general.yml
33-
parameters:
34-
pwsh: false
35-
continueOnError: true
36-
37-
- job: windows2022pwsh
38-
displayName: Windows 2022 PowerShell 7
31+
displayName: Windows 2022
3932
pool:
4033
vmImage: windows-2022
4134
steps:
4235
- template: templates/ci-general.yml
4336

4437
- job: windows2019
45-
displayName: Windows 2019 PowerShell 5.1
46-
pool:
47-
vmImage: windows-2019
48-
steps:
49-
- template: templates/ci-general.yml
50-
parameters:
51-
pwsh: false
52-
continueOnError: true
53-
54-
- job: windows2019pwsh
55-
displayName: Windows 2019 PowerShell 7
38+
displayName: Windows 2019
5639
pool:
5740
vmImage: windows-2019
5841
steps:

.vsts-ci/templates/ci-general.yml

+10-16
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,4 @@
11
parameters:
2-
- name: pwsh
3-
type: boolean
4-
default: true
52
- name: usePipelineArtifact
63
type: boolean
74
default: false
@@ -34,11 +31,6 @@ steps:
3431
archiveFilePatterns: $(Pipeline.Workspace)/PowerShellEditorServices.zip
3532
destinationFolder: $(Build.SourcesDirectory)/vscode-powershell/modules
3633

37-
- task: NodeTool@0
38-
displayName: Install Node.js
39-
inputs:
40-
versionSpec: 16.x
41-
4234
- task: UseDotNet@2
4335
condition: not(${{ parameters.usePipelineArtifact }})
4436
displayName: Install .NET 7.0.x SDK
@@ -55,53 +47,55 @@ steps:
5547
version: 6.0.x
5648
performMultiLevelLookup: true
5749

58-
# The build script is always run with PowerShell Core
50+
- task: UseNode@1
51+
inputs:
52+
version: 18.x
53+
54+
# We don't just use installPSResources.ps1 because we haven't always cloned PowerShellEditorServices
5955
- task: PowerShell@2
6056
displayName: Build and package
6157
inputs:
6258
targetType: inline
59+
pwsh: true
6360
script: |
64-
Install-Module InvokeBuild -Scope CurrentUser -Force
65-
Install-Module platyPS -Scope CurrentUser -Force
61+
Install-Module -Name InvokeBuild -Scope CurrentUser -Force
62+
Install-Module -Name platyPS -Scope CurrentUser
6663
Invoke-Build -Configuration Release Package
6764
$PackageJson = Get-Content -Raw package.json | ConvertFrom-Json
6865
Write-Host "##vso[task.setvariable variable=vsixPath]$(Resolve-Path powershell-$($PackageJson.version).vsix)"
6966
workingDirectory: $(Build.SourcesDirectory)/vscode-powershell
70-
pwsh: true
7167

7268
# Necessary on Linux to run VS Code unit tests
7369
- bash: |
7470
/usr/bin/Xvfb :99 -screen 0 1024x768x24 > /dev/null 2>&1 &
7571
displayName: Start X virtual framebuffer
7672
condition: and(succeeded(), eq(variables['Agent.OS'], 'Linux'))
7773

78-
# Tests in particular are run with either PowerShell Core or Windows PowerShell
7974
- task: PowerShell@2
8075
displayName: Run unit tests
8176
inputs:
8277
targetType: inline
78+
pwsh: true
8379
script: |
8480
$PSVersionTable
8581
Get-ChildItem env:
8682
Get-Module -ListAvailable Pester
87-
Install-Module InvokeBuild -Scope CurrentUser -Force
8883
Invoke-Build -Configuration Release Test
8984
workingDirectory: $(Build.SourcesDirectory)/vscode-powershell
90-
pwsh: ${{ parameters.pwsh }}
9185
env:
9286
DISPLAY: ':99.0'
9387

9488
- task: PowerShell@2
9589
displayName: Assert PowerShellEditorServices release configuration
9690
inputs:
9791
targetType: inline
92+
pwsh: true
9893
script: |
9994
$assembly = [Reflection.Assembly]::LoadFile('$(Build.SourcesDirectory)/vscode-powershell/modules/PowerShellEditorServices.VSCode/bin/Microsoft.PowerShell.EditorServices.VSCode.dll')
10095
if ($assembly.GetCustomAttributes([System.Diagnostics.DebuggableAttribute], $true).IsJITOptimizerDisabled) {
10196
Write-Host '##vso[task.LogIssue type=error;]PowerShell Editor Services bits were not built in release configuration!'
10297
exit 1
10398
}
104-
pwsh: true
10599
106100
- publish: $(vsixPath)
107101
artifact: vscode-powershell-vsix-$(System.JobId)

docs/development.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
3. Follow the [development instructions](https://github.com/PowerShell/PowerShellEditorServices#development) for
1313
PowerShell Editor Services. **You will need to complete this step before proceeding**.
1414

15-
4. Install [Node.js](https://nodejs.org/en/) 16.x or higher.
15+
4. Install [Node.js](https://nodejs.org/en/) 18.x or higher.
1616

1717
5. Install [Visual Studio Code](https://code.visualstudio.com).
1818
Open the multi-root workspace file in this repo, `extension-dev.code-workspace`.

vscode-powershell.build.ps1

+10-1
Original file line numberDiff line numberDiff line change
@@ -133,7 +133,16 @@ task Package Build, {
133133
Assert-Build ($packageJson.version -eq $packageVersion)
134134

135135
Write-Host "`n### Packaging powershell-$packageVersion.vsix`n" -ForegroundColor Green
136-
Assert-Build ((Get-Item ./modules).LinkType -ne "SymbolicLink") "Packaging requires a copy of PSES, not a symlink!"
136+
137+
# Packaging requires a copy of the modules folder, not a symbolic link. But
138+
# we might have built in Debug configuration, not Release, and still want to
139+
# package it. So delete the symlink and copy what we just built.
140+
if ((Get-Item ./modules -ErrorAction SilentlyContinue).LinkType -eq "SymbolicLink") {
141+
Write-Host "`n### PSES is a symbolic link, replacing with copy!" -ForegroundColor Green
142+
Remove-BuildItem ./modules
143+
Copy-Item -Recurse -Force "$(Split-Path (Get-EditorServicesPath))/module" ./modules
144+
}
145+
137146
if (Test-IsPreRelease) {
138147
Write-Host "`n### This is a pre-release!`n" -ForegroundColor Green
139148
Invoke-BuildExec { & npm run package -- --pre-release }

0 commit comments

Comments
 (0)