Skip to content

Commit

Permalink
cache conda environment runner
Browse files Browse the repository at this point in the history
  • Loading branch information
mpatrou committed Jun 7, 2024
1 parent 6ce6ca7 commit 46f88b6
Showing 1 changed file with 25 additions and 4 deletions.
29 changes: 25 additions & 4 deletions .github/workflows/garnetreduction.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,6 @@ jobs:
channels: conda-forge, mantid/label/nightly, oncat
mamba-version: "*"
environment-file: environment.yml
cache-environment-key: ${{ runner.os }}-env-${{ hashFiles('**/environment.yml') }}
cache-downloads-key: ${{ runner.os }}-downloads-${{ hashFiles('**/environment.yml') }}
- name: install garnet_reduction
run: |
python -m pip install -e .
Expand All @@ -48,8 +46,6 @@ jobs:
channels: conda-forge, mantid/label/nightly, oncat
mamba-version: "*"
environment-file: environment.yml
cache-environment-key: ${{ runner.os }}-env-${{ hashFiles('**/environment.yml') }}
cache-downloads-key: ${{ runner.os }}-downloads-${{ hashFiles('**/environment.yml') }}
- name: building python wheel
shell: bash -l {0}
run: |
Expand All @@ -75,3 +71,28 @@ jobs:
if [ "${IS_RC}" = "true" ]; then CONDA_LABEL="rc"; fi
echo pushing ${{ github.ref }} with label $CONDA_LABEL
anaconda upload --label $CONDA_LABEL conda.recipe/noarch/garnet_reduction*.tar.bz2
- name: Get Date
id: get-date
run: echo "::set-output name=today::$(/bin/date -u '+%Y%m%d')"
shell: bash

- name: Cache Conda env
uses: actions/cache@v4
with:
path: ${{ env.CONDA }}/envs
key:
conda-${{ runner.os }}--${{ runner.arch }}--${{
steps.get-date.outputs.today }}-${{
hashFiles('environment.yml') }}-${{
env.CACHE_NUMBER }}
env:
# Increase this value to reset cache if environment.yml has not changed
CACHE_NUMBER: 4
id: cache

- name: Update environment
run:
mamba env update -n anaconda-client-env -f
environment.yml
if: steps.cache.outputs.cache-hit != 'true'

0 comments on commit 46f88b6

Please sign in to comment.