Skip to content

Commit b4d21ab

Browse files
authored
Merge pull request #26 from python-tableformatter/azure-pipelines
Set up CI with Azure Pipelines
2 parents d1f16af + 9c6c2f0 commit b4d21ab

1 file changed

Lines changed: 53 additions & 0 deletions

File tree

azure-pipelines.yml

Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
# Python package
2+
# Create and test a Python package on multiple Python versions.
3+
# Add steps that analyze code, save the dist with the build record, publish to a PyPI-compatible index, and more:
4+
# https://docs.microsoft.com/vsts/pipelines/languages/python
5+
6+
jobs:
7+
8+
- job: 'Test'
9+
10+
# Configure Build Environment to use Azure Pipelines to build tableformatter Python project using macOS
11+
pool:
12+
vmImage: 'macOS 10.13' # other options 'Ubuntu 16.04', 'VS2017-Win2016'
13+
14+
# Run the pipeline with multiple Python versions
15+
strategy:
16+
matrix:
17+
Python34:
18+
python.version: '3.4'
19+
Python35:
20+
python.version: '3.5'
21+
Python36:
22+
python.version: '3.6'
23+
Python37:
24+
python.version: '3.7'
25+
# Increase the maxParallel value to simultaneously run the job for all versions in the matrix (max 10 for free open-source)
26+
maxParallel: 4
27+
28+
steps:
29+
# Set the UsePythonVersion task to reference the matrix variable for its Python version
30+
- task: UsePythonVersion@0
31+
inputs:
32+
versionSpec: '$(python.version)'
33+
architecture: 'x64'
34+
35+
# Install dependencies - install specific PyPI packages with pip
36+
- script: python -m pip install --upgrade pip && pip install wcwidth
37+
displayName: 'Install dependencies'
38+
39+
# TODO: Consider adding a lint test to use flake8, pylint, or black to validate code style
40+
41+
# Test - test with pytest, collect coverage metrics with pytest-cov, and publish these metrics to codecov.io
42+
- script: |
43+
pip install pytest pytest-cov codecov
44+
py.test --cov=tableformatter --junitxml=junit/test-results.xml --cov-report=xml --cov-report=html
45+
codecov
46+
displayName: 'Test with pytest'
47+
48+
# Publish test results to the Azure DevOps server
49+
- task: PublishTestResults@2
50+
inputs:
51+
testResultsFiles: '**/test-*.xml'
52+
testRunTitle: 'Python $(python.version)'
53+
condition: succeededOrFailed()

0 commit comments

Comments
 (0)