diff --git a/.github/workflows/garnetreduction.yml b/.github/workflows/garnetreduction.yml index 85fbc31..45316a3 100644 --- a/.github/workflows/garnetreduction.yml +++ b/.github/workflows/garnetreduction.yml @@ -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 . @@ -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: | @@ -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'