Skip to content
Merged
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
116 changes: 37 additions & 79 deletions .vsts-ci/misc-analysis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,83 +27,41 @@ variables:
- name: repoFolder
value: PowerShell

jobs:
- job: CI_Compliance
displayName: CI Compliance

pool:
vmImage: windows-latest

variables:
- name: repoPath
value: $(Agent.BuildDirectory)\$(repoFolder)

steps:
- checkout: self
clean: true
path: $(repoFolder)

- checkout: ComplianceRepo

- template: ci-compliance.yml@ComplianceRepo

- job: Linux_CI
displayName: Markdown and Common Tests

pool:
vmImage: ubuntu-20.04

variables:
- name: repoPath
value: $(Agent.BuildDirectory)/$(repoFolder)

steps:
- checkout: self
clean: true
path: $(repoFolder)

- checkout: ComplianceRepo

- powershell: |
Get-ChildItem -Path env:
displayName: Capture Environment
condition: succeededOrFailed()

- powershell: |
Install-module Pester -Scope CurrentUser -Force -MaximumVersion 4.99
displayName: Install Pester
condition: succeededOrFailed()

- bash: |
curl -o- --progress-bar -L https://yarnpkg.com/install.sh | bash
displayName: Bootstrap Yarn
condition: succeededOrFailed()

- bash: |
sudo yarn global add markdown-spellcheck@0.11.0
displayName: Install mdspell
condition: succeededOrFailed()

- bash: |
mdspell '**/*.md' '!**/Pester/**/*.md' '!**/dotnet-tools/**/*.md' --ignore-numbers --ignore-acronyms --report --en-us;
displayName: Test Spelling in Markdown
condition: succeededOrFailed()
workingDirectory: '$(repoPath)'

- ${{ if not(contains(variables['SYSTEM.COLLECTIONURI'],'mscodehub')) }}:
- pwsh: |
Import-module ./build.psm1
$path = Join-Path -Path $pwd -ChildPath './commonTestResults.xml'
$results = invoke-pester -Script ./test/common -OutputFile $path -OutputFormat NUnitXml -PassThru
Write-Host "##vso[results.publish type=NUnit;mergeResults=true;runTitle=Common Tests;publishRunAttachments=true;resultFiles=$path;]"
if($results.TotalCount -eq 0 -or $results.FailedCount -gt 0)
{
throw "Markdown tests failed"
}
displayName: Run Common Tests
condition: succeededOrFailed()
workingDirectory: '$(repoPath)'

- template: dailyBuildCompliance.yml@ComplianceRepo
stages:
- stage: Compliance
jobs:
- job: CI_Compliance
displayName: CI Compliance

pool:
vmImage: windows-latest

variables:
- name: repoPath
value: $(Agent.BuildDirectory)\$(repoFolder)

steps:
- checkout: self
clean: true
path: $(repoFolder)

- checkout: ComplianceRepo

- template: ci-compliance.yml@ComplianceRepo
- stage: markdown_spelling_lint
Comment thread
TravisEz13 marked this conversation as resolved.
Resolved
displayName: Markdown Spelling and Lint
dependsOn: []
Comment thread
TravisEz13 marked this conversation as resolved.
Resolved
jobs:
- template: ./misc-analysis/mdSpell.yml
- stage: markdown_link
displayName: Markdown Link
dependsOn: []
jobs:
- template: ./misc-analysis/generateMarkdownMatrix.yml
parameters:
jobName: generateMatrix
taskName: matrixTask
- template: ./misc-analysis/markdown.yml
parameters:
sourceScanPath: '$(repoPath)'
matrix: $[ dependencies.generateMatrix.outputs['matrixTask.matrix'] ]
dependsOn: generateMatrix
46 changes: 46 additions & 0 deletions .vsts-ci/misc-analysis/generateMarkdownMatrix.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
parameters:
- name: jobName
- name: taskName

jobs:
- job: ${{ parameters.jobName }}
displayName: Generate Markdown Matrix

pool:
vmImage: ubuntu-20.04

variables:
- name: repoPath
value: $(Agent.BuildDirectory)/$(repoFolder)

steps:
- checkout: self
clean: true
path: $(repoFolder)

- powershell: |
$matrix = @{}
$matrix += @{
'root' = @{
markdown_folder = "$(repoPath)"
markdown_recurse = $false
}
}
Get-ChildItem -path '$(repoPath)' -Directory | Foreach-Object {
$folder = $_
$matrix += @{
$_.Name = @{
markdown_folder = $_.fullName
markdown_recurse = $true
}
}
}

$matrixJson = $matrix | ConvertTo-Json -Compress
$variableName = "matrix"
$command = "vso[task.setvariable variable=$variableName;isoutput=true]$($matrixJson)"
Write-Verbose "sending command: '$command'"
Write-Host "##$command"
displayName: Create Matrix
condition: succeededOrFailed()
name: ${{ parameters.taskName }}
63 changes: 63 additions & 0 deletions .vsts-ci/misc-analysis/markdown.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
parameters:
- name: matrix
- name: dependsOn

jobs:
- job: markdown
strategy:
matrix: ${{ parameters.matrix }}
maxParallel: 5

displayName: Markdown Link Verification

dependsOn: ${{ parameters.dependsOn }}

pool:
vmImage: ubuntu-20.04

variables:
- name: repoPath
value: $(Agent.BuildDirectory)/$(repoFolder)
- name: YARN_CACHE_FOLDER
value: $(Pipeline.Workspace)/.yarn
- name: YARN_GLOBAL_CACHE_FOLDER
value: $(Pipeline.Workspace)/.yarn-global

steps:
- checkout: self
clean: true
path: $(repoFolder)

- checkout: ComplianceRepo

- task: Cache@2
inputs:
key: '"markdown-link-check" | "$(Agent.OS)" | $(repoPath)/test/common/markdown-link/markdown-link.tests.ps1'
path: $(YARN_GLOBAL_CACHE_FOLDER)
displayName: Cache Yarn packages

- powershell: |
Install-module Pester -Scope CurrentUser -Force -MaximumVersion 4.99
displayName: Install Pester

- bash: |
curl -o- --progress-bar -L https://yarnpkg.com/install.sh | bash
displayName: Bootstrap Yarn

- bash: |
yarn config set global-folder "$(YARN_GLOBAL_CACHE_FOLDER)"
displayName: Set Yarn global cache folder

- ${{ if not(contains(variables['SYSTEM.COLLECTIONURI'],'mscodehub')) }}:
- pwsh: |
Import-module ./build.psm1
$path = Join-Path -Path $pwd -ChildPath './commonTestResults.xml'
$results = invoke-pester -Script ./test/common/markdown-link -OutputFile $path -OutputFormat NUnitXml -PassThru
Write-Host "##vso[results.publish type=NUnit;mergeResults=true;runTitle=Markdown Link;publishRunAttachments=true;resultFiles=$path;]"
if($results.TotalCount -eq 0 -or $results.FailedCount -gt 0)
{
throw "Markdown tests failed"
}
displayName: Run Markdown Link Tests
condition: succeededOrFailed()
workingDirectory: '$(repoPath)'
56 changes: 56 additions & 0 deletions .vsts-ci/misc-analysis/mdSpell.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
jobs:
- job: markdown
displayName: Markdown Spelling

pool:
vmImage: ubuntu-20.04

variables:
- name: repoPath
value: $(Agent.BuildDirectory)/$(repoFolder)

steps:
- checkout: self
clean: true
path: $(repoFolder)

- checkout: ComplianceRepo

- powershell: |
Get-ChildItem -Path env:
displayName: Capture Environment
condition: succeededOrFailed()

- bash: |
curl -o- --progress-bar -L https://yarnpkg.com/install.sh | bash
displayName: Bootstrap Yarn
condition: succeededOrFailed()

- bash: |
sudo yarn global add markdown-spellcheck@0.11.0
displayName: Install mdspell
condition: succeededOrFailed()

- bash: |
mdspell '**/*.md' '!**/Pester/**/*.md' '!**/dotnet-tools/**/*.md' --ignore-numbers --ignore-acronyms --report --en-us;
displayName: Test Spelling in Markdown
condition: succeededOrFailed()
workingDirectory: '$(repoPath)'

- ${{ if not(contains(variables['SYSTEM.COLLECTIONURI'],'mscodehub')) }}:
- pwsh: |
Import-module ./build.psm1
$path = Join-Path -Path $pwd -ChildPath './commonTestResults.xml'
$results = invoke-pester -Script ./test/common/markdown-lint -OutputFile $path -OutputFormat NUnitXml -PassThru
Write-Host "##vso[results.publish type=NUnit;mergeResults=true;runTitle=Markdown Lint;publishRunAttachments=true;resultFiles=$path;]"
if($results.TotalCount -eq 0 -or $results.FailedCount -gt 0)
{
throw "Markdown tests failed"
}
displayName: Run Markdown Lint Tests
condition: succeededOrFailed()
workingDirectory: '$(repoPath)'

- template: dailyBuildCompliance.yml@ComplianceRepo
parameters:
sourceScanPath: '$(repoPath)'
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,18 @@ Describe "Verify Markdown Links" {
Get-Job | Remove-Job -Force
}

$groups = Get-ChildItem -Path "$PSScriptRoot\..\..\..\*.md" -Recurse | Where-Object {$_.DirectoryName -notlike '*node_modules*'} | Group-Object -Property directory
$gciParams = @{}
if ($env:MARKDOWN_FOLDER) {
$gciParams["Path"] = (Join-Path -Path $env:MARKDOWN_FOLDER -ChildPath '*.md')
} else {
$gciParams["Path"] = "$PSScriptRoot\..\..\..\*.md"
}

if ($env:MARKDOWN_RECURSE -ne 'False') {
$gciParams["Recurse"] = $true
}

$groups = Get-ChildItem @gciParams | Where-Object {$_.DirectoryName -notlike '*node_modules*'} | Group-Object -Property directory

$jobs = @{}
# start all link verification in parallel
Expand Down
File renamed without changes.