From 97837504205ac8ce9e01ed2940f7d6a11fbd5f77 Mon Sep 17 00:00:00 2001 From: Maximilian Roos Date: Wed, 27 Apr 2022 19:01:21 -0700 Subject: [PATCH] Attempt to improve CI caching Currently about 40% of the time is taken by installing things, hopefully we can cut that down --- .github/workflows/ci-additional.yaml | 7 +++---- .github/workflows/ci.yaml | 12 ++++++++++++ 2 files changed, 15 insertions(+), 4 deletions(-) diff --git a/.github/workflows/ci-additional.yaml b/.github/workflows/ci-additional.yaml index c43dd1ad46a..8d4e63e583c 100644 --- a/.github/workflows/ci-additional.yaml +++ b/.github/workflows/ci-additional.yaml @@ -42,8 +42,7 @@ jobs: fail-fast: false matrix: os: ["ubuntu-latest"] - env: - [ + env: [ # Minimum python version: "py38-bare-minimum", "py38-min-all-deps", @@ -67,12 +66,12 @@ jobs: else echo "CONDA_ENV_FILE=ci/requirements/${{ matrix.env }}.yml" >> $GITHUB_ENV fi + - name: Cache conda uses: actions/cache@v3 with: path: ~/conda_pkgs_dir - key: - ${{ runner.os }}-conda-${{ matrix.env }}-${{ + key: ${{ runner.os }}-conda-${{ matrix.env }}-${{ hashFiles('ci/requirements/**.yml') }} - uses: conda-incubator/setup-miniconda@v2 diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index f43506616ac..736f9d19e5e 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -58,12 +58,15 @@ jobs: fi echo "PYTHON_VERSION=${{ matrix.python-version }}" >> $GITHUB_ENV + # This and the next few are based on https://github.com/conda-incubator/setup-miniconda#caching-environments - name: Cache conda + id: cache uses: actions/cache@v3 with: path: ~/conda_pkgs_dir key: ${{ runner.os }}-conda-py${{ matrix.python-version }}-${{ hashFiles('ci/requirements/**.yml') }} + - uses: conda-incubator/setup-miniconda@v2 with: channels: conda-forge @@ -74,9 +77,18 @@ jobs: python-version: ${{ matrix.python-version }} use-only-tar-bz2: true + - name: Cache conda env + id: cache + uses: actions/cache@v3 + with: + path: ${{ env.CONDA }}/envs + key: ${{ runner.os }}-conda-py${{ matrix.python-version }}-${{ + hashFiles('ci/requirements/**.yml') }} + - name: Install conda dependencies run: | mamba env update -f $CONDA_ENV_FILE + if: steps.cache.outputs.cache-hit != 'true' # We only want to install this on one run, because otherwise we'll have # duplicate annotations.