|
6 | 6 |
|
7 | 7 | trigger: none # Only run on PRs, not on direct pushes |
8 | 8 |
|
9 | | -pool: |
10 | | - vmImage: ubuntu-latest |
11 | | - |
12 | | -# Simplified to single Python version (per project requirements) |
13 | | -# Can expand to matrix testing later if needed |
14 | | - |
15 | | -steps: |
16 | | -- task: UsePythonVersion@0 |
17 | | - inputs: |
18 | | - versionSpec: '3.12' |
19 | | - addToPath: true |
20 | | - displayName: 'Use Python 3.12' |
21 | | - |
22 | | -- script: | |
23 | | - python -m pip install --upgrade pip |
24 | | - python -m pip install flake8 black build |
25 | | - if [ -f dev_dependencies.txt ]; then pip install -r dev_dependencies.txt; fi |
26 | | - displayName: 'Install dependencies' |
27 | | - |
28 | | -- script: | |
29 | | - black src tests --check |
30 | | - displayName: 'Check format with black' |
31 | | - continueOnError: true # TODO: fix detected formatting errors and remove this line |
32 | | - |
33 | | -- script: | |
34 | | - # stop the build if there are Python syntax errors or undefined names |
35 | | - flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics |
36 | | - # exit-zero treats all errors as warnings |
37 | | - flake8 . --count --exit-zero --show-source --statistics |
38 | | - displayName: 'Lint with flake8' |
39 | | - |
40 | | -- script: | |
41 | | - python -m build |
42 | | - displayName: 'Build package' |
43 | | - |
44 | | -- script: | |
45 | | - python -m pip install dist/*.whl |
46 | | - displayName: 'Install wheel' |
47 | | - |
48 | | -- script: | |
49 | | - pytest |
50 | | - displayName: 'Test with pytest' |
51 | | - |
52 | | -- task: PublishTestResults@2 |
53 | | - condition: succeededOrFailed() |
54 | | - inputs: |
55 | | - testResultsFiles: '**/test-*.xml' |
56 | | - testRunTitle: 'Python 3.12' |
57 | | - displayName: 'Publish test results' |
| 9 | +resources: |
| 10 | + repositories: |
| 11 | + - repository: 1ESPipelineTemplates |
| 12 | + type: git |
| 13 | + name: 1ESPipelineTemplates/1ESPipelineTemplates |
| 14 | + ref: refs/tags/release |
| 15 | + |
| 16 | +extends: |
| 17 | + template: v1/1ES.Unofficial.PipelineTemplate.yml@1ESPipelineTemplates |
| 18 | + parameters: |
| 19 | + pool: |
| 20 | + name: Azure-Pipelines-1ESPT-ExDShared |
| 21 | + image: ubuntu-latest |
| 22 | + os: linux |
| 23 | + sdl: |
| 24 | + sourceAnalysisPool: |
| 25 | + name: Azure-Pipelines-1ESPT-ExDShared # Name of your hosted pool |
| 26 | + image: windows-latest |
| 27 | + os: windows |
| 28 | + stages: |
| 29 | + - stage: Build |
| 30 | + jobs: |
| 31 | + - job: Python |
| 32 | + # Simplified to single Python version (per project requirements) |
| 33 | + # Can expand to matrix testing later if needed |
| 34 | + |
| 35 | + steps: |
| 36 | + - task: UsePythonVersion@0 |
| 37 | + inputs: |
| 38 | + versionSpec: '3.12' |
| 39 | + addToPath: true |
| 40 | + displayName: 'Use Python 3.12' |
| 41 | + |
| 42 | + - script: | |
| 43 | + python -m pip install --upgrade pip |
| 44 | + python -m pip install flake8 black build |
| 45 | + python -m pip install -e .[dev] |
| 46 | + displayName: 'Install dependencies' |
| 47 | + |
| 48 | + - script: | |
| 49 | + black src tests --check |
| 50 | + displayName: 'Check format with black' |
| 51 | + continueOnError: true # TODO: fix detected formatting errors and remove this line |
| 52 | + |
| 53 | + - script: | |
| 54 | + # stop the build if there are Python syntax errors or undefined names |
| 55 | + flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics |
| 56 | + # exit-zero treats all errors as warnings |
| 57 | + flake8 . --count --exit-zero --show-source --statistics |
| 58 | + displayName: 'Lint with flake8' |
| 59 | + |
| 60 | + - script: | |
| 61 | + python -m build |
| 62 | + displayName: 'Build package' |
| 63 | + |
| 64 | + - script: | |
| 65 | + python -m pip install dist/*.whl |
| 66 | + displayName: 'Install wheel' |
| 67 | + |
| 68 | + - script: | |
| 69 | + pytest |
| 70 | + displayName: 'Test with pytest' |
| 71 | + |
| 72 | + - task: PublishTestResults@2 |
| 73 | + condition: succeededOrFailed() |
| 74 | + inputs: |
| 75 | + testResultsFiles: '**/test-*.xml' |
| 76 | + testRunTitle: 'Python 3.12' |
| 77 | + displayName: 'Publish test results' |
0 commit comments