-
Notifications
You must be signed in to change notification settings - Fork 5
208 lines (173 loc) · 5.97 KB
/
ci.yml
File metadata and controls
208 lines (173 loc) · 5.97 KB
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
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
# MAWS CI/CD Workflow
# Runs tests on Linux with AmberTools and OpenMM across Python 3.10-3.13
# Includes optional GPU testing when self-hosted runners with GPU are available
name: CI
on:
push:
branches:
- main
pull_request:
branches:
- main
workflow_dispatch: # Allow manual trigger
jobs:
# ============================================================================
# Full integration tests with AmberTools (CPU)
# ============================================================================
test:
name: Test Python ${{ matrix.python-version }}
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
python-version: ["3.10", "3.11", "3.12", "3.13"]
defaults:
run:
shell: bash -el {0} # Required for conda activate
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Setup Miniconda
uses: conda-incubator/setup-miniconda@v3
with:
miniforge-version: latest
python-version: ${{ matrix.python-version }}
channels: conda-forge,bioconda,defaults
channel-priority: strict
activate-environment: maws
auto-activate-base: false
- name: Install dependencies via conda
run: |
conda activate maws
conda install -y openmm ambertools mpmath numba pandas numpy
- name: Install package and dev dependencies
run: |
conda activate maws
pip install -e ".[dev]"
- name: Verify AmberTools installation
run: |
conda activate maws
which tleap
tleap -h || echo "tleap help displayed"
- name: Run tests
run: |
conda activate maws
pytest tests/ -v --tb=short
- name: Run tests with coverage
if: matrix.python-version == '3.10'
run: |
conda activate maws
pytest tests/ --cov=maws --cov-report=term-missing --cov-report=xml
- name: Upload coverage to Codecov
if: matrix.python-version == '3.10'
uses: codecov/codecov-action@v4
with:
files: ./coverage.xml
fail_ci_if_error: false
verbose: true
# ============================================================================
# Fast unit tests (no AmberTools needed)
# ============================================================================
unit-tests:
name: Unit Tests Python ${{ matrix.python-version }}
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
python-version: ["3.10", "3.11", "3.12", "3.13"]
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Setup Python
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
cache: pip
- name: Install minimal dependencies
run: |
pip install numpy openmm mpmath pandas pytest pytest-cov
- name: Install package
run: pip install -e .
- name: Run unit tests only
run: |
pytest tests/ -v --tb=short \
--ignore=tests/test_chain_complex.py \
--ignore=tests/test_run.py
# ============================================================================
# GPU tests (only runs on self-hosted runners with NVIDIA GPU)
# To enable: add a self-hosted runner with GPU and label 'gpu'
# ============================================================================
gpu-test:
name: GPU Test
runs-on: [self-hosted, gpu]
if: github.event_name == 'workflow_dispatch' || contains(github.event.head_commit.message, '[gpu]')
continue-on-error: true # Don't fail the whole workflow if GPU tests fail
defaults:
run:
shell: bash -el {0}
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Check NVIDIA GPU
run: |
nvidia-smi
echo "CUDA devices found:"
nvidia-smi --query-gpu=name,driver_version,memory.total --format=csv
- name: Setup Miniconda
uses: conda-incubator/setup-miniconda@v3
with:
miniforge-version: latest
python-version: "3.10"
channels: conda-forge,bioconda,defaults
channel-priority: strict
activate-environment: maws-gpu
auto-activate-base: false
- name: Install dependencies with CUDA support
run: |
conda activate maws-gpu
# Install OpenMM with CUDA support
conda install -y openmm cudatoolkit ambertools mpmath numba pandas numpy
- name: Install package
run: |
conda activate maws-gpu
pip install -e ".[dev]"
- name: Verify CUDA platform
run: |
conda activate maws-gpu
python -c "
import openmm as mm
print('Available platforms:')
for i in range(mm.Platform.getNumPlatforms()):
p = mm.Platform.getPlatform(i)
print(f' {p.getName()}')
try:
cuda = mm.Platform.getPlatformByName('CUDA')
print(f'CUDA platform found!')
except Exception as e:
print(f'CUDA not available: {e}')
"
- name: Run all tests including GPU
env:
MAWS_OPENMM_PLATFORM: CUDA
run: |
conda activate maws-gpu
pytest tests/ -v --tb=short -m "not slow"
# ============================================================================
# Linting
# ============================================================================
lint:
name: Lint
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Setup Python
uses: actions/setup-python@v5
with:
python-version: "3.10"
- name: Install ruff
run: pip install ruff
- name: Run ruff check
run: ruff check maws/
- name: Run ruff format check
run: ruff format --check maws/