-
Notifications
You must be signed in to change notification settings - Fork 14
Expand file tree
/
Copy pathci-pr.yaml
More file actions
93 lines (78 loc) · 2.85 KB
/
ci-pr.yaml
File metadata and controls
93 lines (78 loc) · 2.85 KB
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
# Azure DevOps PR validation pipeline
# Matches GitHub Actions workflow for consistency
pr:
- main
trigger:
- main
resources:
repositories:
- repository: 1ESPipelineTemplates
type: git
name: 1ESPipelineTemplates/1ESPipelineTemplates
ref: refs/tags/release
extends:
template: v1/1ES.Unofficial.PipelineTemplate.yml@1ESPipelineTemplates
parameters:
pool:
name: Azure-Pipelines-1ESPT-ExDShared
image: ubuntu-latest
os: linux
sdl:
sourceAnalysisPool:
name: Azure-Pipelines-1ESPT-ExDShared # Name of your hosted pool
image: windows-latest
os: windows
stages:
- stage: Build
jobs:
- job: Python
# Simplified to single Python version (per project requirements)
# Can expand to matrix testing later if needed
steps:
- task: UsePythonVersion@0
inputs:
versionSpec: '3.12'
addToPath: true
displayName: 'Use Python 3.12'
- script: |
python -m pip install --upgrade pip
python -m pip install flake8 black build diff-cover
python -m pip install -e .[dev]
displayName: 'Install dependencies'
- script: |
black src tests examples --check
displayName: 'Check format with black'
- script: |
# stop the build if there are Python syntax errors or undefined names
flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics
# exit-zero treats all errors as warnings
flake8 . --count --exit-zero --show-source --statistics
displayName: 'Lint with flake8'
- script: |
python -m build
displayName: 'Build package'
- script: |
python -m pip install dist/*.whl
displayName: 'Install wheel'
- script: |
PYTHONPATH=src pytest --junitxml=test-results.xml --cov=src/PowerPlatform --cov-report=xml --cov-report=term-missing --cov-fail-under=90
displayName: 'Test with pytest'
- script: |
git fetch origin main
diff-cover coverage.xml --compare-branch=origin/main --fail-under=90
displayName: 'Diff coverage (90% for new changes)'
- task: PublishTestResults@2
condition: succeededOrFailed()
inputs:
testResultsFiles: '**/test-results.xml'
testRunTitle: 'Python 3.12'
displayName: 'Publish test results'
- task: UseDotNet@2
inputs:
version: '8.x'
displayName: 'Install .NET (required by PublishCodeCoverageResults@2)'
- task: PublishCodeCoverageResults@2
condition: succeededOrFailed()
inputs:
summaryFileLocation: '**/coverage.xml'
displayName: 'Publish code coverage'