Debian Codegraph @

azure-pipelines.yml

raw symbols SCIP
1 # Add steps that analyze code, save build artifacts, deploy, and more:
2 # https://docs.microsoft.com/azure/devops/pipelines/languages/python
3 #
4 # NOTES:
5 #
6 # Display name of each step should be prefixed with one of the following:
7 # CR-QC: for quality control measures.
8 # CR-BUILD: for build-related tasks.
9 # CR-DEPLOY: for publication or deployment.
10 # [no prefix]: for unrelated CI setup/tooling.
11 #
12 # Use PowerShell Core for any utility scripts so they are re-usable across
13 # Windows, macOS, and Linux.
14 #
15
16
17 trigger:
18 - main
19
20
21 stages:
22 - stage: Unit_Tests
23 displayName: Unit Tests
24
25 jobs:
26 - job: pytest
27 displayName: pytest
28 pool:
29 vmImage: 'ubuntu-latest'
30 strategy:
31 matrix:
32 py3.6:
33 PYTHON_VERSION: '3.6'
34 py3.7:
35 PYTHON_VERSION: '3.7'
36 py3.8:
37 PYTHON_VERSION: '3.8'
38 py3.9:
39 PYTHON_VERSION: '3.9'
40
41 steps:
42 - task: UsePythonVersion@0
43 displayName: 'Use Python version'
44 inputs:
45 versionSpec: '$(PYTHON_VERSION)'
46 architecture: 'x64'
47
48 - script: python -m pip install -r requirements-dev.txt
49 displayName: 'CR-QC: Install from local repo'
50
51 - script: pytest ./testproject/
52 displayName: 'CR-QC: Run unit tests'
53
54 - task: PublishTestResults@2
55 displayName: 'Publish unit test report'
56 condition: succeededOrFailed()
57 inputs:
58 testResultsFiles: '**/test-*.xml'
59 testRunTitle: 'Publish test results for Python $(python.version)'
60
61 - task: PublishCodeCoverageResults@1
62 displayName: 'Publish code coverage report'
63 condition: succeededOrFailed()
64 inputs:
65 codeCoverageTool: Cobertura
66 summaryFileLocation: '$(System.DefaultWorkingDirectory)/coverage.xml'
67
68
69 - stage: Static_Analysis
70 displayName: Static Analysis
71 dependsOn: Unit_Tests
72 condition: succeeded('Unit_Tests')
73 jobs:
74 - job: lint
75 displayName: Linters
76 pool:
77 vmImage: 'ubuntu-latest'
78
79 steps:
80 - task: UsePythonVersion@0
81 displayName: 'Use Python version'
82 inputs:
83 versionSpec: '3.9'
84 architecture: 'x64'
85
86 - script: python -m pip install -r requirements-dev.txt
87 displayName: 'CR-QC: Install from local repo'
88
89 - script: flake8 .
90 displayName: 'CR-QC: Static analysis (flake8)'
91
92 - script: black --check .
93 displayName: 'CR-QC: Format check'
94
95 - script: mypy .
96 displayName: 'CR-QC: Type check (mypy)'
97
98 - job: codecov
99 displayName: Code Coverage
100 pool:
101 vmImage: 'ubuntu-latest'
102
103 steps:
104 - task: DownloadPipelineArtifact@2
105 displayName: 'Download code coverage from current build'
106 inputs:
107 source: 'current'
108 path: '$(Agent.WorkFolder)/current-artifacts'
109 project: '$(System.TeamProjectId)'
110 pipeline: '$(System.DefinitionId)'
111
112 - pwsh: ./ci/compare-codecov.ps1 -wd $Env:WorkDir
113 displayName: 'CR-QC: Compare code coverage'
114 env:
115 WorkDir: $(Agent.WorkFolder)