From de9d3afdc74d29517ea911efe1496d33a677056b Mon Sep 17 00:00:00 2001 From: "Lanzrath, Hannah" Date: Fri, 6 Dec 2024 12:52:31 +0100 Subject: [PATCH] Save 30 seconds with this way of caching? --- .github/workflows/pipeline.yml | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/.github/workflows/pipeline.yml b/.github/workflows/pipeline.yml index 602afef8..f55ae56b 100644 --- a/.github/workflows/pipeline.yml +++ b/.github/workflows/pipeline.yml @@ -39,11 +39,12 @@ jobs: run: echo "today=$(/bin/date -u '+%Y%m%d')" >> $GITHUB_OUTPUT shell: bash - - name: Restore cache and save updated environment after job + - name: Restore cache uses: actions/cache@v4 with: path: ${{ env.CONDA }}/envs key: ${{ matrix.os }}-python_${{ matrix.python-version }}-${{ steps.get-date.outputs.today }}-${{ hashFiles(env.CONDA_FILE) }}-${{ env.CACHE_NUMBER }} + lookup-only: true id: cache - name: No cache found - Create new environment with Miniforge @@ -58,6 +59,13 @@ jobs: auto-activate-base: false if: steps.cache.outputs.cache-hit != 'true' + - name: Save cache only when it does not exist already + if: steps.cache.outputs.cache-hit != 'true' + uses: actions/cache@v4 + with: + path: ${{ env.CONDA }}/envs + key: ${{ matrix.os }}-python_${{ matrix.python-version }}-${{ hashFiles(env.CONDA_FILE) }}-${{ env.CACHE_NUMBER }} + - name: Install CADET-Process run: | pip install -e ./[testing] @@ -67,7 +75,7 @@ jobs: PYTHON_VERSION=$(python --version | awk '{print $2}') REQUIRED_VERSION="${{ matrix.python-version }}.*" echo "Running on Python version: $PYTHON_VERSION" - echo "Required Python version: $REQUIRED_VERSION + echo "Required Python version: $REQUIRED_VERSION" python -m unittest discover -s tests