Update CI workflow configuration #103
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: CI | |
on: | |
push: | |
branches: [main, feature/*] | |
pull_request: | |
branches: [main] | |
jobs: | |
test: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Install system dependencies | |
run: | | |
sudo apt-get update | |
sudo apt-get install -y \ | |
swig \ | |
cmake \ | |
dssp \ | |
build-essential \ | |
curl \ | |
git \ | |
python3-dev \ | |
gcc \ | |
gfortran \ | |
libblas-dev \ | |
liblapack-dev \ | |
libhdf5-dev \ | |
libnetcdf-dev \ | |
libfftw3-dev \ | |
libopenmm-dev \ | |
libboost-all-dev \ | |
libxml2-dev \ | |
libxslt1-dev \ | |
zlib1g-dev \ | |
libjpeg-dev \ | |
libpng-dev \ | |
libfreetype6-dev \ | |
libatlas-base-dev \ | |
pkg-config | |
- name: Set up conda | |
uses: conda-incubator/setup-miniconda@v3 | |
with: | |
python-version: "3.8" | |
channels: conda-forge,defaults | |
channel-priority: strict | |
activate-environment: proteinflex-env | |
auto-activate-base: false | |
auto-update-conda: true | |
- name: Install bioinformatics dependencies | |
shell: bash -el {0} | |
run: | | |
# Install bioinformatics packages from conda-forge | |
conda install -y -c conda-forge mdtraj=1.9.7 openmm=7.7.0 prody=2.0.0 | |
- name: Set up Python dependencies | |
shell: bash -el {0} | |
run: | | |
python -m pip install --upgrade pip setuptools wheel | |
# Install scientific dependencies | |
pip install numpy==1.23.5 scipy==1.9.3 pandas==1.5.3 matplotlib==3.6.2 biopython==1.80 | |
# Install ML dependencies | |
pip install torch==1.13.1+cpu --extra-index-url https://download.pytorch.org/whl/cpu | |
pip install transformers==4.25.1 tokenizers==0.13.2 | |
pip install google-generativeai==0.2.0 | |
# Install testing dependencies | |
pip install pytest==7.1.2 pytest-cov==3.0.0 coverage==6.5.0 flake8==5.0.4 | |
pip install pytest-mock==3.10.0 pytest-asyncio==0.20.3 pytest-timeout==2.1.0 | |
pip install pytest-xdist==3.1.0 mock==5.0.1 pytest-env==0.8.1 pytest-randomly==3.12.0 | |
# Install package in editable mode | |
pip install -e . | |
- name: Run tests | |
shell: bash -el {0} | |
env: | |
PYTHONPATH: ${{ github.workspace }} | |
OPENMM_CPU_THREADS: 1 | |
PROTEINFLEX_TEST_MODE: 1 | |
PYTHONWARNINGS: ignore::DeprecationWarning | |
TRANSFORMERS_OFFLINE: 1 | |
CUDA_VISIBLE_DEVICES: "" | |
OMP_NUM_THREADS: 1 | |
MKL_NUM_THREADS: 1 | |
GOOGLE_API_KEY: ${{ secrets.GOOGLE_API_KEY }} | |
run: | | |
# Run tests with coverage, skipping API tests if no key available | |
if [ -z "$GOOGLE_API_KEY" ]; then | |
pytest tests/ -v -m "not requires_api" --cov=proteinflex --cov-report=xml --import-mode=importlib | |
else | |
pytest tests/ -v --cov=proteinflex --cov-report=xml --import-mode=importlib | |
fi | |
- name: Upload coverage to Codecov | |
uses: codecov/codecov-action@v3 | |
with: | |
file: ./coverage.xml | |
flags: unittests | |
name: codecov-umbrella | |
fail_ci_if_error: true | |
- name: Check code style | |
shell: bash -el {0} | |
run: | | |
flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics | |
flake8 . --count --exit-zero --max-complexity=10 --max-line-length=80 --statistics | |
build: | |
runs-on: ubuntu-latest | |
needs: test | |
if: github.event_name == 'push' && github.ref == 'refs/heads/main' | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Set up conda | |
uses: conda-incubator/setup-miniconda@v3 | |
with: | |
python-version: "3.8" | |
channels: conda-forge,defaults | |
channel-priority: strict | |
activate-environment: proteinflex-env | |
auto-activate-base: false | |
auto-update-conda: true | |
- name: Install dependencies | |
shell: bash -el {0} | |
run: | | |
python -m pip install --upgrade pip setuptools wheel build | |
# Install scientific dependencies | |
pip install numpy==1.23.5 scipy==1.9.3 pandas==1.5.3 matplotlib==3.6.2 biopython==1.80 | |
- name: Build package | |
shell: bash -el {0} | |
run: | | |
# Build package | |
python -m build | |
python setup.py bdist_wheel | |
- name: Upload artifacts | |
uses: actions/upload-artifact@v4 | |
with: | |
name: dist | |
path: dist/ |