-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathazure-pipelines.yml
71 lines (68 loc) · 2.15 KB
/
azure-pipelines.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
trigger:
- main
pr:
- main
pool:
vmImage: ubuntu-latest
jobs:
- job: Build
strategy:
matrix:
Python38:
python.version: '3.8'
Python39:
python.version: '3.9'
Python310:
python.version: '3.10'
Python311:
python.version: '3.11'
Python312:
python.version: '3.12'
steps:
- task: UsePythonVersion@0
inputs:
versionSpec: '$(python.version)'
displayName: 'Use Python $(python.version)'
# Run tox
- script: |
python -m pip install --upgrade pip
pip install tox
displayName: 'Install dependencies'
- script: 'tox'
displayName: Run Tox
# Publish test results and code coverage report
- task: PublishTestResults@2
displayName: Publish test results
inputs:
testResultsFormat: 'JUnit'
testResultsFiles: '$(Build.SourcesDirectory)/junit/optional/test_results.xml'
- task: PublishCodeCoverageResults@1
displayName: Publish code coverage results
inputs:
codeCoverageTool: 'cobertura'
summaryFileLocation: '$(Build.SourcesDirectory)/junit/optional/coverage-reports/coverage.xml'
pathToSources: '$(Build.SourcesDirectory)/src/'
# Publish test results and code coverage report artifacts for later use in Sonar scan
- task: PublishPipelineArtifact@1
inputs:
targetPath: '$(Build.SourcesDirectory)/junit/'
artifactName: 'junit_$(python.version)'
- job: SonarScan
displayName: SonarCloud Analysis
dependsOn: Build
steps:
# Setup SonarCloud analysis
- task: SonarCloudPrepare@1
inputs:
SonarCloud: 'SonarCloud'
organization: 'mzuber'
scannerMode: 'CLI'
configMode: 'file'
configFile: 'sonar-project.properties'
# Download test results and code coverage report artifacts created in build job
- task: DownloadPipelineArtifact@2
inputs:
artifact: junit_3.12
path: '$(Build.SourcesDirectory)/junit'
# Run SonarCloud analysis
- task: SonarCloudAnalyze@1