diff --git a/azure-pipelines-ci.yml b/azure-pipelines-ci.yml index 6be504e2928..6d7a8974f1d 100644 --- a/azure-pipelines-ci.yml +++ b/azure-pipelines-ci.yml @@ -34,12 +34,27 @@ stages: vmImage: 'ubuntu-latest' container: $[ variables['PythonMain'] ] steps: + - task: CacheBeta@0 + inputs: + key: | + $(Build.SourcesDirectory)/requirements_test.txt + $(PythonMain) + path: $(Pipeline.Workspace)/venv.tar.gz + cacheHitVar: CacheRestored - script: | + set -e python -m venv venv . venv/bin/activate pip install -r requirements_test.txt - 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: | . venv/bin/activate flake8 homeassistant tests script @@ -92,7 +107,7 @@ stages: - script: | set -e python -m venv venv - + . venv/bin/activate pip install -U pip setuptools pip install -r requirements_test_all.txt -c homeassistant/package_constraints.txt