-
Notifications
You must be signed in to change notification settings - Fork 209
97 lines (87 loc) · 2.74 KB
/
ci.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
name: CI
on:
push:
branches:
- "master"
pull_request:
branches:
- "master"
- "dev"
schedule:
# every two weeks on Monday at 3 am
- cron: "0 3/336 * * 1"
jobs:
test:
name: Pytest
runs-on: ${{ matrix.cfg.os }}
strategy:
fail-fast: false
matrix:
directory:
- T002_compound_adme
#- T003_compound_unwanted_structures
cfg:
- os: ubuntu-latest
#- os: macos-latest
#- os: windows-latest
env:
PYVER: ${{ matrix.cfg.python-version }}
PACKAGE: teachopencadd
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Set up Miniconda
uses: conda-incubator/setup-miniconda@v3
with:
mamba-version: "*"
channels: conda-forge,defaults
use-mamba: true
auto-activate-base: true
- name: Cache Conda packages
uses: actions/cache@v3
with:
path: /home/runner/conda_pkgs_dir
key: ${{ runner.os }}-conda-
restore-keys: |
${{ runner.os }}-conda-
- name: Install Conda environment
shell: bash -el {0}
run: |
mamba env create -f environment.yml -n ${{ matrix.directory }}
conda activate $(basename ${{ matrix.directory }})
mamba install pytest pytest-xdist pytest-cov nbval shyaml -c conda-forge -y
working-directory: teachopencadd/talktorials/${{ matrix.directory }}
- name: Test Talktorial
shell: bash -el {0}
run: |
conda activate $(basename ${{ matrix.directory }})
conda info
PYTEST_ARGS="--nbval-lax --nbval-current-env --dist loadscope"
pytest $PYTEST_ARGS .
working-directory: teachopencadd/talktorials/${{ matrix.directory }}
format:
name: Black
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/setup-python@v3
- name: Install format dependencies
run: python -m pip install 'black<23' 'black-nb<0.7' shyaml
- name: Run black-nb
run: |
black-nb -l 99 --check teachopencadd/talktorials/T*/talktorial.ipynb
readmes:
name: READMEs
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/setup-python@v3
- name: Install nbformat
run: python -m pip install nbformat shyaml
- name: Check READMEs are up-to-date
run: |
for path in teachopencadd/talktorials/T*/talktorial.ipynb; do
python devtools/regenerate_readmes.py --output README.md $path
done
# If the script above introduced changes (it shouldn't!), git diff will have output and an error code
git diff --exit-code