From 9cb351feee9524610baaf529a6558af6d754e0b6 Mon Sep 17 00:00:00 2001 From: Ogi Moore Date: Wed, 22 May 2019 15:24:21 -0700 Subject: [PATCH] Implement azure ci (#865) * [skip-ci] Initial Azure-Pipelines configuration. The following configurations are tested * macOS 10.13 * ubuntu 16.04 * Windows Server 2016 Under each operating system, the following Qt bindings are tested * conda based pyqt4 * conda based pyside * conda based pyside2 (5.6) * conda based PyQt5 (5.9) * pip basedd PyQt5 (5.12) * pip based PySide2 (5.12) For each configuration, it runs `python -m pytest --cov pyqtgraph -sv` The only configuration that actually passes all tests is Ubuntu-pip-PyQt5 --- azure-pipelines.yml | 38 +++++++++ azure-test-template.yml | 183 ++++++++++++++++++++++++++++++++++++++++ 2 files changed, 221 insertions(+) create mode 100644 azure-pipelines.yml create mode 100644 azure-test-template.yml diff --git a/azure-pipelines.yml b/azure-pipelines.yml new file mode 100644 index 00000000..b91f515a --- /dev/null +++ b/azure-pipelines.yml @@ -0,0 +1,38 @@ +############################################################################################ +# This config was rectrieved in no small part from https://github.com/slaclab/pydm +############################################################################################ + +trigger: + branches: + include: + - '*' # Build for all branches if they have a azure-pipelines.yml file. + tags: + include: + - 'v*' # Ensure that we are building for tags starting with 'v' (Official Versions) + +# Build only for PRs for master branch +pr: + autoCancel: true + branches: + include: + - master + - develop + +variables: + OFFICIAL_REPO: 'pyqtgraph/pyqtgraph' + +jobs: + - template: azure-test-template.yml + parameters: + name: Linux + vmImage: 'Ubuntu 16.04' + + - template: azure-test-template.yml + parameters: + name: Windows + vmImage: 'vs2017-win2016' + + - template: azure-test-template.yml + parameters: + name: MacOS + vmImage: 'macOS-10.13' diff --git a/azure-test-template.yml b/azure-test-template.yml new file mode 100644 index 00000000..2f1a7ae3 --- /dev/null +++ b/azure-test-template.yml @@ -0,0 +1,183 @@ +# Azure Pipelines CI job template for PyDM Tests +# https://docs.microsoft.com/en-us/azure/devops/pipelines/languages/anaconda?view=azure-devops +parameters: + name: '' + vmImage: '' + +jobs: +- job: ${{ parameters.name }} + pool: + vmImage: ${{ parameters.vmImage }} + strategy: + matrix: + Python27-Qt4: + python.version: '2.7' + install.method: "conda" + qt.bindings: "pyqt=4" + Python27-PySide: + python.version: '2.7' + qt.bindings: "pyside" + install.method: "conda" + Python37-PyQt-5.9: + python.version: "3.7" + qt.bindings: "pyqt" + install.method: "conda" + Python37-PySide2-5.6: + python.version: "3.7" + qt.bindings: "pyside2" + install.method: "conda" + Python35-PyQt-5.12: + python.version: '3.5' + qt.bindings: "PyQt5" + install.method: "pip" + Python35-PySide2-5.12: + python.version: "3.5" + qt.bindings: "PySide2" + install.method: "pip" + + steps: + - powershell: Write-Host "##vso[task.prependpath]$env:CONDA\Scripts" + displayName: 'Windows - Add conda to PATH' + condition: and(eq(variables['install.method'], 'conda' ), eq(variables['agent.os'], 'Windows_NT' )) + + - bash: | + echo "##vso[task.prependpath]$CONDA/bin" + sudo chown -R $USER $CONDA + displayName: 'MacOS - Add conda to PATH' + condition: and(eq(variables['install.method'], 'conda' ), eq(variables['agent.os'], 'Darwin' )) + + - bash: | + brew update && brew install azure-cli + brew update && brew install python3 && brew upgrade python3 + brew link --overwrite python3 + displayName: "MacOS - Intall Python3" + condition: and(eq(variables['install.method'], 'pip' ), eq(variables['agent.os'], 'Darwin' )) + + - bash: | + echo "##vso[task.prependpath]/usr/share/miniconda/bin" + displayName: 'Linux - Add conda to PATH' + condition: and(eq(variables['install.method'], 'conda' ), eq(variables['agent.os'], 'Linux' )) + + - bash: | + # Install & Start Windows Manager for Linux + sudo apt-get install -y xvfb libxkbcommon-x11-0 # herbstluftwm + displayName: 'Linux - Prepare OS' + condition: eq(variables['agent.os'], 'Linux' ) + + - bash: | + source $HOME/miniconda/etc/profile.d/conda.sh + hash -r + conda config --set always_yes yes --set auto_update_conda no + conda config --add channels conda-forge + conda create -n test_env --quiet python=$(python.version) + displayName: 'Conda Setup Test Environment' + condition: eq(variables['install.method'], 'conda' ) + + - script: | + call activate test_env + conda install --quiet $(qt.bindings) + conda install --quiet numpy scipy pyopengl pytest flake8 six coverage + pip install pytest-azurepipelines pytest-xdist pytest-cov + displayName: Conda Install Dependencies - Windows + condition: and(eq(variables['install.method'], 'conda' ), eq(variables['agent.os'], 'Windows_NT' )) + + - bash: | + source activate test_env + conda install --quiet $(qt.bindings) + conda install --quiet numpy scipy pyopengl pytest flake8 six coverage + pip install pytest-azurepipelines pytest-xdist pytest-cov pytest-xvfb + displayName: Conda Install Dependencies - MacOS+Linux + condition: and(eq(variables['install.method'], 'conda' ), ne(variables['agent.os'], 'Windows_NT' )) + + - bash: | + pip3 install setuptools wheel + pip3 install $(qt.bindings) + pip3 install numpy scipy pyopengl pytest flake8 six coverage + pip3 install pytest-azurepipelines pytest-xdist pytest-cov pytest-xvfb + displayName: "Pip - Install Dependencies" + condition: eq(variables['install.method'], 'pip' ) + + - bash: | + source activate test_env + echo python location: `which python3` + echo python version: `python3 --version` + echo pytest location: `which pytest` + echo installed packages + conda list + echo pyqtgraph system info + python -c "import pyqtgraph as pg; pg.systemInfo()" + displayName: 'Debug - Conda/MacOS+Linux' + continueOnError: false + condition: and(eq(variables['install.method'], 'conda' ), ne(variables['agent.os'], 'Windows_NT' )) + + - script: | + call activate test_env + echo python location + where python + echo python version + python --version + echo pytest location + where pytest + echo installed packages + conda list + echo pyqtgraph system info + python -c "import pyqtgraph as pg; pg.systemInfo()" + displayName: 'Debug - Conda/Windows' + continueOnError: false + condition: and(eq(variables['install.method'], 'conda' ), eq(variables['agent.os'], 'Windows_NT' )) + + - bash: | + echo python location: `which python3` + echo python version: `python3 --version` + echo pytest location: `which pytest` + echo installed packages + pip3 list + echo pyqtgraph system info + python3 -c "import pyqtgraph as pg; pg.systemInfo()" + displayName: 'Debug - System/MacOS+Linux' + continueOnError: false + condition: and(eq(variables['install.method'], 'pip' ), ne(variables['agent.os'], 'Windows_NT' )) + + - bash: | + echo python location: `where python` + echo python version: `python --version` + echo pytest location: `where pytest` + echo installed packages + python -m pip list + echo pyqtgraph system info + python -c "import pyqtgraph as pg; pg.systemInfo()" + displayName: 'Debug - System/Windows' + continueOnError: false + condition: and(eq(variables['install.method'], 'pip' ), eq(variables['agent.os'], 'Windows_NT' )) + + - bash: python3 -m pytest --cov pyqtgraph -sv --test-run-title="Tests for $(Agent.OS) - Python $(python.version) - Install Method $(install.method)- Bindings $(qt.bindings)" --napoleon-docstrings + displayName: 'Tests - Run - Pip/MacOS+Linux' + continueOnError: false + env: + DISPLAY: :99.0 + condition: and(eq(variables['install.method'], 'pip' ), ne(variables['agent.os'], 'Windows_NT' )) + + - bash: python -m pytest --cov pyqtgraph -sv --test-run-title="Tests for $(Agent.OS) - Python $(python.version) - Install Method $(install.method)- Bindings $(qt.bindings)" --napoleon-docstrings + displayName: 'Tests - Run - Pip/Windows' + continueOnError: false + env: + DISPLAY: :99.0 + condition: and(eq(variables['install.method'], 'pip' ), eq(variables['agent.os'], 'Windows_NT' )) + + - bash: | + source activate test_env + pytest --cov pyqtgraph -sv --test-run-title="Tests for $(Agent.OS) - Python $(python.version) - Install Method $(install.method)- Bindings $(qt.bindings)" --napoleon-docstrings + displayName: 'Tests - Run - Conda/MacOS+Linux' + continueOnError: false + env: + DISPLAY: :99.0 + condition: and(eq(variables['install.method'], 'conda' ), ne(variables['agent.os'], 'Windows_NT' )) + + - script: | + call activate test_env + python -m pytest --cov pyqtgraph -sv --test-run-title="Tests for $(Agent.OS) - Python $(python.version) - Install Method $(install.method)- Bindings $(qt.bindings)" --napoleon-docstrings + displayName: 'Tests - Run - Conda/Windows' + continueOnError: false + env: + DISPLAY: :99.0 + condition: and(eq(variables['install.method'], 'conda' ), eq(variables['agent.os'], 'Windows_NT' ))