Skip to content

Commit 0e8034d

Browse files
committed
use mamba to setup ci environment with cache
1 parent ba60fdb commit 0e8034d

File tree

1 file changed

+23
-3
lines changed

1 file changed

+23
-3
lines changed

.github/workflows/test_quick.yml

Lines changed: 23 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,9 @@ on:
77
- main
88
workflow_dispatch:
99

10+
env:
11+
CACHE_NUMBER: 0 # increase to reset cache manually
12+
1013
jobs:
1114
basic-testing:
1215
runs-on: ${{matrix.os}}
@@ -21,11 +24,28 @@ jobs:
2124
steps:
2225
- name: Git clone
2326
uses: actions/checkout@v3
24-
- name: Set up venv for ci
27+
28+
- name: Setup Mambaforge
2529
uses: conda-incubator/setup-miniconda@v2
2630
with:
27-
python-version: ${{matrix.python-version}}
28-
environment-file: environment.ci.yml
31+
miniforge-variant: Mambaforge
32+
miniforge-version: latest
33+
activate-environment: env_qolmat_ci
34+
use-mamba: true
35+
36+
- name: Set cache date
37+
run: echo "DATE=$(date +'%Y%m%d')" >> $GITHUB_ENV
38+
39+
- uses: actions/cache@v2
40+
with:
41+
path: ${{ matrix.prefix }}
42+
key: ${{ matrix.label }}-conda-${{ hashFiles('environment.ci.yml') }}-${{ env.DATE }}-${{ env.CACHE_NUMBER }}
43+
id: cache
44+
45+
- name: Update environment
46+
run: mamba env update -n env_qolmat_ci -f environment.ci.yml
47+
if: steps.cache.outputs.cache-hit != 'true'
48+
2949
- name: Lint with flake8
3050
run: |
3151
conda install flake8

0 commit comments

Comments
 (0)