| 1 |
name: CI |
| 2 |
|
| 3 |
on: |
| 4 |
push: |
| 5 |
branches: |
| 6 |
- 'main' |
| 7 |
- 'pymbar4' |
| 8 |
- 'gha' |
| 9 |
pull_request: |
| 10 |
branches: |
| 11 |
- 'main' |
| 12 |
- 'pymbar4' |
| 13 |
- 'gha' |
| 14 |
schedule: |
| 15 |
# Nightly Tests |
| 16 |
- cron: '0 0 * * *' |
| 17 |
|
| 18 |
|
| 19 |
defaults: |
| 20 |
run: |
| 21 |
shell: bash -leo pipefail {0} |
| 22 |
|
| 23 |
concurrency: |
| 24 |
group: "${{ github.workflow }}-${{ github.ref }}" |
| 25 |
cancel-in-progress: true |
| 26 |
|
| 27 |
jobs: |
| 28 |
test: |
| 29 |
runs-on: ${{ matrix.os }} |
| 30 |
strategy: |
| 31 |
fail-fast: false |
| 32 |
matrix: |
| 33 |
os: [macOS-latest, ubuntu-latest, windows-latest] |
| 34 |
python-version: ["3.11", "3.12", "3.13", "3.14"] # Check against oldest and newest versions |
| 35 |
jax: ["", "_jax"] |
| 36 |
exclude: # Skip win + jax |
| 37 |
- jax: "_jax" |
| 38 |
os: windows-latest |
| 39 |
env: |
| 40 |
PYVER: ${{ matrix.python-version }} |
| 41 |
CI_OS: ${{ matrix.os }} |
| 42 |
PACKAGE: "pymbar" |
| 43 |
|
| 44 |
steps: |
| 45 |
- name: Checkout the code |
| 46 |
uses: actions/checkout@v4 |
| 47 |
|
| 48 |
- name: Additional info about the build |
| 49 |
shell: bash |
| 50 |
run: | |
| 51 |
uname -a |
| 52 |
df -h |
| 53 |
ulimit -a |
| 54 |
|
| 55 |
- name: Setup Conda via Mamba |
| 56 |
uses: mamba-org/setup-micromamba@v1 |
| 57 |
with: |
| 58 |
environment-file: devtools/conda-envs/test_env${{ matrix.jax }}.yaml |
| 59 |
environment-name: test |
| 60 |
condarc: | |
| 61 |
channels: |
| 62 |
- conda-forge |
| 63 |
create-args: >- |
| 64 |
python=${{ matrix.python-version }} |
| 65 |
|
| 66 |
- name: Install package |
| 67 |
run: | |
| 68 |
python -m pip install . --no-deps |
| 69 |
micromamba list |
| 70 |
|
| 71 |
- name: Run tests (pytest) |
| 72 |
run: | |
| 73 |
pytest -v --cov=$PACKAGE --cov-report=xml --color=yes --doctest-modules $PACKAGE/ |
| 74 |
|
| 75 |
- name: Run examples |
| 76 |
run: | |
| 77 |
### constant-force-optical-trap |
| 78 |
cd examples/constant-force-optical-trap |
| 79 |
python extract-data.py |
| 80 |
python force-bias-optical-trap.py |
| 81 |
### harmonic-oscillators |
| 82 |
cd ../harmonic-oscillators |
| 83 |
python harmonic-oscillators.py |
| 84 |
python harmonic-oscillators-distributions.py |
| 85 |
cd ../heat-capacity |
| 86 |
python heat-capacity.py -b 2 |
| 87 |
### parallel-tempering-2dfes |
| 88 |
cd ../parallel-tempering-2dfes |
| 89 |
python parallel-tempering-2dfes.py |
| 90 |
### umbrella-sampling-fes |
| 91 |
cd ../umbrella-sampling-fes |
| 92 |
python umbrella-sampling.py |
| 93 |
python umbrella-sampling-advanced-fes.py |
| 94 |
|
| 95 |
- name: CodeCov |
| 96 |
uses: codecov/codecov-action@v1 |
| 97 |
with: |
| 98 |
token: ${{ secrets.CODECOV_TOKEN }} |
| 99 |
file: ./coverage.xml |
| 100 |
flags: unittests |
| 101 |
|
| 102 |
lint-format: |
| 103 |
runs-on: ubuntu-latest |
| 104 |
strategy: |
| 105 |
fail-fast: false |
| 106 |
matrix: |
| 107 |
python-version: ["3.11"] |
| 108 |
env: |
| 109 |
PACKAGE: "pymbar" |
| 110 |
|
| 111 |
steps: |
| 112 |
- name: Checkout the code |
| 113 |
uses: actions/checkout@v1 |
| 114 |
|
| 115 |
- name: Setup Conda via Mamba |
| 116 |
uses: mamba-org/setup-micromamba@v1 |
| 117 |
with: |
| 118 |
environment-file: devtools/conda-envs/test_env.yaml |
| 119 |
environment-name: test |
| 120 |
condarc: | |
| 121 |
channels: |
| 122 |
- conda-forge |
| 123 |
create-args: >- |
| 124 |
python=${{ matrix.python-version }} |
| 125 |
- name: Install linter and formatter |
| 126 |
run: | |
| 127 |
micromamba install pylint black |
| 128 |
|
| 129 |
- name: Run pylint |
| 130 |
run: | |
| 131 |
pylint $PACKAGE/ |
| 132 |
|
| 133 |
# Black has a default --exclude which reads .gitignore. |
| 134 |
# Black's --exclude and --extend-exclude are single specified RegEx patterns and overwrite if multi-marked. |
| 135 |
- name: Run black check |
| 136 |
if: always() |
| 137 |
run: | |
| 138 |
black --check -l 99 $PACKAGE/ examples/ |