Skip to content

CI: Add Cache task on Windows #43966

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 2 commits into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 18 additions & 0 deletions ci/azure/windows.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,11 @@ parameters:
name: ''
vmImage: ''


variables:
CONDA_CACHE_DIR: $(Pipeline.Workspace)/.condarc


jobs:
- job: ${{ parameters.name }}
pool:
Expand Down Expand Up @@ -41,12 +46,25 @@ jobs:
Write-Host "##vso[task.prependpath]$env:CONDA\Scripts"
Write-Host "##vso[task.prependpath]$HOME/miniconda3/bin"
displayName: 'Add conda to PATH'

- task: Cache@2
displayName: Use cached Anaconda environment
inputs:
key: 'conda | "$(Agent.OS)" | "ci\deps\azure-windows-$(CONDA_PY).yaml"'
Copy link
Member

@fangchenli fangchenli Oct 11, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think the third key should be a file path (without the double quotes). Another concern is that we don't specify the exact version of dependencies in those yaml files. So their updates won't get reflected in this hash. We might need some kind of lock file, like this one https://github.com/conda-incubator/conda-lock, for this.

restoreKeys: |
python | "$(Agent.OS)"
python
path: $(CONDA_CACHE_DIR)
cacheHitVar: CONDA_CACHE_RESTORED

- script: conda update -q -n base conda
displayName: 'Update conda'

- bash: |
conda env create -q --file ci\\deps\\azure-windows-$(CONDA_PY).yaml
displayName: 'Create anaconda environment'
condition: eq(variables.CONDA_CACHE_RESTORED, 'false')

- bash: |
source activate pandas-dev
conda list
Expand Down