Skip to content
118 changes: 69 additions & 49 deletions .azdo/ci-pr.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,52 +6,72 @@ pr:

trigger: none # Only run on PRs, not on direct pushes

pool:
vmImage: ubuntu-latest

# 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
python -m pip install -e .[dev]
displayName: 'Install dependencies'

- script: |
black src tests --check
displayName: 'Check format with black'
continueOnError: true # TODO: fix detected formatting errors and remove this line

- 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: |
pytest
displayName: 'Test with pytest'

- task: PublishTestResults@2
condition: succeededOrFailed()
inputs:
testResultsFiles: '**/test-*.xml'
testRunTitle: 'Python 3.12'
displayName: 'Publish test results'
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
python -m pip install -e .[dev]
displayName: 'Install dependencies'

- script: |
black src tests --check
displayName: 'Check format with black'
continueOnError: true # TODO: fix detected formatting errors and remove this line

- 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: |
pytest
displayName: 'Test with pytest'

- task: PublishTestResults@2
condition: succeededOrFailed()
inputs:
testResultsFiles: '**/test-*.xml'
testRunTitle: 'Python 3.12'
displayName: 'Publish test results'
Loading