Skip to content

Commit 77ea586

Browse files
committed
Test GitHub Actions for CI
1 parent 040518b commit 77ea586

File tree

6 files changed

+119
-55
lines changed

6 files changed

+119
-55
lines changed

.github/workflows/ci-test.yml

+79
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,79 @@
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+
ci:
15+
name: node
16+
strategy:
17+
matrix:
18+
os: [ windows-latest, macos-latest, ubuntu-latest ]
19+
runs-on: ${{ matrix.os }}
20+
env:
21+
DOTNET_NOLOGO: true
22+
DOTNET_CLI_TELEMETRY_OPTOUT: true
23+
DOTNET_GENERATE_ASPNET_CERTIFICATE: false
24+
DISPLAY: ':99.0'
25+
defaults:
26+
run:
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+
35+
- name: Checkout vscode-powershell
36+
uses: actions/checkout@v4
37+
with:
38+
path: vscode-powershell
39+
40+
- name: Install dotnet
41+
uses: actions/setup-dotnet@v4
42+
with:
43+
cache: true
44+
cache-dependency-path: 'PowerShellEditorServices/**/packages.lock.json'
45+
dotnet-version: |
46+
6.0.x
47+
7.0.x
48+
49+
- name: Install PSResources
50+
shell: pwsh
51+
run: ../PowerShellEditorServices/tools/installPSResources.ps1
52+
53+
- uses: actions/setup-node@v4
54+
with:
55+
node-version: 18
56+
cache: npm
57+
cache-dependency-path: vscode-powershell/package-lock.json
58+
59+
- name: Start X virtual framebuffer
60+
if: matrix.os == 'ubuntu-latest'
61+
run: /usr/bin/Xvfb :99 -screen 0 1024x768x24 > /dev/null 2>&1 &
62+
63+
- name: Build, test and package
64+
shell: pwsh
65+
run: Invoke-Build
66+
67+
- name: Upload build artifacts
68+
uses: actions/upload-artifact@v3
69+
if: always()
70+
with:
71+
name: vscode-powershell-vsix-${{ matrix.os }}
72+
path: vscode-powershell/powershell-*.vsix
73+
74+
- name: Upload test results
75+
uses: actions/upload-artifact@v3
76+
if: always()
77+
with:
78+
name: vscode-powershell-test-results-${{ matrix.os }}
79+
path: '**/test-results.xml'

.github/workflows/codeql-analysis.yml

+8-9
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
name: Run CodeQL Analysis
1+
name: CodeQL Analysis
22

33
on:
44
push:
@@ -15,23 +15,20 @@ on:
1515

1616
jobs:
1717
analyze:
18-
name: Analyze
18+
name: analyze
19+
strategy:
20+
fail-fast: false
21+
matrix:
22+
language: [ typescript ]
1923
runs-on: ubuntu-latest
2024
permissions:
2125
actions: read
2226
contents: read
2327
security-events: write
24-
25-
strategy:
26-
fail-fast: false
27-
matrix:
28-
language: [ 'typescript' ]
29-
3028
steps:
3129
- name: Checkout repository
3230
uses: actions/checkout@v4
3331

34-
# Initializes the CodeQL tools for scanning.
3532
- name: Initialize CodeQL
3633
uses: github/codeql-action/init@v2
3734
with:
@@ -42,3 +39,5 @@ jobs:
4239

4340
- name: Perform CodeQL Analysis
4441
uses: github/codeql-action/analyze@v2
42+
with:
43+
category: '/language:${{matrix.language}}'

.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 -Force
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)