-
Notifications
You must be signed in to change notification settings - Fork 93
137 lines (121 loc) · 3.46 KB
/
CI.yaml
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
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
name: CI
on:
push:
branches:
- 'master'
- 'pymbar4'
- 'gha'
pull_request:
branches:
- 'master'
- 'pymbar4'
- 'gha'
schedule:
# Nightly Tests
- cron: '0 0 * * *'
jobs:
test:
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [macOS-latest, ubuntu-latest, windows-latest]
python-version: ["3.8", "3.11", "3.12"] # Check against oldest and newest versions
jax: ["", "_jax"]
exclude: # Skip win + jax
- jax: "_jax"
os: windows-latest
env:
PYVER: ${{ matrix.python-version }}
CI_OS: ${{ matrix.os }}
PACKAGE: "pymbar"
steps:
- name: Checkout the code
uses: actions/checkout@v3
- name: Additional info about the build
shell: bash
run: |
uname -a
df -h
ulimit -a
- name: Setup Conda via Mamba
uses: mamba-org/setup-micromamba@v1
with:
environment-file: devtools/conda-envs/test_env${{ matrix.jax }}.yaml
environment-name: test
condarc: |
channels:
- conda-forge
- defaults
create-args: >-
python=${{ matrix.python-version }}
- name: Install package
shell: bash -l {0}
run: |
python -m pip install . --no-deps
micromamba list
- name: Run tests (pytest)
shell: bash -l {0}
run: |
pytest -v --cov=$PACKAGE --cov-report=xml --color=yes --doctest-modules $PACKAGE/
- name: Run examples
shell: bash -l {0}
run: |
### constant-force-optical-trap
cd examples/constant-force-optical-trap
python extract-data.py
python force-bias-optical-trap.py
### harmonic-oscillators
cd ../harmonic-oscillators
python harmonic-oscillators.py
python harmonic-oscillators-distributions.py
cd ../heat-capacity
python heat-capacity.py -b 2
### parallel-tempering-2dfes
cd ../parallel-tempering-2dfes
python parallel-tempering-2dfes.py
### umbrella-sampling-fes
cd ../umbrella-sampling-fes
python umbrella-sampling.py
python umbrella-sampling-advanced-fes.py
- name: CodeCov
uses: codecov/codecov-action@v1
with:
token: ${{ secrets.CODECOV_TOKEN }}
file: ./coverage.xml
flags: unittests
yml: ./.codecov.yml
lint-format:
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
python-version: [3.8]
env:
PACKAGE: "pymbar"
steps:
- name: Checkout the code
uses: actions/checkout@v1
- name: Setup Conda via Mamba
uses: mamba-org/provision-with-micromamba@main
with:
environment-file: devtools/conda-envs/test_env.yaml
environment-name: test
channels: conda-forge,defaults
extra-specs: |
python=${{ matrix.python-version }}
- name: Install linter and formatter
shell: bash -l {0}
run: |
micromamba install pylint black
- name: Run pylint
shell: bash -l {0}
run: |
pylint $PACKAGE/
# Black has a default --exclude which reads .gitignore.
# Black's --exclude and --extend-exclude are single specified RegEx patterns and overwrite if multi-marked.
- name: Run black check
shell: bash -l {0}
if: always()
run: |
black --check -l 99 $PACKAGE/ examples/ --extend-exclude "$PACKAGE/_version.py"