Skip to content

Commit

Permalink
Save 30 seconds with this way of caching?
Browse files Browse the repository at this point in the history
  • Loading branch information
hannahlanzrath committed Dec 6, 2024
1 parent 518fe2f commit de9d3af
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions .github/workflows/pipeline.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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]
Expand All @@ -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
Expand Down

0 comments on commit de9d3af

Please sign in to comment.