From 7e83619527e950ba021ead4f537a734fa37ae521 Mon Sep 17 00:00:00 2001 From: Anton Volkov Date: Wed, 28 Oct 2026 12:04:11 +0100 Subject: [PATCH] Drop the conda package cache from the conda CI workflows The actions/cache steps in conda-build-test.yml cost 12-17% of the runner time of a conda-package or conda-package-cf run without making any step faster: - Build jobs never restored a cache: each run saves about sixty ~1 GB entries, so the previous run's entries are evicted before the next run starts. - Test jobs only restored the build job's package directory through the restore-keys prefix, and the Intel and conda-forge workflows shared the same keys, so about half of them got the other channel's packages and downloaded everything anyway. - The install step took the same time whether its 120-190 MB of packages came from the cache or from the channels. Remove both cache steps, the lockfile-only "Collect dependencies" step, CONDA_PKGS_DIRS and the pkgs-dir input, and replace the cache key note in .github/AGENTS.md. --- .github/AGENTS.md | 2 +- .github/workflows/conda-build-test.yml | 37 -------------------------- .github/workflows/conda-package-cf.yml | 3 --- .github/workflows/conda-package.yml | 2 -- 4 files changed, 1 insertion(+), 43 deletions(-) diff --git a/.github/AGENTS.md b/.github/AGENTS.md index 52ec913..a86c28b 100644 --- a/.github/AGENTS.md +++ b/.github/AGENTS.md @@ -35,4 +35,4 @@ All build/test workflows cover Python 3.10-3.15 plus free-threaded 3.14t and 3.1 ## Notes - Workflow/job renames are breaking for downstream tooling -- Cache key includes `meta.yaml` hash for conda packages +- Conda jobs do not cache the conda package directory: the channel downloads were faster than restoring the ~1 GB `actions/cache` entries, which were also evicted before the next run diff --git a/.github/workflows/conda-build-test.yml b/.github/workflows/conda-build-test.yml index 0f70ea0..216d004 100644 --- a/.github/workflows/conda-build-test.yml +++ b/.github/workflows/conda-build-test.yml @@ -11,10 +11,6 @@ on: description: Conda platform subdir (e.g. linux-64, win-64, osx-64) required: true type: string - pkgs-dir: - description: Directory to cache conda packages in - required: true - type: string channels-list: description: Conda channels to build and test against required: true @@ -70,7 +66,6 @@ jobs: env: build-env-name: 'build' - CONDA_PKGS_DIRS: ${{ inputs.pkgs-dir }} steps: - name: Checkout repo @@ -87,18 +82,6 @@ jobs: channels: conda-forge python-version: ${{ matrix.python }} - - name: Cache conda packages - uses: actions/cache@55cc8345863c7cc4c66a329aec7e433d2d1c52a9 # v6.1.0 - env: - CACHE_NUMBER: 0 # Increase to reset cache - with: - path: ${{ inputs.pkgs-dir }} - key: - ${{ runner.os }}-conda-${{ env.CACHE_NUMBER }}-python-${{ matrix.python_tag || matrix.python }}-${{hashFiles('**/meta.yaml') }} - restore-keys: | - ${{ runner.os }}-conda-${{ env.CACHE_NUMBER }}-python-${{ matrix.python_tag || matrix.python }}- - ${{ runner.os }}-conda-${{ env.CACHE_NUMBER }}- - - name: Install conda-build run: conda install -n base -y conda-build @@ -166,7 +149,6 @@ jobs: test-env-name: 'test' channel-path: './channel' pkg-path-in-channel: './channel/${{ inputs.conda-subdir }}' - CONDA_PKGS_DIRS: ${{ inputs.pkgs-dir }} steps: - name: Download artifact @@ -203,25 +185,6 @@ jobs: echo "PACKAGE_VERSION=${PACKAGE_VERSION}" echo "PACKAGE_VERSION=$PACKAGE_VERSION" >> "$GITHUB_ENV" - - name: Collect dependencies - run: | - conda install ${{ env.package-name }}=${{ env.PACKAGE_VERSION }} pytest "python=${{ matrix.python_spec || matrix.python }}" ${{ env.CHANNELS }} --only-deps --dry-run > lockfile - cat lockfile - env: - CHANNELS: '-c ${{ env.channel-path }} ${{ inputs.channels-list }}' - - - name: Cache conda packages - uses: actions/cache@55cc8345863c7cc4c66a329aec7e433d2d1c52a9 # v6.1.0 - env: - CACHE_NUMBER: 0 # Increase to reset cache - with: - path: ${{ inputs.pkgs-dir }} - key: - ${{ runner.os }}-conda-${{ env.CACHE_NUMBER }}-python-${{ matrix.python_tag || matrix.python }}-${{hashFiles('lockfile') }} - restore-keys: | - ${{ runner.os }}-conda-${{ env.CACHE_NUMBER }}-python-${{ matrix.python_tag || matrix.python }}- - ${{ runner.os }}-conda-${{ env.CACHE_NUMBER }}- - - name: Install mkl-service run: | conda install ${{ env.package-name }}=${{ env.PACKAGE_VERSION }} pytest "python=${{ matrix.python_spec || matrix.python }}" ${{ env.CHANNELS }} diff --git a/.github/workflows/conda-package-cf.yml b/.github/workflows/conda-package-cf.yml index b084275..2eb6293 100644 --- a/.github/workflows/conda-package-cf.yml +++ b/.github/workflows/conda-package-cf.yml @@ -20,7 +20,6 @@ jobs: with: runs-on: ubuntu-latest conda-subdir: linux-64 - pkgs-dir: /home/runner/conda_pkgs_dir channels-list: -c conda-forge --override-channels recipe-dir: conda-recipe-cf @@ -30,7 +29,6 @@ jobs: with: runs-on: windows-latest conda-subdir: win-64 - pkgs-dir: D:\conda_pkgs_dir channels-list: -c conda-forge --override-channels recipe-dir: conda-recipe-cf @@ -40,6 +38,5 @@ jobs: with: runs-on: macos-26-intel conda-subdir: osx-64 - pkgs-dir: /Users/runner/conda_pkgs_dir channels-list: -c conda-forge --override-channels recipe-dir: conda-recipe-cf diff --git a/.github/workflows/conda-package.yml b/.github/workflows/conda-package.yml index 970bcbf..5df35e5 100644 --- a/.github/workflows/conda-package.yml +++ b/.github/workflows/conda-package.yml @@ -20,7 +20,6 @@ jobs: with: runs-on: ubuntu-latest conda-subdir: linux-64 - pkgs-dir: /home/runner/conda_pkgs_dir channels-list: -c https://software.repos.intel.com/python/conda -c conda-forge --override-channels recipe-dir: conda-recipe build-wheels: true @@ -31,7 +30,6 @@ jobs: with: runs-on: windows-latest conda-subdir: win-64 - pkgs-dir: D:\conda_pkgs_dir channels-list: -c https://software.repos.intel.com/python/conda -c conda-forge --override-channels recipe-dir: conda-recipe build-wheels: true