2019-06-07 16:38:05 +00:00
|
|
|
# https://dev.azure.com/home-assistant
|
|
|
|
|
|
|
|
trigger:
|
|
|
|
batch: true
|
|
|
|
branches:
|
|
|
|
include:
|
2019-07-18 21:19:52 +00:00
|
|
|
- rc
|
2019-06-07 16:38:05 +00:00
|
|
|
- dev
|
2019-07-18 21:19:52 +00:00
|
|
|
- master
|
2019-07-12 07:29:55 +00:00
|
|
|
pr:
|
2019-07-18 21:19:52 +00:00
|
|
|
- rc
|
2019-07-12 07:29:55 +00:00
|
|
|
- dev
|
2019-07-18 21:19:52 +00:00
|
|
|
- master
|
2019-06-09 09:11:29 +00:00
|
|
|
|
2019-06-09 12:26:42 +00:00
|
|
|
resources:
|
|
|
|
containers:
|
|
|
|
- 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:
|
2019-07-26 18:16:29 +00:00
|
|
|
- name: ArtifactFeed
|
|
|
|
value: '2df3ae11-3bf6-49bc-a809-ba0d340d6a6d'
|
2019-06-09 09:11:29 +00:00
|
|
|
- name: PythonMain
|
2019-07-30 23:44:39 +00:00
|
|
|
value: '36'
|
2019-07-12 09:27:31 +00:00
|
|
|
- group: codecov
|
2019-06-07 19:16:39 +00:00
|
|
|
|
2019-06-28 17:35:17 +00:00
|
|
|
stages:
|
|
|
|
|
|
|
|
- stage: 'Overview'
|
|
|
|
jobs:
|
|
|
|
- job: 'Lint'
|
|
|
|
pool:
|
|
|
|
vmImage: 'ubuntu-latest'
|
|
|
|
container: $[ variables['PythonMain'] ]
|
|
|
|
steps:
|
|
|
|
- script: |
|
2019-06-28 20:08:29 +00:00
|
|
|
python -m venv venv
|
|
|
|
|
|
|
|
. venv/bin/activate
|
2019-07-30 23:59:12 +00:00
|
|
|
pip install -r requirements_test.txt -c homeassistant/package_constraints.txt
|
2019-07-26 18:16:29 +00:00
|
|
|
displayName: 'Setup Env'
|
2019-06-28 20:08:29 +00:00
|
|
|
- script: |
|
2019-06-28 20:18:52 +00:00
|
|
|
. venv/bin/activate
|
2019-06-28 17:35:17 +00:00
|
|
|
flake8 homeassistant tests script
|
|
|
|
displayName: 'Run flake8'
|
2019-06-28 20:08:29 +00:00
|
|
|
- job: 'Validate'
|
|
|
|
pool:
|
|
|
|
vmImage: 'ubuntu-latest'
|
|
|
|
container: $[ variables['PythonMain'] ]
|
|
|
|
steps:
|
|
|
|
- script: |
|
|
|
|
python -m venv venv
|
|
|
|
|
|
|
|
. venv/bin/activate
|
2019-06-28 20:18:52 +00:00
|
|
|
pip install -e .
|
2019-06-28 20:08:29 +00:00
|
|
|
displayName: 'Setup Env'
|
|
|
|
- script: |
|
|
|
|
. venv/bin/activate
|
|
|
|
python -m script.hassfest validate
|
|
|
|
displayName: 'Validate manifests'
|
|
|
|
- script: |
|
|
|
|
. venv/bin/activate
|
2019-06-28 20:18:52 +00:00
|
|
|
./script/gen_requirements_all.py validate
|
2019-06-28 20:08:29 +00:00
|
|
|
displayName: 'requirements_all validate'
|
2019-07-30 23:59:12 +00:00
|
|
|
- job: 'CheckFormat'
|
|
|
|
pool:
|
|
|
|
vmImage: 'ubuntu-latest'
|
|
|
|
container: $[ variables['PythonMain'] ]
|
|
|
|
steps:
|
|
|
|
- script: |
|
|
|
|
python -m venv venv
|
|
|
|
|
|
|
|
. venv/bin/activate
|
|
|
|
pip install -r requirements_test.txt -c homeassistant/package_constraints.txt
|
|
|
|
displayName: 'Setup Env'
|
|
|
|
- script: |
|
|
|
|
. venv/bin/activate
|
|
|
|
./script/check_format
|
|
|
|
displayName: 'Check Black formatting'
|
2019-06-28 17:35:17 +00:00
|
|
|
|
|
|
|
- stage: 'Tests'
|
2019-06-09 09:11:29 +00:00
|
|
|
dependsOn:
|
2019-06-28 17:35:17 +00:00
|
|
|
- 'Overview'
|
|
|
|
jobs:
|
2019-06-28 20:08:29 +00:00
|
|
|
- job: 'PyTest'
|
2019-06-28 17:35:17 +00:00
|
|
|
pool:
|
|
|
|
vmImage: 'ubuntu-latest'
|
|
|
|
strategy:
|
|
|
|
maxParallel: 3
|
|
|
|
matrix:
|
|
|
|
Python36:
|
|
|
|
python.container: '36'
|
|
|
|
Python37:
|
|
|
|
python.container: '37'
|
|
|
|
container: $[ variables['python.container'] ]
|
|
|
|
steps:
|
2019-07-26 18:16:29 +00:00
|
|
|
- script: |
|
|
|
|
python --version > .cache
|
|
|
|
displayName: 'Set python $(python.container) for requirement cache'
|
|
|
|
- task: 1ESLighthouseEng.PipelineArtifactCaching.RestoreCacheV1.RestoreCache@1
|
|
|
|
displayName: 'Restore artifacts based on Requirements'
|
2019-06-28 17:35:17 +00:00
|
|
|
inputs:
|
2019-07-26 18:16:29 +00:00
|
|
|
keyfile: 'requirements_test_all.txt, .cache'
|
|
|
|
targetfolder: './venv'
|
2019-07-30 23:44:39 +00:00
|
|
|
vstsFeed: '$(ArtifactFeed)'
|
2019-06-28 17:35:17 +00:00
|
|
|
- script: |
|
|
|
|
set -e
|
|
|
|
python -m venv venv
|
2019-07-30 23:44:39 +00:00
|
|
|
|
2019-06-28 17:35:17 +00:00
|
|
|
. venv/bin/activate
|
2019-07-31 07:00:50 +00:00
|
|
|
pip install -U pip setuptools pytest-azurepipelines -c homeassistant/package_constraints.txt
|
2019-06-28 17:35:17 +00:00
|
|
|
pip install -r requirements_test_all.txt -c homeassistant/package_constraints.txt
|
|
|
|
displayName: 'Create Virtual Environment & Install Requirements'
|
|
|
|
condition: and(succeeded(), ne(variables['CacheRestored'], 'true'))
|
2019-07-26 18:16:29 +00:00
|
|
|
# Explicit Cache Save (instead of using RestoreAndSaveCache)
|
2019-07-30 23:44:39 +00:00
|
|
|
# Dont wait with cache save for all the other task in this job to complete (±30 minutes), other parallel jobs might utilize this
|
|
|
|
- task: 1ESLighthouseEng.PipelineArtifactCaching.SaveCacheV1.SaveCache@1
|
|
|
|
displayName: 'Save artifacts based on Requirements'
|
|
|
|
inputs:
|
|
|
|
keyfile: 'requirements_test_all.txt, .cache'
|
|
|
|
targetfolder: './venv'
|
2019-07-26 18:16:29 +00:00
|
|
|
vstsFeed: '$(ArtifactFeed)'
|
2019-07-30 23:44:39 +00:00
|
|
|
- script: |
|
2019-06-28 17:35:17 +00:00
|
|
|
. venv/bin/activate
|
|
|
|
pip install -e .
|
2019-07-30 23:44:39 +00:00
|
|
|
displayName: 'Install Home Assistant for python $(python.container)'
|
|
|
|
- script: |
|
2019-06-28 17:35:17 +00:00
|
|
|
. venv/bin/activate
|
2019-07-12 09:27:31 +00:00
|
|
|
pytest --timeout=9 --durations=10 --junitxml=test-results.xml -qq -o console_output_style=count -p no:sugar tests
|
2019-07-12 10:08:53 +00:00
|
|
|
displayName: 'Run pytest for python $(python.container)'
|
2019-07-12 09:27:31 +00:00
|
|
|
condition: and(succeeded(), ne(variables['python.container'], variables['PythonMain']))
|
|
|
|
- script: |
|
2019-07-26 14:10:22 +00:00
|
|
|
set -e
|
|
|
|
|
2019-07-12 09:27:31 +00:00
|
|
|
. venv/bin/activate
|
2019-07-26 18:16:29 +00:00
|
|
|
pytest --timeout=9 --durations=10 --junitxml=test-results.xml --cov --cov-report=xml -qq -o console_output_style=count -p no:sugar tests
|
2019-07-28 10:39:06 +00:00
|
|
|
codecov --token $(codecovToken)
|
2019-07-12 10:08:53 +00:00
|
|
|
displayName: 'Run pytest for python $(python.container) / coverage'
|
2019-07-12 09:27:31 +00:00
|
|
|
condition: and(succeeded(), eq(variables['python.container'], variables['PythonMain']))
|
2019-06-28 17:35:17 +00:00
|
|
|
- task: PublishTestResults@2
|
|
|
|
condition: succeededOrFailed()
|
|
|
|
inputs:
|
2019-07-12 09:27:31 +00:00
|
|
|
testResultsFiles: 'test-results.xml'
|
2019-07-12 10:08:53 +00:00
|
|
|
testRunTitle: 'Publish test results for Python $(python.container)'
|
2019-07-12 09:27:31 +00:00
|
|
|
- task: PublishCodeCoverageResults@1
|
|
|
|
inputs:
|
|
|
|
codeCoverageTool: cobertura
|
2019-07-26 18:16:29 +00:00
|
|
|
summaryFileLocation: coverage.xml
|
2019-07-12 09:27:31 +00:00
|
|
|
displayName: 'publish coverage artifact'
|
|
|
|
condition: and(succeeded(), eq(variables['python.container'], variables['PythonMain']))
|
2019-06-28 17:35:17 +00:00
|
|
|
|
|
|
|
- stage: 'FullCheck'
|
2019-06-09 13:32:30 +00:00
|
|
|
dependsOn:
|
2019-06-28 17:35:17 +00:00
|
|
|
- 'Overview'
|
|
|
|
jobs:
|
2019-07-16 15:47:07 +00:00
|
|
|
- job: 'Pylint'
|
2019-06-28 17:35:17 +00:00
|
|
|
pool:
|
|
|
|
vmImage: 'ubuntu-latest'
|
|
|
|
container: $[ variables['PythonMain'] ]
|
|
|
|
steps:
|
2019-07-26 18:16:29 +00:00
|
|
|
- script: |
|
|
|
|
python --version > .cache
|
|
|
|
displayName: 'Set python $(PythonMain) for requirement cache'
|
|
|
|
- task: 1ESLighthouseEng.PipelineArtifactCaching.RestoreCacheV1.RestoreCache@1
|
|
|
|
displayName: 'Restore artifacts based on Requirements'
|
2019-06-28 17:35:17 +00:00
|
|
|
inputs:
|
2019-07-26 18:16:29 +00:00
|
|
|
keyfile: 'requirements_all.txt, requirements_test.txt, .cache'
|
|
|
|
targetfolder: './venv'
|
2019-07-30 23:44:39 +00:00
|
|
|
vstsFeed: '$(ArtifactFeed)'
|
2019-06-28 17:35:17 +00:00
|
|
|
- script: |
|
|
|
|
set -e
|
|
|
|
python -m venv venv
|
2019-07-30 23:44:39 +00:00
|
|
|
|
2019-06-28 17:35:17 +00:00
|
|
|
. venv/bin/activate
|
|
|
|
pip install -U pip setuptools
|
|
|
|
pip install -r requirements_all.txt -c homeassistant/package_constraints.txt
|
|
|
|
pip install -r requirements_test.txt -c homeassistant/package_constraints.txt
|
|
|
|
displayName: 'Create Virtual Environment & Install Requirements'
|
|
|
|
condition: and(succeeded(), ne(variables['CacheRestored'], 'true'))
|
2019-07-26 18:16:29 +00:00
|
|
|
- task: 1ESLighthouseEng.PipelineArtifactCaching.SaveCacheV1.SaveCache@1
|
|
|
|
displayName: 'Save artifacts based on Requirements'
|
|
|
|
inputs:
|
|
|
|
keyfile: 'requirements_all.txt, requirements_test.txt, .cache'
|
|
|
|
targetfolder: './venv'
|
|
|
|
vstsFeed: '$(ArtifactFeed)'
|
2019-07-30 23:44:39 +00:00
|
|
|
- script: |
|
2019-06-28 17:35:17 +00:00
|
|
|
. venv/bin/activate
|
|
|
|
pip install -e .
|
2019-07-30 23:44:39 +00:00
|
|
|
displayName: 'Install Home Assistant for python $(PythonMain)'
|
2019-06-28 17:35:17 +00:00
|
|
|
- script: |
|
|
|
|
. venv/bin/activate
|
|
|
|
pylint homeassistant
|
|
|
|
displayName: 'Run pylint'
|
2019-06-28 20:31:27 +00:00
|
|
|
- job: 'Mypy'
|
|
|
|
pool:
|
|
|
|
vmImage: 'ubuntu-latest'
|
|
|
|
container: $[ variables['PythonMain'] ]
|
|
|
|
steps:
|
|
|
|
- script: |
|
|
|
|
python -m venv venv
|
|
|
|
|
|
|
|
. venv/bin/activate
|
2019-07-31 07:00:50 +00:00
|
|
|
pip install -r requirements_test.txt -c homeassistant/package_constraints.txt
|
2019-06-28 20:31:27 +00:00
|
|
|
displayName: 'Setup Env'
|
|
|
|
- script: |
|
2019-07-31 07:26:47 +00:00
|
|
|
TYPING_FILES=$(cat mypyrc)
|
|
|
|
echo -e "Run mypy on: \n$TYPING_FILES"
|
|
|
|
|
2019-06-28 20:31:27 +00:00
|
|
|
. venv/bin/activate
|
2019-07-31 07:26:47 +00:00
|
|
|
mypy $TYPING_FILES
|
2019-07-30 23:44:39 +00:00
|
|
|
displayName: 'Run mypy'
|