Skip to content

Centralize module loading #1520

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 7 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 27 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,33 @@ trim_trailing_whitespace = true
csharp_space_before_open_square_brackets = true
csharp_space_after_keywords_in_control_flow_statements = true

# CS0168: The variable 'var' is declared but never used
dotnet_diagnostic.CS0168.severity = error
# CS0169: The private field 'class member' is never used
dotnet_diagnostic.CS0169.severity = error
# CS0219: The variable 'variable' is assigned but its value is never used
dotnet_diagnostic.CS0219.severity = error
# CS0414: The private field 'field' is assigned but its value is never used
dotnet_diagnostic.CS0414.severity = error
# CA1068: CancellationToken parameters must come last
dotnet_diagnostic.CA1068.severity = error
# CA1822: Mark members as static
dotnet_diagnostic.CA1822.severity = error
# CA1823: Avoid unused private fields
dotnet_diagnostic.CA1823.severity = error
# CA2007: Do not directly await a Task
dotnet_diagnostic.CA2007.severity = error
# CA2016: Forward the CancellationToken parameter to methods that take one
dotnet_diagnostic.CA2016.severity = error
# All maintainability issues (dead code etc.)
# See: https://docs.microsoft.com/en-us/dotnet/fundamentals/code-analysis/quality-rules/maintainability-warnings
dotnet_analyzer_diagnostic.category-Maintainability.severity = error
# VSTHRD002: Synchronously waiting on tasks or awaiters may cause deadlocks
# TODO: Fix all of these issues and explicitly ignore the intentional ones.
dotnet_diagnostic.VSTHRD002.severity = silent
# VSTHRD200: Use "Async" suffix for awaitable methods
dotnet_diagnostic.VSTHRD200.severity = silent

[*.{json}]
indent_size = 2
trim_trailing_whitespace = true
Expand Down
2 changes: 1 addition & 1 deletion .github/CODEOWNERS
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# https://help.github.com/articles/about-codeowners/

# Global reviewers
* @tylerl0706 @rjmholt
* @andschwa @rjmholt

# Area: Analysis & Formatting
src/PowerShellEditorServices/Analysis/ @rjmholt
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/codeql-analysis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ jobs:

- name: Build
shell: pwsh
run: scripts/azurePipelinesBuild.ps1
run: tools/azurePipelinesBuild.ps1

- name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@v1
57 changes: 24 additions & 33 deletions .vsts-ci/azure-pipelines-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,58 +9,49 @@ variables:
value: 'true'

trigger:
batch: true
branches:
include:
- master
- legacy/1.x
paths:
exclude:
- /.dependabot/*
- /.poshchan/*
- /.github/**/*
- /.vscode/**/*
- /.vsts-ci/misc-analysis.yml
- /tools/**/*
- .editorconfig
- .gitattributes
- .gitignore
- /docs/**/*
- /CHANGELOG.md
- /CONTRIBUTING.md
- /README.md
- /LICENSE
- /CODE_OF_CONDUCT.md

# TODO: Setup matrix of image support.
pr:
- master

jobs:
- job: 'PS51_Win10'
displayName: PowerShell 5.1 | Windows 10
- job: PS51_Win2016
displayName: PowerShell 5.1 - Windows Server 2016
pool:
vmImage: vs2017-win2016
steps:
- template: templates/ci-general.yml
parameters:
pwsh: false

- job: PS51_Win2019
displayName: PowerShell 5.1 - Windows Server 2019
pool:
# TODO: Update this image.
vmImage: 'vs2017-win2016'
vmImage: windows-2019
steps:
- template: templates/ci-general.yml
parameters:
pwsh: false

- job: 'PS7_Win10'
displayName: PowerShell 7 | Windows 10
- job: PS7_Win2019
displayName: PowerShell 7 - Windows Server 2019
pool:
vmImage: 'windows-2019'
vmImage: windows-2019
steps:
- template: templates/ci-general.yml

- job: 'PS7_macOS'
displayName: PowerShell 7 | macOS
- job: PS7_macOS
displayName: PowerShell 7 - macOS 10.15
pool:
vmImage: 'macOS-10.15'
vmImage: macOS-10.15
steps:
- template: templates/ci-general.yml

- job: 'PS7_Ubuntu'
displayName: PowerShell 7 | Ubuntu
- job: PS7_Ubuntu
displayName: PowerShell 7 - Ubuntu 20.04
pool:
vmImage: 'ubuntu-20.04'
vmImage: ubuntu-20.04
steps:
- template: templates/ci-general.yml
64 changes: 42 additions & 22 deletions .vsts-ci/azure-pipelines-release.yml
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
name: Release-$(Build.SourceBranchName)-$(Date:yyyyMMdd)$(Rev:.rr)

variables:
# Don't download unneeded packages
- name: DOTNET_SKIP_FIRST_TIME_EXPERIENCE
Expand All @@ -9,33 +11,51 @@ variables:
trigger:
branches:
include:
- release/*
tags:
include:
- v*
- release

resources:
repositories:
- repository: ComplianceRepo
type: github
endpoint: ComplianceGHRepo
endpoint: GitHub
name: PowerShell/compliance
- repository: vscode-powershell
type: git
name: vscode-powershell

stages:
- stage: Build
displayName: Build the release
jobs:
- job: Build
pool:
vmImage: windows-2019
steps:
- template: templates/ci-general.yml

jobs:
- job: 'ReleaseBuild'
displayName: 'Build release'
pool:
vmImage: 'vs2017-win2016'
steps:
- template: templates/ci-general.yml
- stage: Sign
displayName: Sign the release
jobs:
- job: Sign
pool:
name: 1ES
demands: ImageOverride -equals MMS2019
variables:
- group: ESRP
steps:
- template: templates/release-general.yml

- job: 'SignBuild'
displayName: Signing Build
dependsOn: 'ReleaseBuild'
pool:
name: '1ES'
demands: ImageOverride -equals MMS2019
variables:
- group: ESRP
steps:
- template: templates/release-general.yml
- stage: Publish
displayName: Publish the draft release
jobs:
- deployment: Publish
environment: PowerShellEditorServices
pool:
vmImage: ubuntu-latest
variables:
- group: Publish
strategy:
runOnce:
deploy:
steps:
- template: templates/publish-general.yml
14 changes: 4 additions & 10 deletions .vsts-ci/misc-analysis.yml
Original file line number Diff line number Diff line change
@@ -1,31 +1,25 @@
name: PR-$(System.PullRequest.PullRequestNumber)-$(Date:yyyyMMdd)$(Rev:.rr)

trigger:
# Batch merge builds together while a merge build is running
batch: true
branches:
include:
- master

pr:
branches:
include:
- master
- legacy/1.x
- master

resources:
repositories:
- repository: ComplianceRepo
type: github
endpoint: ComplianceGHRepo
endpoint: GitHub
name: PowerShell/compliance

jobs:
- job: Compliance_Job
- job: Compliance
pool:
vmImage: windows-latest
steps:
- checkout: self
clean: true
- checkout: ComplianceRepo
clean: true
- template: ci-compliance.yml@ComplianceRepo
65 changes: 29 additions & 36 deletions .vsts-ci/templates/ci-general.yml
Original file line number Diff line number Diff line change
@@ -1,43 +1,36 @@
parameters:
pwsh: true
- name: pwsh
type: boolean
default: true

steps:
- powershell: |
Write-Host "Installing PowerShell Daily..."
- pwsh: $PSVersionTable
displayName: PowerShell version

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

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

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

- pwsh: '$PSVersionTable'
displayName: Display PowerShell version information

- pwsh: Write-Host "##vso[build.updatebuildnumber]$env:BUILD_SOURCEBRANCHNAME-$env:BUILD_SOURCEVERSION-$((get-date).ToString("yyyyMMddhhmmss"))"
displayName: Set Build Name for Non-PR
condition: ne(variables['Build.Reason'], 'PullRequest')
- task: PowerShell@2
inputs:
filePath: scripts/azurePipelinesBuild.ps1
pwsh: ${{ parameters.pwsh }}
- task: PublishTestResults@2
inputs:
testRunner: VSTest
testResultsFiles: '**/*.trx'
condition: succeededOrFailed()
- task: PublishTestResults@2
inputs:
testRunner: NUnit
testResultsFiles: '**/TestResults.xml'
condition: succeededOrFailed()
- task: PublishBuildArtifacts@1
inputs:
ArtifactName: PowerShellEditorServices-CI
PathtoPublish: '$(Build.ArtifactStagingDirectory)'
condition: succeededOrFailed()
- task: PublishTestResults@2
displayName: Publish test results
inputs:
testRunner: VSTest
testResultsFiles: '**/*.trx'
condition: succeededOrFailed()
12 changes: 12 additions & 0 deletions .vsts-ci/templates/publish-general.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
steps:
- checkout: self
- checkout: vscode-powershell

- download: current
artifact: PowerShellEditorServices
displayName: Download signed pipeline artifacts

- pwsh: |
$(Build.SourcesDirectory)/vscode-powershell/tools/setupReleaseTools.ps1 -Token $(GitHubToken)
New-DraftRelease -RepositoryName PowerShellEditorServices -Assets $(Pipeline.Workspace)/PowerShellEditorServices/PowerShellEditorServices.zip
displayName: Drafting a GitHub Release
Loading