Skip to content

Commit bcbcac7

Browse files
authored
Merge pull request #92 from CCPBioSim/90-ci-test-mdanalysis-version
Extention to CI capabilities with comparisions between CodeEntropy and MDAnalysis
2 parents aa8acbc + 5463973 commit bcbcac7

File tree

5 files changed

+133
-75
lines changed

5 files changed

+133
-75
lines changed

.github/workflows/CI.yaml

Lines changed: 0 additions & 70 deletions
This file was deleted.
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
---
2+
title: CI Failure: MDAnalysis v{{ env.MDA_VERSION }} / Python {{ env.PYTHON_VERSION }}
3+
labels: CI Failure, MDAnalysis Compatibility
4+
---
5+
6+
### Automated MDAnalysis Compatibility Test Failure
7+
8+
**MDAnalysis version**: `{{ env.MDA_VERSION }}`
9+
**Python version**: `{{ env.PYTHON_VERSION }}`
10+
**Workflow Run**: [Run #{{ env.RUN_NUMBER }}]({{ env.RUN_URL }})

.github/workflows/project-ci.yaml

Lines changed: 115 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,115 @@
1+
name: CodeEntropy CI
2+
3+
on:
4+
push:
5+
branches: [main]
6+
pull_request:
7+
schedule:
8+
- cron: '0 8 * * 1'
9+
10+
jobs:
11+
tests:
12+
runs-on: ubuntu-latest
13+
timeout-minutes: 30
14+
strategy:
15+
matrix:
16+
python-version: ["3.11", "3.12", "3.13"]
17+
name: Run tests
18+
steps:
19+
- name: Checkout repo
20+
uses: actions/checkout@v4
21+
22+
- name: Set up Python ${{ matrix.python-version }}
23+
uses: actions/setup-python@v5
24+
with:
25+
python-version: ${{ matrix.python-version }}
26+
27+
- name: Install CodeEntropy and its testing dependencies
28+
run: pip install -e .[testing]
29+
30+
- name: Run test suite
31+
run: pytest --cov CodeEntropy --cov-report term-missing --cov-append .
32+
33+
- name: Coveralls GitHub Action
34+
uses: coverallsapp/github-action@v2.3.6
35+
with:
36+
github-token: ${{ secrets.COVERALLS_REPO_TOKEN }}
37+
38+
docs:
39+
runs-on: ubuntu-latest
40+
timeout-minutes: 15
41+
steps:
42+
- uses: actions/checkout@v4
43+
- name: Set up Python 3.12
44+
uses: actions/setup-python@v5
45+
with:
46+
python-version: 3.12
47+
- name: Install python dependencies
48+
run: |
49+
pip install --upgrade pip
50+
pip install -e .[docs]
51+
- name: Build docs
52+
run: cd docs && make
53+
54+
pre-commit:
55+
runs-on: ubuntu-latest
56+
timeout-minutes: 15
57+
steps:
58+
- uses: actions/checkout@v4
59+
- name: Set up Python 3.11
60+
uses: actions/setup-python@v5
61+
with:
62+
python-version: 3.11
63+
- name: Install python dependencies
64+
run: |
65+
pip install --upgrade pip
66+
pip install -e .[pre-commit,docs,testing]
67+
- name: Run pre-commit
68+
run: |
69+
pre-commit install
70+
pre-commit run --all-files || ( git status --short ; git diff ; exit 1 )
71+
72+
mdanalysis-compatibility:
73+
if: github.event_name == 'schedule'
74+
runs-on: ubuntu-latest
75+
timeout-minutes: 15
76+
strategy:
77+
matrix:
78+
python-version: ["3.11", "3.12", "3.13"]
79+
mdanalysis-version: ["2.7.0", "2.8.0", "2.9.0", "latest"]
80+
name: MDAnalysis Compatibility Tests
81+
steps:
82+
- name: Checkout repo
83+
uses: actions/checkout@v4
84+
85+
- name: Set up Python ${{ matrix.python-version }}
86+
uses: actions/setup-python@v5
87+
with:
88+
python-version: ${{ matrix.python-version }}
89+
90+
- name: Install dependencies with MDAnalysis ${{ matrix.mdanalysis-version }}
91+
run: |
92+
pip install --upgrade pip
93+
pip install -e .[testing]
94+
if [ "${{ matrix.mdanalysis-version }}" = "latest" ]; then
95+
pip install MDAnalysis
96+
else
97+
pip install "MDAnalysis==${{ matrix.mdanalysis-version }}"
98+
fi
99+
100+
- name: Run compatibility tests
101+
run: pytest --cov CodeEntropy --cov-report=term-missing --cov-append
102+
103+
- name: Create Issue on Failure
104+
if: failure()
105+
uses: JasonEtco/create-an-issue@v2
106+
env:
107+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
108+
PYTHON_VERSION: ${{ matrix.python-version }}
109+
MDA_VERSION: ${{ matrix.mdanalysis-version }}
110+
RUN_NUMBER: ${{ github.run_number }}
111+
RUN_URL: ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}
112+
with:
113+
filename: .github/mdanalysis-compatibility-failure.md
114+
update_existing: true
115+
search_existing: open

pyproject.toml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,10 +30,10 @@ classifiers = [
3030
"Development Status :: 4 - Beta"
3131
]
3232
keywords = ["entropy", "macromolecular systems", "MD simulation"]
33-
requires-python = ">=3.8"
33+
requires-python = ">=3.11"
3434
dependencies = [
3535
"numpy==2.2.3",
36-
"mdanalysis==2.8.0",
36+
"mdanalysis>=2.7.0",
3737
"pandas==2.2.3",
3838
"psutil==5.9.5",
3939
"PyYAML==6.0.2",

tests/test_CodeEntropy/test_run.py

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -136,9 +136,12 @@ def test_run_entropy_workflow(self):
136136
run_manager._config_manager.merge_configs.return_value = mock_args
137137

138138
mock_entropy_manager = MagicMock()
139-
with unittest.mock.patch(
140-
"CodeEntropy.run.EntropyManager", return_value=mock_entropy_manager
141-
), unittest.mock.patch("CodeEntropy.run.mda.Universe") as mock_universe:
139+
with (
140+
unittest.mock.patch(
141+
"CodeEntropy.run.EntropyManager", return_value=mock_entropy_manager
142+
),
143+
unittest.mock.patch("CodeEntropy.run.mda.Universe") as mock_universe,
144+
):
142145

143146
run_manager.run_entropy_workflow()
144147

0 commit comments

Comments
 (0)