Skip to content

Commit d6fa2fd

Browse files
committed
feat: add VS Code extension from microsoft/PSDocs-vscode
2 parents 014c9f3 + 044d079 commit d6fa2fd

43 files changed

Lines changed: 7004 additions & 0 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.
Lines changed: 118 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,118 @@
1+
# Copyright (c) Microsoft Corporation.
2+
# Licensed under the MIT License.
3+
4+
# Azure DevOps
5+
# CI pipeline for PSDocs-vscode
6+
7+
variables:
8+
version: '1'
9+
10+
# Use build number format, i.e. 2021.5.10
11+
name: $(Year:yyyy).$(Month).$(rev:r)
12+
13+
trigger:
14+
branches:
15+
include:
16+
- 'main'
17+
- 'release/*'
18+
paths:
19+
exclude:
20+
- ./*.md
21+
tags:
22+
include:
23+
- 'v1.*'
24+
25+
pr:
26+
branches:
27+
include:
28+
- 'main'
29+
- 'release/*'
30+
31+
stages:
32+
33+
# Build pipeline
34+
- stage: Build
35+
displayName: Build
36+
dependsOn: []
37+
jobs:
38+
39+
- template: jobs/build-channel.yaml
40+
parameters:
41+
channel: preview
42+
43+
- template: jobs/build-channel.yaml
44+
parameters:
45+
channel: stable
46+
47+
# Test pipeline
48+
- stage: Test
49+
dependsOn: [ 'Build' ]
50+
jobs:
51+
52+
- template: jobs/test.yaml
53+
parameters:
54+
name: macOS_12
55+
displayName: 'PowerShell 7.1 - macOS-12'
56+
imageName: 'macOS-12'
57+
channel: preview
58+
59+
- template: jobs/test.yaml
60+
parameters:
61+
name: windows
62+
displayName: 'PowerShell 5.1 - Windows 2022'
63+
imageName: 'windows-2022'
64+
channel: preview
65+
pwsh: false
66+
67+
- template: jobs/test.yaml
68+
parameters:
69+
name: windows_2022
70+
displayName: 'PowerShell 7.1 - Windows 2022'
71+
imageName: 'windows-2022'
72+
channel: preview
73+
74+
- template: jobs/test.yaml
75+
parameters:
76+
name: ubuntu_22_04
77+
displayName: 'PowerShell 7.1 - ubuntu-22.04'
78+
imageName: 'ubuntu-22.04'
79+
channel: preview
80+
81+
# Analysis pipeline
82+
- stage: Analysis
83+
displayName: Analysis
84+
dependsOn: []
85+
variables:
86+
# Already done in build
87+
skipComponentGovernanceDetection: true
88+
jobs:
89+
- job: Secret_Scan
90+
pool:
91+
vmImage: 'windows-2022'
92+
displayName: Secret scan
93+
steps:
94+
- task: securedevelopmentteam.vss-secure-development-tools.build-task-credscan.CredScan@2
95+
displayName: 'Scan for secrets'
96+
inputs:
97+
debugMode: false
98+
toolMajorVersion: V3
99+
100+
- task: securedevelopmentteam.vss-secure-development-tools.build-task-publishsecurityanalysislogs.PublishSecurityAnalysisLogs@2
101+
displayName: 'Publish scan logs'
102+
continueOnError: true
103+
104+
- task: securedevelopmentteam.vss-secure-development-tools.build-task-postanalysis.PostAnalysis@1
105+
displayName: 'Check for failures'
106+
inputs:
107+
CredScan: true
108+
ToolLogsNotFoundAction: Error
109+
110+
# Release pipeline
111+
- stage: Preview
112+
displayName: Preview
113+
dependsOn: [ 'Build', 'Analysis', 'Test' ]
114+
condition: eq(variables['Build.SourceBranch'], 'refs/heads/main')
115+
jobs:
116+
- template: jobs/publish-channel.yaml
117+
parameters:
118+
channel: preview
Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
# Copyright (c) Microsoft Corporation.
2+
# Licensed under the MIT License.
3+
4+
# Notes:
5+
# Builds Visual Studio Code extension for a release channel.
6+
7+
parameters:
8+
- name: channel
9+
type: string
10+
- name: buildConfiguration
11+
type: string
12+
default: 'Release'
13+
- name: vmImage
14+
type: string
15+
default: 'ubuntu-20.04'
16+
17+
jobs:
18+
- job: 'build_${{ parameters.channel }}'
19+
displayName: 'Build ${{ parameters.channel }}'
20+
pool:
21+
vmImage: '${{ parameters.vmImage }}'
22+
steps:
23+
24+
# Install pipeline dependencies
25+
- powershell: ./.azure-pipelines/pipeline-deps.ps1
26+
displayName: 'Install dependencies'
27+
28+
# Build extension
29+
- powershell: Invoke-Build -Configuration '${{ parameters.buildConfiguration }}' -Build $(Build.BuildNumber) -Channel '${{ parameters.channel }}'
30+
displayName: 'Build extension'
31+
32+
# Generate artifacts
33+
- task: PublishPipelineArtifact@0
34+
displayName: 'Publish extension'
35+
inputs:
36+
artifactName: 'extension-${{ parameters.channel }}'
37+
targetPath: out/package
Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
# Copyright (c) Microsoft Corporation.
2+
# Licensed under the MIT License.
3+
4+
# Notes:
5+
# Publish Visual Studio Code extension for a release channel.
6+
7+
parameters:
8+
- name: channel
9+
type: string
10+
- name: buildConfiguration
11+
type: string
12+
default: 'Release'
13+
- name: vmImage
14+
type: string
15+
default: 'ubuntu-20.04'
16+
17+
jobs:
18+
- job: 'publish_${{ parameters.channel }}'
19+
displayName: 'Publish ${{ parameters.channel }}'
20+
pool:
21+
vmImage: '${{ parameters.vmImage }}'
22+
steps:
23+
24+
# Download extension
25+
- task: DownloadPipelineArtifact@1
26+
displayName: 'Download extension'
27+
inputs:
28+
artifactName: 'extension-${{ parameters.channel }}'
29+
downloadPath: $(Build.SourcesDirectory)/out/package
30+
31+
# Install pipeline dependencies
32+
- powershell: ./.azure-pipelines/pipeline-deps.ps1
33+
displayName: 'Install dependencies'
34+
35+
# Install pipeline dependencies and build module
36+
- powershell: Invoke-Build Release -ApiKey $(apiKey) -Channel ${{ parameters.channel }}
37+
displayName: 'Publish extension'
Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
# Copyright (c) Microsoft Corporation.
2+
# Licensed under the MIT License.
3+
4+
# Notes:
5+
# Test Visual Studio Code extension.
6+
7+
parameters:
8+
- name: name
9+
type: string
10+
- name: displayName
11+
type: string
12+
- name: channel
13+
type: string
14+
- name: buildConfiguration
15+
type: string
16+
default: 'Release'
17+
- name: imageName
18+
type: string
19+
- name: pwsh
20+
type: boolean
21+
default: true
22+
23+
jobs:
24+
- job: '${{ parameters.name }}'
25+
displayName: '${{ parameters.displayName }}'
26+
pool:
27+
vmImage: '${{ parameters.imageName }}'
28+
variables:
29+
skipComponentGovernanceDetection: true
30+
steps:
31+
32+
- bash: |
33+
/usr/bin/Xvfb :99 -screen 0 1024x768x24 > /dev/null 2>&1 &
34+
echo ">>> Started xvfb"
35+
displayName: Start xvfb
36+
condition: and(succeeded(), eq(variables['Agent.OS'], 'Linux'))
37+
38+
# Install pipeline dependencies
39+
- powershell: ./.azure-pipelines/pipeline-deps.ps1
40+
displayName: 'Install dependencies'
41+
42+
# Download module
43+
- task: DownloadPipelineArtifact@2
44+
displayName: 'Download extension'
45+
inputs:
46+
artifact: 'extension-${{ parameters.channel }}'
47+
path: $(Build.SourcesDirectory)/out/package
48+
49+
# Run tests
50+
- task: PowerShell@2
51+
inputs:
52+
pwsh: ${{ parameters.pwsh }}
53+
targetType: inline
54+
script: |-
55+
npm install
56+
displayName: 'Test extension'
57+
env:
58+
DISPLAY: ':99.0'
Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
# Copyright (c) Microsoft Corporation.
2+
# Licensed under the MIT License.
3+
4+
# Notes:
5+
# Test Visual Studio Code extension.
6+
7+
parameters:
8+
- name: name
9+
type: string
10+
- name: displayName
11+
type: string
12+
- name: channel
13+
type: string
14+
- name: buildConfiguration
15+
type: string
16+
default: 'Release'
17+
- name: vmImage
18+
type: string
19+
default: 'ubuntu-20.04'
20+
- name: imageName
21+
type: string
22+
- name: imageTag
23+
type: string
24+
25+
jobs:
26+
- job: ${{ parameters.name }}
27+
displayName: ${{ parameters.displayName }}
28+
pool:
29+
vmImage: ${{ parameters.vmImage }}
30+
container:
31+
image: '${{ parameters.imageName }}:${{ parameters.imageTag }}'
32+
variables:
33+
skipComponentGovernanceDetection: true
34+
steps:
35+
36+
- bash: |
37+
/usr/bin/Xvfb :99 -screen 0 1024x768x24 > /dev/null 2>&1 &
38+
echo ">>> Started xvfb"
39+
displayName: Start xvfb
40+
condition: and(succeeded(), eq(variables['Agent.OS'], 'Linux'))
41+
42+
# Install pipeline dependencies
43+
- powershell: ./.azure-pipelines/pipeline-deps.ps1
44+
displayName: 'Install dependencies'
45+
46+
# Download module
47+
- task: DownloadPipelineArtifact@2
48+
displayName: 'Download extension'
49+
inputs:
50+
artifact: 'extension-${{ parameters.channel }}'
51+
path: $(Build.SourcesDirectory)/out/package
52+
53+
# Run tests
54+
- powershell: |-
55+
npm install
56+
npm test
57+
displayName: 'Test extension'
58+
env:
59+
DISPLAY: ':99.0'
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
# Copyright (c) Microsoft Corporation.
2+
# Licensed under the MIT License.
3+
4+
#
5+
# Install dependencies for integration with Azure DevOps
6+
#
7+
8+
if ($Env:SYSTEM_DEBUG -eq 'true') {
9+
$VerbosePreference = 'Continue';
10+
}
11+
12+
if ($Null -eq (Get-PackageProvider -Name NuGet -ErrorAction Ignore)) {
13+
Install-PackageProvider -Name NuGet -Force -Scope CurrentUser;
14+
}
15+
16+
if ($Null -eq (Get-InstalledModule -Name PowerShellGet -MinimumVersion 2.1.2 -ErrorAction Ignore)) {
17+
Install-Module PowerShellGet -MinimumVersion 2.1.2 -Scope CurrentUser -Force -AllowClobber;
18+
}
19+
20+
if ($Null -eq (Get-InstalledModule -Name InvokeBuild -MinimumVersion 5.4.0 -ErrorAction Ignore)) {
21+
Install-Module InvokeBuild -MinimumVersion 5.4.0 -Scope CurrentUser -Force;
22+
}
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
{
2+
"root": true,
3+
"parser": "@typescript-eslint/parser",
4+
"parserOptions": {
5+
"ecmaVersion": 6,
6+
"sourceType": "module"
7+
},
8+
"plugins": [
9+
"@typescript-eslint"
10+
],
11+
"rules": {
12+
"@typescript-eslint/naming-convention": "warn",
13+
"@typescript-eslint/semi": "warn",
14+
"curly": "warn",
15+
"eqeqeq": "warn",
16+
"no-throw-literal": "warn",
17+
"semi": "off"
18+
},
19+
"ignorePatterns": [
20+
"out",
21+
"dist",
22+
"**/*.d.ts"
23+
]
24+
}

0 commit comments

Comments
 (0)