mirror of
https://github.com/home-assistant/core.git
synced 2025-07-23 21:27:38 +00:00
Update azure-pipelines-ci.yml for Azure Pipelines
This commit is contained in:
parent
230ca9b89d
commit
1c3e5988db
@ -21,6 +21,8 @@ resources:
|
|||||||
- container: 37
|
- container: 37
|
||||||
image: homeassistant/ci-azure:3.7
|
image: homeassistant/ci-azure:3.7
|
||||||
variables:
|
variables:
|
||||||
|
- name: ArtifactFeed
|
||||||
|
value: '2df3ae11-3bf6-49bc-a809-ba0d340d6a6d'
|
||||||
- name: PythonMain
|
- name: PythonMain
|
||||||
value: '35'
|
value: '35'
|
||||||
- group: codecov
|
- group: codecov
|
||||||
@ -34,27 +36,12 @@ stages:
|
|||||||
vmImage: 'ubuntu-latest'
|
vmImage: 'ubuntu-latest'
|
||||||
container: $[ variables['PythonMain'] ]
|
container: $[ variables['PythonMain'] ]
|
||||||
steps:
|
steps:
|
||||||
- task: CacheBeta@0
|
|
||||||
inputs:
|
|
||||||
key: |
|
|
||||||
$(Build.SourcesDirectory)/requirements_test.txt
|
|
||||||
$(PythonMain)
|
|
||||||
path: $(Pipeline.Workspace)/venv.tar.gz
|
|
||||||
cacheHitVar: CacheRestored
|
|
||||||
- script: |
|
- script: |
|
||||||
set -e
|
|
||||||
python -m venv venv
|
python -m venv venv
|
||||||
|
|
||||||
. venv/bin/activate
|
. venv/bin/activate
|
||||||
pip install -r requirements_test.txt
|
pip install flake8
|
||||||
|
displayName: 'Setup Env'
|
||||||
tar -czf $(Pipeline.Workspace)/venv.tar.gz venv
|
|
||||||
displayName: 'Create Virtual Environment & Install Requirements'
|
|
||||||
condition: and(succeeded(), ne(variables['CacheRestored'], 'true'))
|
|
||||||
- script: |
|
|
||||||
tar -xzf $(Pipeline.Workspace)/venv.tar.gz
|
|
||||||
displayName: 'Restore Virtual Environment'
|
|
||||||
condition: and(succeeded(), eq(variables['CacheRestored'], 'true'))
|
|
||||||
- script: |
|
- script: |
|
||||||
. venv/bin/activate
|
. venv/bin/activate
|
||||||
flake8 homeassistant tests script
|
flake8 homeassistant tests script
|
||||||
@ -97,13 +84,15 @@ stages:
|
|||||||
python.container: '37'
|
python.container: '37'
|
||||||
container: $[ variables['python.container'] ]
|
container: $[ variables['python.container'] ]
|
||||||
steps:
|
steps:
|
||||||
- task: CacheBeta@0
|
- script: |
|
||||||
|
python --version > .cache
|
||||||
|
displayName: 'Set python $(python.container) for requirement cache'
|
||||||
|
- task: 1ESLighthouseEng.PipelineArtifactCaching.RestoreCacheV1.RestoreCache@1
|
||||||
|
displayName: 'Restore artifacts based on Requirements'
|
||||||
inputs:
|
inputs:
|
||||||
key: |
|
keyfile: 'requirements_test_all.txt, .cache'
|
||||||
$(Build.SourcesDirectory)/requirements_test_all.txt
|
targetfolder: './venv'
|
||||||
$(python.container)
|
vstsFeed: '$(ArtifactFeed)'
|
||||||
path: $(Pipeline.Workspace)/venv.tar.gz
|
|
||||||
cacheHitVar: CacheRestored
|
|
||||||
- script: |
|
- script: |
|
||||||
set -e
|
set -e
|
||||||
python -m venv venv
|
python -m venv venv
|
||||||
@ -112,14 +101,16 @@ stages:
|
|||||||
pip install -U pip setuptools
|
pip install -U pip setuptools
|
||||||
pip install -r requirements_test_all.txt -c homeassistant/package_constraints.txt
|
pip install -r requirements_test_all.txt -c homeassistant/package_constraints.txt
|
||||||
pip install pytest-azurepipelines -c homeassistant/package_constraints.txt
|
pip install pytest-azurepipelines -c homeassistant/package_constraints.txt
|
||||||
|
|
||||||
tar -czf $(Pipeline.Workspace)/venv.tar.gz venv
|
|
||||||
displayName: 'Create Virtual Environment & Install Requirements'
|
displayName: 'Create Virtual Environment & Install Requirements'
|
||||||
condition: and(succeeded(), ne(variables['CacheRestored'], 'true'))
|
condition: and(succeeded(), ne(variables['CacheRestored'], 'true'))
|
||||||
- script: |
|
# Explicit Cache Save (instead of using RestoreAndSaveCache)
|
||||||
tar -xzf $(Pipeline.Workspace)/venv.tar.gz
|
# Dont wait with cache save for all the other task in this job to complete (±30 minutes), other parallel jobs might utilize this
|
||||||
displayName: 'Restore Virtual Environment'
|
- task: 1ESLighthouseEng.PipelineArtifactCaching.SaveCacheV1.SaveCache@1
|
||||||
condition: and(succeeded(), eq(variables['CacheRestored'], 'true'))
|
displayName: 'Save artifacts based on Requirements'
|
||||||
|
inputs:
|
||||||
|
keyfile: 'requirements_test_all.txt, .cache'
|
||||||
|
targetfolder: './venv'
|
||||||
|
vstsFeed: '$(ArtifactFeed)'
|
||||||
- script: |
|
- script: |
|
||||||
. venv/bin/activate
|
. venv/bin/activate
|
||||||
pip install -e .
|
pip install -e .
|
||||||
@ -133,7 +124,7 @@ stages:
|
|||||||
set -e
|
set -e
|
||||||
|
|
||||||
. venv/bin/activate
|
. venv/bin/activate
|
||||||
pytest --timeout=9 --durations=10 --junitxml=test-results.xml --cov --cov-report=html -qq -o console_output_style=count -p no:sugar tests
|
pytest --timeout=9 --durations=10 --junitxml=test-results.xml --cov --cov-report=xml -qq -o console_output_style=count -p no:sugar tests
|
||||||
codecov --token=$(codecovToken)
|
codecov --token=$(codecovToken)
|
||||||
displayName: 'Run pytest for python $(python.container) / coverage'
|
displayName: 'Run pytest for python $(python.container) / coverage'
|
||||||
condition: and(succeeded(), eq(variables['python.container'], variables['PythonMain']))
|
condition: and(succeeded(), eq(variables['python.container'], variables['PythonMain']))
|
||||||
@ -145,7 +136,7 @@ stages:
|
|||||||
- task: PublishCodeCoverageResults@1
|
- task: PublishCodeCoverageResults@1
|
||||||
inputs:
|
inputs:
|
||||||
codeCoverageTool: cobertura
|
codeCoverageTool: cobertura
|
||||||
summaryFileLocation: coverage.html
|
summaryFileLocation: coverage.xml
|
||||||
displayName: 'publish coverage artifact'
|
displayName: 'publish coverage artifact'
|
||||||
condition: and(succeeded(), eq(variables['python.container'], variables['PythonMain']))
|
condition: and(succeeded(), eq(variables['python.container'], variables['PythonMain']))
|
||||||
|
|
||||||
@ -158,14 +149,15 @@ stages:
|
|||||||
vmImage: 'ubuntu-latest'
|
vmImage: 'ubuntu-latest'
|
||||||
container: $[ variables['PythonMain'] ]
|
container: $[ variables['PythonMain'] ]
|
||||||
steps:
|
steps:
|
||||||
- task: CacheBeta@0
|
- script: |
|
||||||
|
python --version > .cache
|
||||||
|
displayName: 'Set python $(PythonMain) for requirement cache'
|
||||||
|
- task: 1ESLighthouseEng.PipelineArtifactCaching.RestoreCacheV1.RestoreCache@1
|
||||||
|
displayName: 'Restore artifacts based on Requirements'
|
||||||
inputs:
|
inputs:
|
||||||
key: |
|
keyfile: 'requirements_all.txt, requirements_test.txt, .cache'
|
||||||
$(Build.SourcesDirectory)/requirements_all.txt
|
targetfolder: './venv'
|
||||||
$(Build.SourcesDirectory)/requirements_test.txt
|
vstsFeed: '$(ArtifactFeed)'
|
||||||
$(PythonMain)
|
|
||||||
path: $(Pipeline.Workspace)/venv.tar.gz
|
|
||||||
cacheHitVar: CacheRestored
|
|
||||||
- script: |
|
- script: |
|
||||||
set -e
|
set -e
|
||||||
python -m venv venv
|
python -m venv venv
|
||||||
@ -174,14 +166,14 @@ stages:
|
|||||||
pip install -U pip setuptools
|
pip install -U pip setuptools
|
||||||
pip install -r requirements_all.txt -c homeassistant/package_constraints.txt
|
pip install -r requirements_all.txt -c homeassistant/package_constraints.txt
|
||||||
pip install -r requirements_test.txt -c homeassistant/package_constraints.txt
|
pip install -r requirements_test.txt -c homeassistant/package_constraints.txt
|
||||||
|
|
||||||
tar -czf $(Pipeline.Workspace)/venv.tar.gz venv
|
|
||||||
displayName: 'Create Virtual Environment & Install Requirements'
|
displayName: 'Create Virtual Environment & Install Requirements'
|
||||||
condition: and(succeeded(), ne(variables['CacheRestored'], 'true'))
|
condition: and(succeeded(), ne(variables['CacheRestored'], 'true'))
|
||||||
- script: |
|
- task: 1ESLighthouseEng.PipelineArtifactCaching.SaveCacheV1.SaveCache@1
|
||||||
tar -xzf $(Pipeline.Workspace)/venv.tar.gz
|
displayName: 'Save artifacts based on Requirements'
|
||||||
displayName: 'Restore Virtual Environment'
|
inputs:
|
||||||
condition: and(succeeded(), eq(variables['CacheRestored'], 'true'))
|
keyfile: 'requirements_all.txt, requirements_test.txt, .cache'
|
||||||
|
targetfolder: './venv'
|
||||||
|
vstsFeed: '$(ArtifactFeed)'
|
||||||
- script: |
|
- script: |
|
||||||
. venv/bin/activate
|
. venv/bin/activate
|
||||||
pip install -e .
|
pip install -e .
|
||||||
|
Loading…
x
Reference in New Issue
Block a user