forked from liupeirong/MLOpsManufacturing
-
Notifications
You must be signed in to change notification settings - Fork 0
/
code-quality-template.yml
38 lines (34 loc) · 1.26 KB
/
code-quality-template.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
parameters:
- name: workingDirectory
displayName: Working Directory for sample
type: string
- name: targetDirectory
displayName: Target directory to run lint and test against
type: string
default: '.'
# Pipeline template to run linting, unit tests with code coverage, and publish the results.
steps:
- script: |
flake8 ${{ parameters.targetDirectory }} --output-file=lint-testresults.xml --format junit-xml
workingDirectory: ${{ parameters.workingDirectory }}
displayName: 'Run lint tests'
- script: |
python -m pytest ${{ parameters.targetDirectory }} --cov=ml_model --cov-report=html --cov-report=xml --junitxml=unit-testresults.xml
workingDirectory: ${{ parameters.workingDirectory }}
condition: succeededOrFailed()
displayName: 'Run unit tests'
- task: PublishTestResults@2
condition: succeededOrFailed()
inputs:
testResultsFiles: '**/*-testresults.xml'
testRunTitle: 'Linting & Unit tests'
failTaskOnFailedTests: true
displayName: 'Publish test results'
- task: PublishCodeCoverageResults@1
displayName: 'Publish coverage report'
condition: succeededOrFailed()
inputs:
codeCoverageTool: Cobertura
summaryFileLocation: '**/coverage.xml'
reportDirectory: '**/htmlcov'
failIfCoverageEmpty: true