File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1+ name : Python Package with caching
2+
3+ # taken from https://github.com/epassaro/cache-conda-envs
4+
5+ # cancel any previous running or pending jobs from the same branch
6+ concurrency :
7+ group : python-package-conda-cache-${{ github.head_ref }}
8+ cancel-in-progress : true
9+
10+ on :
11+ push :
12+ branches :
13+ - ' *'
14+
15+ pull_request :
16+ branches :
17+ - ' *'
18+
19+ schedule :
20+ - cron : ' 0 0 * * *'
21+
22+ env :
23+ CACHE_NUMBER : 0 # increase to reset cache manually
24+
25+ jobs :
26+ build :
27+
28+ strategy :
29+ matrix :
30+ include :
31+ - os : ubuntu-latest
32+ label : linux-64
33+ prefix : /usr/share/miniconda3/envs/my-env
34+
35+ name : ${{ matrix.label }}
36+ runs-on : ${{ matrix.os }}
37+ steps :
38+ - uses : actions/checkout@v2
39+
40+ - name : Setup Mambaforge
41+ uses : conda-incubator/setup-miniconda@v2
42+ with :
43+ miniforge-variant : Mambaforge
44+ miniforge-version : latest
45+ activate-environment : my-env
46+ use-mamba : true
47+
48+ - name : Set cache date
49+ run : echo "DATE=$(date +'%Y%m%d')" >> $GITHUB_ENV
50+
51+ - uses : actions/cache@v2
52+ with :
53+ path : ${{ matrix.prefix }}
54+ key : ${{ matrix.label }}-conda-${{ hashFiles('environment.yml') }}-${{ env.DATE }}-${{ env.CACHE_NUMBER }}
55+ id : cache
56+
57+ - name : Update environment
58+ run : mamba env update -n my-env -f environment.yml
59+ if : steps.cache.outputs.cache-hit != 'true'
60+
61+ - name : Run tests
62+ shell : bash -l {0}
63+ run : pytest ./tests
You can’t perform that action at this time.
0 commit comments