Skip to content

Same as #30 but the PR is opened from upstream repository instead of fork #3

Same as #30 but the PR is opened from upstream repository instead of fork

Same as #30 but the PR is opened from upstream repository instead of fork #3

Workflow file for this run

# 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/