Skip to content

Commit b41ddb6

Browse files
committed
Make conda's package directory configurable to speed up GitHub hosted Windows runners
1 parent 4f12d67 commit b41ddb6

File tree

1 file changed

+18
-12
lines changed

1 file changed

+18
-12
lines changed

.github/workflows/conda-package.yml

Lines changed: 18 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,23 @@ jobs:
5555
with:
5656
fetch-depth: 0
5757

58+
- name: Define conda's package directory
59+
run: |
60+
echo "CONDA_PKGS_DIR=${{ runner.os == 'Linux' && '/home/runner/' || 'D:\' }}conda_pkgs_dir" >> $GITHUB_ENV
61+
62+
- name: Cache conda packages
63+
uses: actions/cache@6849a6489940f00c2f30c0fb92c6274307ccb58a # v4.1.2
64+
env:
65+
CACHE_NUMBER: 2 # Increase to reset cache
66+
with:
67+
enableCrossOsArchive: 'true' # Use faster GNU tar
68+
path: ${{ env.CONDA_PKGS_DIR }}
69+
key:
70+
${{ runner.os }}-conda-${{ env.CACHE_NUMBER }}-python-${{ matrix.python }}-${{hashFiles('**/meta.yaml') }}
71+
restore-keys: |
72+
${{ runner.os }}-conda-${{ env.CACHE_NUMBER }}-python-${{ matrix.python }}-
73+
${{ runner.os }}-conda-${{ env.CACHE_NUMBER }}-
74+
5875
- name: Setup miniconda
5976
uses: conda-incubator/setup-miniconda@d2e6a045a86077fb6cad6f5adf368e9076ddaa8d # v3.1.0
6077
with:
@@ -63,6 +80,7 @@ jobs:
6380
channels: conda-forge
6481
python-version: ${{ matrix.python }}
6582
activate-environment: 'build'
83+
pkgs-dirs: ${{ env.CONDA_PKGS_DIR }}
6684

6785
# Here is an issue in conda gh-12356 causing adding defaults to the list of channels
6886
# upon running `conda config --append channels conda-forge`, while mamba requires to have only conda-forge channel
@@ -84,18 +102,6 @@ jobs:
84102
- name: Install conda-build
85103
run: mamba install conda-build=${{ env.CONDA_BUILD_VERSION}}
86104

87-
- name: Cache conda packages
88-
uses: actions/cache@6849a6489940f00c2f30c0fb92c6274307ccb58a # v4.1.2
89-
env:
90-
CACHE_NUMBER: 1 # Increase to reset cache
91-
with:
92-
path: ${{ runner.os == 'Linux' && '/home/runner/conda_pkgs_dir' || 'C:\Users\runneradmin\conda_pkgs_dir' }}
93-
key:
94-
${{ runner.os }}-conda-${{ env.CACHE_NUMBER }}-python-${{ matrix.python }}-${{hashFiles('**/meta.yaml') }}
95-
restore-keys: |
96-
${{ runner.os }}-conda-${{ env.CACHE_NUMBER }}-python-${{ matrix.python }}-
97-
${{ runner.os }}-conda-${{ env.CACHE_NUMBER }}-
98-
99105
- name: Build conda package
100106
run: conda build --no-test --python ${{ matrix.python }} --numpy 2.0 ${{ env.CHANNELS }} conda-recipe
101107
env:

0 commit comments

Comments
 (0)