Skip to content

Commit d1c5e1a

Browse files
committed
Centralized Module Loading to PowerShellContextService.cs
1 parent 93d4524 commit d1c5e1a

File tree

66 files changed

+529
-538
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

66 files changed

+529
-538
lines changed

.editorconfig

+27
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,33 @@ trim_trailing_whitespace = true
1313
csharp_space_before_open_square_brackets = true
1414
csharp_space_after_keywords_in_control_flow_statements = true
1515

16+
# CS0168: The variable 'var' is declared but never used
17+
dotnet_diagnostic.CS0168.severity = error
18+
# CS0169: The private field 'class member' is never used
19+
dotnet_diagnostic.CS0169.severity = error
20+
# CS0219: The variable 'variable' is assigned but its value is never used
21+
dotnet_diagnostic.CS0219.severity = error
22+
# CS0414: The private field 'field' is assigned but its value is never used
23+
dotnet_diagnostic.CS0414.severity = error
24+
# CA1068: CancellationToken parameters must come last
25+
dotnet_diagnostic.CA1068.severity = error
26+
# CA1822: Mark members as static
27+
dotnet_diagnostic.CA1822.severity = error
28+
# CA1823: Avoid unused private fields
29+
dotnet_diagnostic.CA1823.severity = error
30+
# CA2007: Do not directly await a Task
31+
dotnet_diagnostic.CA2007.severity = error
32+
# CA2016: Forward the CancellationToken parameter to methods that take one
33+
dotnet_diagnostic.CA2016.severity = error
34+
# All maintainability issues (dead code etc.)
35+
# See: https://docs.microsoft.com/en-us/dotnet/fundamentals/code-analysis/quality-rules/maintainability-warnings
36+
dotnet_analyzer_diagnostic.category-Maintainability.severity = error
37+
# VSTHRD002: Synchronously waiting on tasks or awaiters may cause deadlocks
38+
# TODO: Fix all of these issues and explicitly ignore the intentional ones.
39+
dotnet_diagnostic.VSTHRD002.severity = silent
40+
# VSTHRD200: Use "Async" suffix for awaitable methods
41+
dotnet_diagnostic.VSTHRD200.severity = silent
42+
1643
[*.{json}]
1744
indent_size = 2
1845
trim_trailing_whitespace = true

.github/CODEOWNERS

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
# https://help.github.com/articles/about-codeowners/
22

33
# Global reviewers
4-
* @tylerl0706 @rjmholt
4+
* @andschwa @rjmholt
55

66
# Area: Analysis & Formatting
77
src/PowerShellEditorServices/Analysis/ @rjmholt

.github/workflows/codeql-analysis.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ jobs:
3737

3838
- name: Build
3939
shell: pwsh
40-
run: scripts/azurePipelinesBuild.ps1
40+
run: tools/azurePipelinesBuild.ps1
4141

4242
- name: Perform CodeQL Analysis
4343
uses: github/codeql-action/analyze@v1

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

+24-33
Original file line numberDiff line numberDiff line change
@@ -9,58 +9,49 @@ variables:
99
value: 'true'
1010

1111
trigger:
12-
batch: true
1312
branches:
1413
include:
1514
- master
16-
- legacy/1.x
17-
paths:
18-
exclude:
19-
- /.dependabot/*
20-
- /.poshchan/*
21-
- /.github/**/*
22-
- /.vscode/**/*
23-
- /.vsts-ci/misc-analysis.yml
24-
- /tools/**/*
25-
- .editorconfig
26-
- .gitattributes
27-
- .gitignore
28-
- /docs/**/*
29-
- /CHANGELOG.md
30-
- /CONTRIBUTING.md
31-
- /README.md
32-
- /LICENSE
33-
- /CODE_OF_CONDUCT.md
3415

35-
# TODO: Setup matrix of image support.
16+
pr:
17+
- master
18+
3619
jobs:
37-
- job: 'PS51_Win10'
38-
displayName: PowerShell 5.1 | Windows 10
20+
- job: PS51_Win2016
21+
displayName: PowerShell 5.1 - Windows Server 2016
22+
pool:
23+
vmImage: vs2017-win2016
24+
steps:
25+
- template: templates/ci-general.yml
26+
parameters:
27+
pwsh: false
28+
29+
- job: PS51_Win2019
30+
displayName: PowerShell 5.1 - Windows Server 2019
3931
pool:
40-
# TODO: Update this image.
41-
vmImage: 'vs2017-win2016'
32+
vmImage: windows-2019
4233
steps:
4334
- template: templates/ci-general.yml
4435
parameters:
4536
pwsh: false
4637

47-
- job: 'PS7_Win10'
48-
displayName: PowerShell 7 | Windows 10
38+
- job: PS7_Win2019
39+
displayName: PowerShell 7 - Windows Server 2019
4940
pool:
50-
vmImage: 'windows-2019'
41+
vmImage: windows-2019
5142
steps:
5243
- template: templates/ci-general.yml
5344

54-
- job: 'PS7_macOS'
55-
displayName: PowerShell 7 | macOS
45+
- job: PS7_macOS
46+
displayName: PowerShell 7 - macOS 10.15
5647
pool:
57-
vmImage: 'macOS-10.15'
48+
vmImage: macOS-10.15
5849
steps:
5950
- template: templates/ci-general.yml
6051

61-
- job: 'PS7_Ubuntu'
62-
displayName: PowerShell 7 | Ubuntu
52+
- job: PS7_Ubuntu
53+
displayName: PowerShell 7 - Ubuntu 20.04
6354
pool:
64-
vmImage: 'ubuntu-20.04'
55+
vmImage: ubuntu-20.04
6556
steps:
6657
- template: templates/ci-general.yml

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

+42-22
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
name: Release-$(Build.SourceBranchName)-$(Date:yyyyMMdd)$(Rev:.rr)
2+
13
variables:
24
# Don't download unneeded packages
35
- name: DOTNET_SKIP_FIRST_TIME_EXPERIENCE
@@ -9,33 +11,51 @@ variables:
911
trigger:
1012
branches:
1113
include:
12-
- release/*
13-
tags:
14-
include:
15-
- v*
14+
- release
1615

1716
resources:
1817
repositories:
1918
- repository: ComplianceRepo
2019
type: github
21-
endpoint: ComplianceGHRepo
20+
endpoint: GitHub
2221
name: PowerShell/compliance
22+
- repository: vscode-powershell
23+
type: git
24+
name: vscode-powershell
25+
26+
stages:
27+
- stage: Build
28+
displayName: Build the release
29+
jobs:
30+
- job: Build
31+
pool:
32+
vmImage: windows-2019
33+
steps:
34+
- template: templates/ci-general.yml
2335

24-
jobs:
25-
- job: 'ReleaseBuild'
26-
displayName: 'Build release'
27-
pool:
28-
vmImage: 'vs2017-win2016'
29-
steps:
30-
- template: templates/ci-general.yml
36+
- stage: Sign
37+
displayName: Sign the release
38+
jobs:
39+
- job: Sign
40+
pool:
41+
name: 1ES
42+
demands: ImageOverride -equals MMS2019
43+
variables:
44+
- group: ESRP
45+
steps:
46+
- template: templates/release-general.yml
3147

32-
- job: 'SignBuild'
33-
displayName: Signing Build
34-
dependsOn: 'ReleaseBuild'
35-
pool:
36-
name: '1ES'
37-
demands: ImageOverride -equals MMS2019
38-
variables:
39-
- group: ESRP
40-
steps:
41-
- template: templates/release-general.yml
48+
- stage: Publish
49+
displayName: Publish the draft release
50+
jobs:
51+
- deployment: Publish
52+
environment: PowerShellEditorServices
53+
pool:
54+
vmImage: ubuntu-latest
55+
variables:
56+
- group: Publish
57+
strategy:
58+
runOnce:
59+
deploy:
60+
steps:
61+
- template: templates/publish-general.yml

.vsts-ci/misc-analysis.yml

+4-10
Original file line numberDiff line numberDiff line change
@@ -1,31 +1,25 @@
11
name: PR-$(System.PullRequest.PullRequestNumber)-$(Date:yyyyMMdd)$(Rev:.rr)
2+
23
trigger:
3-
# Batch merge builds together while a merge build is running
4-
batch: true
54
branches:
65
include:
76
- master
87

98
pr:
10-
branches:
11-
include:
12-
- master
13-
- legacy/1.x
9+
- master
1410

1511
resources:
1612
repositories:
1713
- repository: ComplianceRepo
1814
type: github
19-
endpoint: ComplianceGHRepo
15+
endpoint: GitHub
2016
name: PowerShell/compliance
2117

2218
jobs:
23-
- job: Compliance_Job
19+
- job: Compliance
2420
pool:
2521
vmImage: windows-latest
2622
steps:
2723
- checkout: self
28-
clean: true
2924
- checkout: ComplianceRepo
30-
clean: true
3125
- template: ci-compliance.yml@ComplianceRepo

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

+29-36
Original file line numberDiff line numberDiff line change
@@ -1,43 +1,36 @@
11
parameters:
2-
pwsh: true
2+
- name: pwsh
3+
type: boolean
4+
default: true
35

46
steps:
5-
- powershell: |
6-
Write-Host "Installing PowerShell Daily..."
7+
- pwsh: $PSVersionTable
8+
displayName: PowerShell version
79

8-
# Use `AGENT_TEMPDIRECTORY` to make sure the downloaded PowerShell is cleaned up.
9-
$powerShellPath = Join-Path -Path $env:AGENT_TEMPDIRECTORY -ChildPath 'powershell'
10-
Invoke-WebRequest -Uri https://aka.ms/install-powershell.ps1 -OutFile ./install-powershell.ps1
10+
- task: PowerShell@2
11+
displayName: Build and test
12+
inputs:
13+
filePath: tools/azurePipelinesBuild.ps1
14+
pwsh: ${{ parameters.pwsh }}
1115

12-
./install-powershell.ps1 -Destination $powerShellPath -Daily
16+
# NOTE: We zip the artifacts because they're ~20 MB compressed, but ~300 MB raw,
17+
# and we have limited pipeline artifact storage space.
18+
- task: ArchiveFiles@2
19+
displayName: Zip pipeline artifacts
20+
inputs:
21+
rootFolderOrFile: module
22+
includeRootFolder: false
23+
archiveType: zip
24+
archiveFile: PowerShellEditorServices-Build.zip
25+
verbose: true
1326

14-
# Using `prependpath` to update the PATH just for this build.
15-
Write-Host "##vso[task.prependpath]$powerShellPath"
16-
displayName: Install PowerShell Daily
17-
continueOnError: true
27+
- publish: PowerShellEditorServices-Build.zip
28+
artifact: PowerShellEditorServices-Build-$(System.JobId)
29+
displayName: Publish unsigned pipeline artifacts
1830

19-
- pwsh: '$PSVersionTable'
20-
displayName: Display PowerShell version information
21-
22-
- pwsh: Write-Host "##vso[build.updatebuildnumber]$env:BUILD_SOURCEBRANCHNAME-$env:BUILD_SOURCEVERSION-$((get-date).ToString("yyyyMMddhhmmss"))"
23-
displayName: Set Build Name for Non-PR
24-
condition: ne(variables['Build.Reason'], 'PullRequest')
25-
- task: PowerShell@2
26-
inputs:
27-
filePath: scripts/azurePipelinesBuild.ps1
28-
pwsh: ${{ parameters.pwsh }}
29-
- task: PublishTestResults@2
30-
inputs:
31-
testRunner: VSTest
32-
testResultsFiles: '**/*.trx'
33-
condition: succeededOrFailed()
34-
- task: PublishTestResults@2
35-
inputs:
36-
testRunner: NUnit
37-
testResultsFiles: '**/TestResults.xml'
38-
condition: succeededOrFailed()
39-
- task: PublishBuildArtifacts@1
40-
inputs:
41-
ArtifactName: PowerShellEditorServices-CI
42-
PathtoPublish: '$(Build.ArtifactStagingDirectory)'
43-
condition: succeededOrFailed()
31+
- task: PublishTestResults@2
32+
displayName: Publish test results
33+
inputs:
34+
testRunner: VSTest
35+
testResultsFiles: '**/*.trx'
36+
condition: succeededOrFailed()
+12
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
steps:
2+
- checkout: self
3+
- checkout: vscode-powershell
4+
5+
- download: current
6+
artifact: PowerShellEditorServices
7+
displayName: Download signed pipeline artifacts
8+
9+
- pwsh: |
10+
$(Build.SourcesDirectory)/vscode-powershell/tools/setupReleaseTools.ps1 -Token $(GitHubToken)
11+
New-DraftRelease -RepositoryName PowerShellEditorServices -Assets $(Pipeline.Workspace)/PowerShellEditorServices/PowerShellEditorServices.zip
12+
displayName: Drafting a GitHub Release

0 commit comments

Comments
 (0)