Skip to content

Commit

Permalink
Fix caching with Conda environment
Browse files Browse the repository at this point in the history
  • Loading branch information
dmitry-kabanov committed Jul 19, 2024
1 parent f0b6186 commit 646fb83
Showing 1 changed file with 26 additions and 9 deletions.
35 changes: 26 additions & 9 deletions .github/workflows/qa.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ on:

env:
JULIA_PROJECT: .
CONDA_ENV_FILE: environment-linux.yaml

jobs:
qa-ubuntu-conda:
Expand All @@ -24,14 +25,14 @@ jobs:
steps:
- name: Check out repository code
uses: actions/checkout@v4
- name: Cache conda packages
uses: actions/cache@v3
env:
# Increase this value to reset cache if environment.yaml has not changed
CACHE_NUMBER: 1
with:
path: ~/conda_pkgs_dir
key: ${{ runner.os }}-conda-${{ env.CACHE_NUMBER }}-${{ hashFiles('environment-linux.yaml') }}
# - name: Cache conda packages
# uses: actions/cache@v3
# env:
# # Increase this value to reset cache if environment.yaml has not changed
# CACHE_NUMBER: 1
# with:
# path: ~/conda_pkgs_dir
# key: ${{ runner.os }}-conda-${{ env.CACHE_NUMBER }}-${{ hashFiles('environment-linux.yaml') }}
- name: Setup conda environment
uses: conda-incubator/setup-miniconda@v3
with:
Expand All @@ -40,7 +41,23 @@ jobs:
miniforge-version: latest
mamba-version: '*'
python-version: ${{ matrix.python-version }}
use-only-tar-bz2: true
# use-only-tar-bz2: true
- name: Get Date
id: get-date
run: echo "::set-output name=date::$(/bin/date -u "+%Y%m%d")"

- name: Cache Conda env
uses: actions/cache@v3
with:
path: ${{ env.CONDA }}/envs
key: ${{ runner.os }}-conda-${{ steps.get-date.outputs.date }}-${{ hashFiles('environment-linux.yaml') }}
id: cache

- name: Update environment
run: |
conda env update --file environment-linux.yaml --name test
if: steps.cache.outputs.cache-hit != 'true'

- name: Set up Julia
uses: julia-actions/setup-julia@v2
with:
Expand Down

0 comments on commit 646fb83

Please sign in to comment.