-
Notifications
You must be signed in to change notification settings - Fork 15
103 lines (91 loc) · 2.94 KB
/
cache.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
name: Refrech cache
on:
schedule:
- cron: 0 0 * * Sun # run on main every sunday at 00:00
workflow_dispatch:
jobs:
clear-cache:
uses: ./.github/workflows/purge_cache.yml
rebuild-cache:
needs: clear-cache
defaults:
run:
shell: bash -l {0}
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest]
python-version: ['3.10','3.11']
name: py ${{ matrix.python-version }}
runs-on: ${{ matrix.os }}
# note absence of cucurrency, this one should only be run one at a time
steps:
- name: checkout code
uses: actions/checkout@v3
- name: Setup Miniforge3
uses: conda-incubator/setup-miniconda@v2
with:
python-version: ${{ matrix.python-version }}
miniforge-variant: Miniforge3
miniforge-version: latest
use-mamba: true
- name: Setup env
run: |
pip install tomli
python make_env.py test -p ${{ matrix.python-version}}.* -n hydromt_wflow
mamba env create -f environment.yml
mamba run -n hydromt_wflow pip install -e .
# run tests first so that we can also cache all of the artefacts
- name: Test
run: |
export NUMBA_DISABLE_JIT=1
PYTHONPYCACHEPREFIX=~/pycache mamba run -n hydromt_wflow python -m pytest --verbose --cov=hydromt_wflow --cov-report xml
- name: Upload cache
uses: actions/cache/save@v3
if: always()
with:
path: |
/usr/share/miniconda3
~/pycache
key: test-py${{ matrix.python-version }}-${{ hashFiles('environment.yml') }}
id: test-cache
docs-cache:
needs: clear-cache
defaults:
run:
shell: bash -l {0}
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest]
python-version: ['3.11']
runs-on: ${{ matrix.os }}
steps:
- name: checkout code
uses: actions/checkout@v3
- name: Setup Miniforge3
uses: conda-incubator/setup-miniconda@v2
with:
python-version: ${{ matrix.python-version }}
miniforge-variant: Miniforge3
miniforge-version: latest
use-mamba: true
- name: Setup env
run: |
pip install tomli
python make_env.py doc -p ${{ matrix.python-version }}.* -n hydromt_wflow
mamba env create -f environment.yml
mamba run -n hydromt_wflow pip install -e .
# run tests first so that we can also cache all of the artefacts
- name: Generate docs
run: PYTHONPYCACHEPREFIX=~/pycache mamba run -n hydromt_wflow sphinx-build -M html ./docs ./docs/_build
- name: Upload cache
uses: actions/cache/save@v3
if: always()
with:
path: |
/usr/share/miniconda3
~/pycache
./docs/_build
key: docs-${{ hashFiles('environment.yml') }}
id: docs-cache