-
Notifications
You must be signed in to change notification settings - Fork 85
/
azure-pipelines-pr-gate.yml
116 lines (94 loc) · 3.13 KB
/
azure-pipelines-pr-gate.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
workspace:
clean: all
pool:
vmImage: windows-2022
steps:
- task: DeleteFiles@1
inputs:
sourceFolder: $(Build.SourcesDirectory)
contents: '**'
- checkout: self
clean: true
# Node.js Tool Installer
# Finds or downloads and caches the specified version spec of Node.js and adds it to the PATH.
- task: NodeTool@0
inputs:
versionSpec: '17.x'
#checkLatest: false # Optional
- script: npm install -g [email protected]
displayName: 'Install cspell npm'
- script: cspell "docs/**/*.md"
displayName: 'Spell Check md files'
- script: npm install -g [email protected]
displayName: "Install markdown linter"
- script: markdownlint "**/*.md"
displayName: "Lint md files"
- task: UsePythonVersion@0
inputs:
versionSpec: '3.10'
architecture: 'x64'
- script: python -m pip install --upgrade pip
displayName: 'Install/Upgrade pip'
- script: python -m pip install --upgrade -r requirements.txt
displayName: 'Install/upgrade dependencies'
- script: python Utf8Test.py --RootDir docs
displayName: Check character encoding
- script: pytest -v --junitxml=test.junit.xml --html=pytest_report.html --self-contained-html --cov=. --cov-report html:cov_html --cov-report xml:cov.xml
displayName: 'Run UnitTests'
# Publish Test Results to Azure Pipelines/TFS
- task: PublishTestResults@2
displayName: 'Publish junit test results'
continueOnError: true
condition: succeededOrFailed()
inputs:
testResultsFormat: 'JUnit' # Options: JUnit, NUnit, VSTest, xUnit
testResultsFiles: 'test.junit.xml'
mergeTestResults: true # Optional
publishRunAttachments: true # Optional
# Publish Build Artifacts
# Publish build artifacts to Azure Pipelines/TFS or a file share
- task: PublishBuildArtifacts@1
inputs:
pathtoPublish: 'pytest_report.html'
artifactName: 'python unit test report'
continueOnError: true
condition: succeededOrFailed()
# Publish Code Coverage Results
# Publish Cobertura code coverage results
- task: PublishCodeCoverageResults@1
inputs:
codeCoverageTool: 'cobertura' # Options: cobertura, jaCoCo
summaryFileLocation: $(System.DefaultWorkingDirectory)/cov.xml
reportDirectory: $(System.DefaultWorkingDirectory)/cov_html
condition: succeededOrFailed()
- script: flake8 . > flake8.err.log
displayName: 'Run flake8'
condition: succeededOrFailed()
- task: PublishBuildArtifacts@1
inputs:
pathtoPublish: 'flake8.err.log'
artifactName: 'Flake8 Error log file'
continueOnError: true
condition: Failed()
# For CI build don't use remote repos
- script: python DocBuild.py --clean --build --OutputDir docs --yml mkdocs_base.yml -o pr-gate.log
displayName: 'Run Preprocess'
- task: PublishBuildArtifacts@1
displayName: 'Publish Artifact: Generated Yml File'
inputs:
PathtoPublish: 'mkdocs.yml'
ArtifactName: 'mkdocs.yml'
continueOnError: true
condition: succeededOrFailed()
- task: CmdLine@1
displayName: 'build'
inputs:
filename: mkdocs
arguments: 'build -s -v '
- task: PublishBuildArtifacts@1
displayName: 'Publish DocBuild Log'
inputs:
PathtoPublish: 'pr-gate.log'
ArtifactName: 'DocBuild_Pr-Gate.log'
continueOnError: true
condition: failed()