2019-06-07 16:38:05 +00:00
|
|
|
# https://dev.azure.com/home-assistant
|
|
|
|
|
|
|
|
trigger:
|
|
|
|
batch: true
|
|
|
|
branches:
|
|
|
|
include:
|
|
|
|
- dev
|
2019-06-09 09:11:29 +00:00
|
|
|
pr: none
|
|
|
|
|
2019-06-07 19:16:39 +00:00
|
|
|
variables:
|
|
|
|
- name: ArtifactFeed
|
|
|
|
value: '2df3ae11-3bf6-49bc-a809-ba0d340d6a6d'
|
2019-06-09 09:11:29 +00:00
|
|
|
- name: PythonMain
|
2019-06-09 10:28:51 +00:00
|
|
|
value: '3.5'
|
2019-06-07 19:16:39 +00:00
|
|
|
|
|
|
|
|
2019-06-07 16:38:05 +00:00
|
|
|
jobs:
|
|
|
|
|
2019-06-09 09:11:29 +00:00
|
|
|
- job: 'Lint'
|
|
|
|
pool:
|
|
|
|
vmImage: 'ubuntu-latest'
|
|
|
|
steps:
|
2019-06-09 10:28:51 +00:00
|
|
|
- task: UsePythonVersion@0
|
|
|
|
inputs:
|
|
|
|
versionSpec: '$(PythonMain)'
|
2019-06-09 09:11:29 +00:00
|
|
|
- script: |
|
2019-06-09 09:25:24 +00:00
|
|
|
python -m venv lint
|
|
|
|
|
|
|
|
. lint/bin/activate
|
|
|
|
pip install flake8
|
2019-06-09 09:11:29 +00:00
|
|
|
flake8 homeassistant tests script
|
|
|
|
displayName: 'Run flake8'
|
|
|
|
|
|
|
|
|
2019-06-07 20:40:32 +00:00
|
|
|
- job: 'Check'
|
2019-06-09 09:11:29 +00:00
|
|
|
dependsOn:
|
|
|
|
- Lint
|
|
|
|
condition: succeeded()
|
2019-06-07 16:38:05 +00:00
|
|
|
pool:
|
|
|
|
vmImage: 'ubuntu-latest'
|
|
|
|
strategy:
|
2019-06-07 22:56:10 +00:00
|
|
|
maxParallel: 1
|
2019-06-07 16:38:05 +00:00
|
|
|
matrix:
|
|
|
|
Python35:
|
|
|
|
python.version: '3.5'
|
|
|
|
Python36:
|
|
|
|
python.version: '3.6'
|
|
|
|
Python37:
|
|
|
|
python.version: '3.7'
|
|
|
|
steps:
|
2019-06-09 10:28:51 +00:00
|
|
|
- task: UsePythonVersion@0
|
|
|
|
inputs:
|
|
|
|
versionSpec: '$(python.version)'
|
2019-06-07 16:38:05 +00:00
|
|
|
- script: |
|
2019-06-09 10:32:12 +00:00
|
|
|
set -e
|
|
|
|
|
2019-06-09 10:28:51 +00:00
|
|
|
sudo add-apt-repository ppa:jonathonf/ffmpeg-4
|
|
|
|
sudo apt-get update
|
2019-06-07 20:06:27 +00:00
|
|
|
|
2019-06-07 20:24:43 +00:00
|
|
|
echo "$(python.version)" > .cache
|
2019-06-07 16:38:05 +00:00
|
|
|
displayName: 'Set up docker prerequisite requirement'
|
|
|
|
|
|
|
|
- task: 1ESLighthouseEng.PipelineArtifactCaching.RestoreCacheV1.RestoreCache@1
|
|
|
|
displayName: 'Restore artifacts based on Requirements'
|
|
|
|
inputs:
|
2019-06-07 20:24:43 +00:00
|
|
|
keyfile: 'requirements_test_all.txt, .cache'
|
2019-06-07 20:06:27 +00:00
|
|
|
targetfolder: './venv'
|
2019-06-07 16:38:05 +00:00
|
|
|
vstsFeed: '$(ArtifactFeed)'
|
|
|
|
|
|
|
|
- script: |
|
2019-06-09 10:32:12 +00:00
|
|
|
set -e
|
|
|
|
|
2019-06-07 20:06:27 +00:00
|
|
|
# Install build env
|
2019-06-09 10:28:51 +00:00
|
|
|
sudo apt-get install -y --no-install-recommends \
|
|
|
|
libudev-dev libsqlite3-dev libavformat-dev libavcodec-dev libavdevice-dev libavutil-dev libswscale-dev libswresample-dev libavfilter-dev
|
2019-06-07 20:06:27 +00:00
|
|
|
|
|
|
|
# Setup venv
|
2019-06-07 22:55:03 +00:00
|
|
|
python -m venv venv
|
2019-06-09 10:32:12 +00:00
|
|
|
|
2019-06-07 16:38:05 +00:00
|
|
|
. venv/bin/activate
|
2019-06-07 19:16:39 +00:00
|
|
|
pip install -U pip setuptools
|
2019-06-09 09:11:29 +00:00
|
|
|
pip install -r requirements_test_all.txt -c homeassistant/package_constraints.txt
|
2019-06-07 16:38:05 +00:00
|
|
|
displayName: 'Create Virtual Environment & Install Requirements'
|
2019-06-09 10:38:01 +00:00
|
|
|
condition: and(succeeded(), ne(variables['CacheRestored'], 'true'))
|
2019-06-07 16:38:05 +00:00
|
|
|
|
|
|
|
- task: 1ESLighthouseEng.PipelineArtifactCaching.SaveCacheV1.SaveCache@1
|
|
|
|
displayName: 'Save artifacts based on Requirements'
|
|
|
|
inputs:
|
2019-06-07 20:24:43 +00:00
|
|
|
keyfile: 'requirements_test_all.txt, .cache'
|
2019-06-07 20:06:27 +00:00
|
|
|
targetfolder: './venv'
|
2019-06-07 20:34:44 +00:00
|
|
|
vstsFeed: '$(ArtifactFeed)'
|
|
|
|
|
|
|
|
- script: |
|
|
|
|
. venv/bin/activate
|
|
|
|
pip install -e .
|
|
|
|
displayName: 'Install Home Assistant for python $(python.version)'
|
2019-06-07 20:06:27 +00:00
|
|
|
|
2019-06-07 20:34:44 +00:00
|
|
|
- script: |
|
2019-06-07 20:24:43 +00:00
|
|
|
. venv/bin/activate
|
2019-06-07 20:43:07 +00:00
|
|
|
pytest --timeout=9 --durations=10 -qq -o console_output_style=count -p no:sugar tests
|
2019-06-07 20:24:43 +00:00
|
|
|
displayName: 'Run pytest for python $(python.version)'
|
2019-06-09 09:11:29 +00:00
|
|
|
|
|
|
|
- script: |
|
|
|
|
. venv/bin/activate
|
|
|
|
pip install -r requirements_all.txt -c homeassistant/package_constraints.txt
|
|
|
|
|
|
|
|
pylint homeassistant
|
|
|
|
displayName: 'Run pylint'
|
2019-06-09 10:38:01 +00:00
|
|
|
condition: and(succeeded(), eq(variables['python.version'], variables['PythonMain']))
|