Skip to content

Commit f0c26ab

Browse files
Merge pull request #115 from Quantmetry/ci_cache_environment
Ci cache environment
2 parents ba60fdb + 4cce628 commit f0c26ab

File tree

2 files changed

+31
-8
lines changed

2 files changed

+31
-8
lines changed

.github/workflows/test.yml

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,11 +31,9 @@ jobs:
3131
environment-file: environment.ci.yml
3232
- name: Lint with flake8
3333
run: |
34-
conda install flake8
3534
flake8
3635
- name: Test with pytest
3736
run: |
38-
conda install pytest
3937
make coverage
4038
- name: typing with mypy
4139
run: |

.github/workflows/test_quick.yml

Lines changed: 31 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -21,19 +21,44 @@ jobs:
2121
steps:
2222
- name: Git clone
2323
uses: actions/checkout@v3
24-
- name: Set up venv for ci
24+
25+
# See caching environments
26+
# https://github.com/conda-incubator/setup-miniconda#caching-environments
27+
- name: Setup Mambaforge
2528
uses: conda-incubator/setup-miniconda@v2
2629
with:
27-
python-version: ${{matrix.python-version}}
28-
environment-file: environment.ci.yml
30+
miniforge-variant: Mambaforge
31+
miniforge-version: latest
32+
activate-environment: env_qolmat_ci
33+
use-mamba: true
34+
35+
- name: Get Date
36+
id: get-date
37+
run: echo "today=$(/bin/date -u '+%Y%m%d')" >> $GITHUB_OUTPUT
38+
39+
- name: Cache Conda env
40+
uses: actions/cache@v2
41+
with:
42+
path: ${{ env.CONDA }}/envs
43+
key:
44+
conda-${{ runner.os }}--${{ runner.arch }}--${{
45+
steps.get-date.outputs.today }}-${{
46+
hashFiles('environment.ci.yml') }}-${{ env.CACHE_NUMBER
47+
}}
48+
env:
49+
# Increase this value to reset cache if environment.ci.yml has not changed
50+
CACHE_NUMBER: 0
51+
id: cache
52+
53+
- name: Update environment
54+
run: mamba env update -n env_qolmat_ci -f environment.ci.yml
55+
if: steps.cache.outputs.cache-hit != 'true'
56+
2957
- name: Lint with flake8
3058
run: |
31-
conda install flake8
3259
flake8
3360
- name: Test with pytest
3461
run: |
35-
conda install pytest
36-
pip install -e .[pytorch]
3762
make coverage
3863
- name: Test docstrings
3964
run: make doctest

0 commit comments

Comments
 (0)