* move markdown lint tests * move markdown link tests * refactor static link analysis into a matrix * cache yarn packages * fix paramater name
64 lines
1.9 KiB
YAML
64 lines
1.9 KiB
YAML
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)'
|