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
|
# Python package
# Create and test a Python package on multiple Python versions.
# Add steps that analyze code, save the dist with the build record, publish to a PyPI-compatible index, and more:
# https://docs.microsoft.com/azure/devops/pipelines/languages/python
trigger:
branches:
include:
- main
- staging
- trying
pr:
- main
variables:
PYVISA_KEYSIGHT_VIRTUAL_INSTR: 1
pool:
name: Keysight-based
demands: KEYSIGHT -equals TCPIP
steps:
- script: |
export PATH="$HOME/miniconda3/bin:$PATH"
echo Create environment
conda create -n test_ python=3.9 numpy --yes
displayName: "Create environment"
- script: |
export PATH="$HOME/miniconda3/bin:$PATH"
source $HOME/miniconda3/bin/activate
echo Activate environment
conda activate test_
echo Install project
pip install -e .
displayName: "Install dependencies"
- script: |
export PATH="$HOME/miniconda3/bin:$PATH"
source $HOME/miniconda3/bin/activate
echo Activate environment
conda activate test_
echo Install pytest and co
pip install pytest pytest-azurepipelines pytest-cov
echo Run pytest
python -X dev -m pytest --pyargs pyvisa --cov pyvisa --cov-report xml -v
displayName: "Run tests"
- script: |
export PATH="$HOME/miniconda3/bin:$PATH"
source $HOME/miniconda3/bin/activate
echo Activate environment
conda activate test_
echo Install codecov
pip install codecov
echo Run codecov
codecov --file coverage.xml --token $(CODECOV_TOKEN) --env PYVISA_KEYSIGHT_VIRTUAL_INSTR --tries 5 --required -F unittests --name codecov-umbrella
displayName: "Upload test coverage results"
- script: |
export PATH="$HOME/miniconda3/bin:$PATH"
conda remove -n test_ --all --yes
displayName: "Remove test environment"
condition: always()
|