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-09 12:26:42 +00:00
|
|
|
resources:
|
|
|
|
containers:
|
|
|
|
- container: 35
|
|
|
|
image: homeassistant/ci-azure:3.5
|
|
|
|
- container: 36
|
|
|
|
image: homeassistant/ci-azure:3.6
|
|
|
|
- container: 37
|
|
|
|
image: homeassistant/ci-azure:3.7
|
|
|
|
|
|
|
|
|
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 12:26:42 +00:00
|
|
|
value: '35'
|
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'
|
2019-06-09 12:26:42 +00:00
|
|
|
container: $[ variables['PythonMain'] ]
|
2019-06-09 09:11:29 +00:00
|
|
|
steps:
|
|
|
|
- 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
|
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'
|
2019-06-09 12:26:42 +00:00
|
|
|
python.container: '35'
|
2019-06-07 16:38:05 +00:00
|
|
|
Python36:
|
|
|
|
python.version: '3.6'
|
2019-06-09 12:26:42 +00:00
|
|
|
python.container: '36'
|
2019-06-07 16:38:05 +00:00
|
|
|
Python37:
|
|
|
|
python.version: '3.7'
|
2019-06-09 12:26:42 +00:00
|
|
|
python.container: '37'
|
|
|
|
container: $[ variables['python.container'] ]
|
2019-06-07 16:38:05 +00:00
|
|
|
steps:
|
|
|
|
- script: |
|
2019-06-07 20:24:43 +00:00
|
|
|
echo "$(python.version)" > .cache
|
2019-06-09 12:47:03 +00:00
|
|
|
displayName: 'Set python $(python.version) for requirement cache'
|
2019-06-07 16:38:05 +00:00
|
|
|
|
|
|
|
- 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 22:55:03 +00:00
|
|
|
python -m venv venv
|
2019-06-09 12:26:42 +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-10 19:22:23 +00:00
|
|
|
pytest --timeout=9 --durations=10 --junitxml=junit/test-results.xml -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
|
|
|
|
2019-06-10 19:22:23 +00:00
|
|
|
- task: PublishTestResults@2
|
|
|
|
condition: succeededOrFailed()
|
|
|
|
inputs:
|
|
|
|
testResultsFiles: '**/test-*.xml'
|
|
|
|
testRunTitle: 'Publish test results for Python $(python.version)'
|
2019-06-09 13:32:30 +00:00
|
|
|
|
|
|
|
- job: 'FullCheck'
|
|
|
|
dependsOn:
|
|
|
|
- Check
|
|
|
|
pool:
|
|
|
|
vmImage: 'ubuntu-latest'
|
|
|
|
container: $[ variables['PythonMain'] ]
|
|
|
|
steps:
|
|
|
|
- script: |
|
|
|
|
echo "$(PythonMain)" > .cache
|
|
|
|
displayName: 'Set python $(python.version) for requirement cache'
|
|
|
|
- task: 1ESLighthouseEng.PipelineArtifactCaching.RestoreCacheV1.RestoreCache@1
|
|
|
|
displayName: 'Restore artifacts based on Requirements'
|
|
|
|
inputs:
|
2019-06-09 15:41:15 +00:00
|
|
|
keyfile: 'requirements_all.txt, requirements_test.txt, .cache'
|
2019-06-09 13:32:30 +00:00
|
|
|
targetfolder: './venv'
|
|
|
|
vstsFeed: '$(ArtifactFeed)'
|
|
|
|
|
|
|
|
- script: |
|
|
|
|
set -e
|
|
|
|
python -m venv venv
|
|
|
|
|
|
|
|
. venv/bin/activate
|
|
|
|
pip install -U pip setuptools
|
|
|
|
pip install -r requirements_all.txt -c homeassistant/package_constraints.txt
|
2019-06-09 15:41:15 +00:00
|
|
|
pip install -r requirements_test.txt -c homeassistant/package_constraints.txt
|
2019-06-09 13:32:30 +00:00
|
|
|
displayName: 'Create Virtual Environment & Install Requirements'
|
|
|
|
condition: and(succeeded(), ne(variables['CacheRestored'], 'true'))
|
|
|
|
|
|
|
|
- task: 1ESLighthouseEng.PipelineArtifactCaching.SaveCacheV1.SaveCache@1
|
|
|
|
displayName: 'Save artifacts based on Requirements'
|
|
|
|
inputs:
|
2019-06-09 15:41:15 +00:00
|
|
|
keyfile: 'requirements_all.txt, requirements_test.txt, .cache'
|
2019-06-09 13:32:30 +00:00
|
|
|
targetfolder: './venv'
|
|
|
|
vstsFeed: '$(ArtifactFeed)'
|
|
|
|
|
|
|
|
- script: |
|
|
|
|
. venv/bin/activate
|
|
|
|
pip install -e .
|
|
|
|
displayName: 'Install Home Assistant for python $(python.version)'
|
|
|
|
|
2019-06-09 09:11:29 +00:00
|
|
|
- script: |
|
|
|
|
. venv/bin/activate
|
|
|
|
pylint homeassistant
|
|
|
|
displayName: 'Run pylint'
|
2019-06-09 13:32:30 +00:00
|
|
|
|