From 04bd994154f9f5d483a21046db96df3c733050a9 Mon Sep 17 00:00:00 2001 From: harryswift01 Date: Tue, 13 May 2025 16:41:58 +0100 Subject: [PATCH 1/5] Further update to `CI.yaml` file to cross reference compatability of CodeEntropy with MDAnalysis --- .github/workflows/CI.yaml | 33 ++++++++++++++++++++++++++++++++- 1 file changed, 32 insertions(+), 1 deletion(-) diff --git a/.github/workflows/CI.yaml b/.github/workflows/CI.yaml index 6ceb111..a81390c 100644 --- a/.github/workflows/CI.yaml +++ b/.github/workflows/CI.yaml @@ -67,4 +67,35 @@ jobs: - name: Run pre-commit run: | pre-commit install - pre-commit run --all-files || ( git status --short ; git diff ; exit 1 ) \ No newline at end of file + pre-commit run --all-files || ( git status --short ; git diff ; exit 1 ) + + mdanalysis_compatibility: + runs-on: ubuntu-latest + timeout-minutes: 15 + strategy: + matrix: + python-version: ["3.11", "3.12", "3.13"] + mdanalysis-version: ["2.7.0", "2.8.0", "2.9.0", "latest"] + name: MDAnalysis v${{ matrix.mdanalysis-version }} / Python ${{ matrix.python-version }} + steps: + - name: Checkout repo + uses: actions/checkout@v4 + + - name: Set up Python ${{ matrix.python-version }} + uses: actions/setup-python@v5 + with: + python-version: ${{ matrix.python-version }} + + - name: Install dependencies with MDAnalysis ${{ matrix.mdanalysis-version }} + run: | + pip install --upgrade pip + if [ "${{ matrix.mdanalysis-version }}" = "latest" ]; then + pip install -e .[testing] + pip install MDAnalysis + else + pip install -e .[testing] + pip install "MDAnalysis==${{ matrix.mdanalysis-version }}" + fi + + - name: Run tests + run: pytest --cov CodeEntropy --cov-report=term-missing --cov-append \ No newline at end of file From bd3655c2aed5552b72562c6940b2331d37f5bace Mon Sep 17 00:00:00 2001 From: harryswift01 Date: Tue, 13 May 2025 17:13:55 +0100 Subject: [PATCH 2/5] small bump up changes for Python and MDAnalysis versions in `pyproject.toml` --- pyproject.toml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pyproject.toml b/pyproject.toml index b30d0d6..e714acd 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -30,10 +30,10 @@ classifiers = [ "Development Status :: 4 - Beta" ] keywords = ["entropy", "macromolecular systems", "MD simulation"] -requires-python = ">=3.8" +requires-python = ">=3.11" dependencies = [ "numpy==2.2.3", - "mdanalysis==2.8.0", + "mdanalysis>=2.7.0", "pandas==2.2.3", "psutil==5.9.5", "PyYAML==6.0.2", From ba0036a2596625bd8c9a7a5ba00de5118218e6b6 Mon Sep 17 00:00:00 2001 From: harryswift01 Date: Wed, 14 May 2025 10:02:49 +0100 Subject: [PATCH 3/5] Further refinements to CI: - Renamed the `CI.yaml` file to `project-ci.yaml` to make it more clear - Moved the MDAnalysis compatability tests to a seperate yaml file: - This is set to run each Monday morning at 08:00 UTC time - Any failures from this creates an issue to GitHub to fix --- .../mdanalysis-compatability-matrix.yaml | 80 +++++++++++++++++++ .../workflows/{CI.yaml => project-ci.yaml} | 35 +------- 2 files changed, 82 insertions(+), 33 deletions(-) create mode 100644 .github/workflows/mdanalysis-compatability-matrix.yaml rename .github/workflows/{CI.yaml => project-ci.yaml} (61%) diff --git a/.github/workflows/mdanalysis-compatability-matrix.yaml b/.github/workflows/mdanalysis-compatability-matrix.yaml new file mode 100644 index 0000000..7470832 --- /dev/null +++ b/.github/workflows/mdanalysis-compatability-matrix.yaml @@ -0,0 +1,80 @@ +name: MDAnalysis Compatibility Matrix + +on: + schedule: + - cron: '0 8 * * 1' + workflow_dispatch: + +jobs: + mdanalysis_compatibility: + runs-on: ubuntu-latest + timeout-minutes: 15 + strategy: + matrix: + python-version: ["3.11", "3.12", "3.13"] + mdanalysis-version: ["2.7.0", "2.8.0", "2.9.0", "latest"] + name: MDAnalysis v${{ matrix.mdanalysis-version }} / Python ${{ matrix.python-version }} + steps: + - name: Checkout repo + uses: actions/checkout@v4 + + - name: Set up Python ${{ matrix.python-version }} + uses: actions/setup-python@v5 + with: + python-version: ${{ matrix.python-version }} + + - name: Install dependencies with MDAnalysis ${{ matrix.mdanalysis-version }} + run: | + pip install --upgrade pip + pip install -e .[testing] + if [ "${{ matrix.mdanalysis-version }}" = "latest" ]; then + pip install MDAnalysis + else + pip install "MDAnalysis==${{ matrix.mdanalysis-version }}" + fi + + - name: Run tests + run: pytest --cov CodeEntropy --cov-report=term-missing --cov-append + + - name: Create Issue on Failure + if: failure() + uses: actions/github-script@v7 + with: + github-token: ${{ secrets.GITHUB_TOKEN }} + script: | + const pythonVersion = "${{ matrix.python-version }}"; + const mdaVersion = "${{ matrix.mdanalysis-version }}"; + const runNumber = "${{ github.run_number }}"; + const runUrl = "${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}"; + + const title = `CI Failure: MDAnalysis v${mdaVersion} / Python ${pythonVersion}`; + const body = + "### Automated MDAnalysis Compatibility Test Failure", + "", + `**MDAnalysis version**: \`${mdaVersion}\``, + `**Python version**: \`${pythonVersion}\``, + `**Workflow Run**: [Run #${runNumber}`, + "", + "Please investigate the failure and take necessary action." + ].join("\n"); + + const { data: issues } = await github.rest.issues.listForRepo({ + owner: context.repo.owner, + repo: context.repo.repo, + state: "open", + }); + + const issueExists = issues.some(issue => issue.title === title); + + if (!issueExists) { + await github.rest.issues.create({ + owner: context.repo.owner, + repo: context.repo.repo, + title, + body, + labels: ["CI Failure", "MDAnalysis Compatibility"] + }); + console.log("Issue created:", title); + } else { + console.log("An issue with this title already exists. Skipping creation."); + } diff --git a/.github/workflows/CI.yaml b/.github/workflows/project-ci.yaml similarity index 61% rename from .github/workflows/CI.yaml rename to .github/workflows/project-ci.yaml index a81390c..4f2d94c 100644 --- a/.github/workflows/CI.yaml +++ b/.github/workflows/project-ci.yaml @@ -1,4 +1,4 @@ -name: ci +name: CodeEntropy CI on: push: @@ -67,35 +67,4 @@ jobs: - name: Run pre-commit run: | pre-commit install - pre-commit run --all-files || ( git status --short ; git diff ; exit 1 ) - - mdanalysis_compatibility: - runs-on: ubuntu-latest - timeout-minutes: 15 - strategy: - matrix: - python-version: ["3.11", "3.12", "3.13"] - mdanalysis-version: ["2.7.0", "2.8.0", "2.9.0", "latest"] - name: MDAnalysis v${{ matrix.mdanalysis-version }} / Python ${{ matrix.python-version }} - steps: - - name: Checkout repo - uses: actions/checkout@v4 - - - name: Set up Python ${{ matrix.python-version }} - uses: actions/setup-python@v5 - with: - python-version: ${{ matrix.python-version }} - - - name: Install dependencies with MDAnalysis ${{ matrix.mdanalysis-version }} - run: | - pip install --upgrade pip - if [ "${{ matrix.mdanalysis-version }}" = "latest" ]; then - pip install -e .[testing] - pip install MDAnalysis - else - pip install -e .[testing] - pip install "MDAnalysis==${{ matrix.mdanalysis-version }}" - fi - - - name: Run tests - run: pytest --cov CodeEntropy --cov-report=term-missing --cov-append \ No newline at end of file + pre-commit run --all-files || ( git status --short ; git diff ; exit 1 ) \ No newline at end of file From 790f0d95cdf23ec499472ac3a2422a442d6b2f81 Mon Sep 17 00:00:00 2001 From: harryswift01 Date: Thu, 15 May 2025 16:49:57 +0100 Subject: [PATCH 4/5] Further refinements to `CodeEntropy` CI: - Combined and condensed the two CI files into one single file - `MDAnalysis` is set to schedule run every monday morning at 08:00 UTC - Refined the issue creation using a standard library approach to reduce complexity - Addition of a `mdanalysis-compatibility-failure.md` to auto create an issue to be submitted to GitHub to resolve --- .../mdanalysis-compatability-matrix.yaml | 80 ----------- .../mdanalysis-compatibility-failure.md | 10 ++ .github/workflows/project-ci.yaml | 131 ++++++++++++------ 3 files changed, 98 insertions(+), 123 deletions(-) delete mode 100644 .github/workflows/mdanalysis-compatability-matrix.yaml create mode 100644 .github/workflows/mdanalysis-compatibility-failure.md diff --git a/.github/workflows/mdanalysis-compatability-matrix.yaml b/.github/workflows/mdanalysis-compatability-matrix.yaml deleted file mode 100644 index 7470832..0000000 --- a/.github/workflows/mdanalysis-compatability-matrix.yaml +++ /dev/null @@ -1,80 +0,0 @@ -name: MDAnalysis Compatibility Matrix - -on: - schedule: - - cron: '0 8 * * 1' - workflow_dispatch: - -jobs: - mdanalysis_compatibility: - runs-on: ubuntu-latest - timeout-minutes: 15 - strategy: - matrix: - python-version: ["3.11", "3.12", "3.13"] - mdanalysis-version: ["2.7.0", "2.8.0", "2.9.0", "latest"] - name: MDAnalysis v${{ matrix.mdanalysis-version }} / Python ${{ matrix.python-version }} - steps: - - name: Checkout repo - uses: actions/checkout@v4 - - - name: Set up Python ${{ matrix.python-version }} - uses: actions/setup-python@v5 - with: - python-version: ${{ matrix.python-version }} - - - name: Install dependencies with MDAnalysis ${{ matrix.mdanalysis-version }} - run: | - pip install --upgrade pip - pip install -e .[testing] - if [ "${{ matrix.mdanalysis-version }}" = "latest" ]; then - pip install MDAnalysis - else - pip install "MDAnalysis==${{ matrix.mdanalysis-version }}" - fi - - - name: Run tests - run: pytest --cov CodeEntropy --cov-report=term-missing --cov-append - - - name: Create Issue on Failure - if: failure() - uses: actions/github-script@v7 - with: - github-token: ${{ secrets.GITHUB_TOKEN }} - script: | - const pythonVersion = "${{ matrix.python-version }}"; - const mdaVersion = "${{ matrix.mdanalysis-version }}"; - const runNumber = "${{ github.run_number }}"; - const runUrl = "${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}"; - - const title = `CI Failure: MDAnalysis v${mdaVersion} / Python ${pythonVersion}`; - const body = - "### Automated MDAnalysis Compatibility Test Failure", - "", - `**MDAnalysis version**: \`${mdaVersion}\``, - `**Python version**: \`${pythonVersion}\``, - `**Workflow Run**: [Run #${runNumber}`, - "", - "Please investigate the failure and take necessary action." - ].join("\n"); - - const { data: issues } = await github.rest.issues.listForRepo({ - owner: context.repo.owner, - repo: context.repo.repo, - state: "open", - }); - - const issueExists = issues.some(issue => issue.title === title); - - if (!issueExists) { - await github.rest.issues.create({ - owner: context.repo.owner, - repo: context.repo.repo, - title, - body, - labels: ["CI Failure", "MDAnalysis Compatibility"] - }); - console.log("Issue created:", title); - } else { - console.log("An issue with this title already exists. Skipping creation."); - } diff --git a/.github/workflows/mdanalysis-compatibility-failure.md b/.github/workflows/mdanalysis-compatibility-failure.md new file mode 100644 index 0000000..87a0fd8 --- /dev/null +++ b/.github/workflows/mdanalysis-compatibility-failure.md @@ -0,0 +1,10 @@ +--- +title: CI Failure: MDAnalysis v{{ env.MDA_VERSION }} / Python {{ env.PYTHON_VERSION }} +labels: CI Failure, MDAnalysis Compatibility +--- + +### Automated MDAnalysis Compatibility Test Failure + +**MDAnalysis version**: `{{ env.MDA_VERSION }}` +**Python version**: `{{ env.PYTHON_VERSION }}` +**Workflow Run**: [Run #{{ env.RUN_NUMBER }}]({{ env.RUN_URL }}) diff --git a/.github/workflows/project-ci.yaml b/.github/workflows/project-ci.yaml index 4f2d94c..63aa6fc 100644 --- a/.github/workflows/project-ci.yaml +++ b/.github/workflows/project-ci.yaml @@ -4,6 +4,8 @@ on: push: branches: [main] pull_request: + schedule: + - cron: '0 8 * * 1' jobs: tests: @@ -14,57 +16,100 @@ jobs: python-version: ["3.11", "3.12", "3.13"] name: Run tests steps: - - name: Checkout repo - uses: actions/checkout@v4 + - name: Checkout repo + uses: actions/checkout@v4 - - name: Set up Python ${{ matrix.python-version }} - uses: actions/setup-python@v5 - with: - python-version: ${{ matrix.python-version }} + - name: Set up Python ${{ matrix.python-version }} + uses: actions/setup-python@v5 + with: + python-version: ${{ matrix.python-version }} - - name: Install CodeEntropy and its testing dependencies - shell: bash - run: pip install -e .[testing] + - name: Install CodeEntropy and its testing dependencies + run: pip install -e .[testing] - - name: Run test suite - shell: bash - run: pytest --cov CodeEntropy --cov-report term-missing --cov-append . + - name: Run test suite + run: pytest --cov CodeEntropy --cov-report term-missing --cov-append . - - name: Coveralls GitHub Action - uses: coverallsapp/github-action@v2.3.6 - with: - github-token: ${{ secrets.COVERALLS_REPO_TOKEN }} + - name: Coveralls GitHub Action + uses: coverallsapp/github-action@v2.3.6 + with: + github-token: ${{ secrets.COVERALLS_REPO_TOKEN }} docs: runs-on: ubuntu-latest timeout-minutes: 15 steps: - - uses: actions/checkout@v4 - - name: Set up Python 3.12 - uses: actions/setup-python@v5 - with: - python-version: 3.12 - - name: Install python dependencies - run: | - pip install --upgrade pip - pip install -e .[docs] - - name: Build docs - run: cd docs && make + - uses: actions/checkout@v4 + - name: Set up Python 3.12 + uses: actions/setup-python@v5 + with: + python-version: 3.12 + - name: Install python dependencies + run: | + pip install --upgrade pip + pip install -e .[docs] + - name: Build docs + run: cd docs && make pre-commit: - runs-on: ubuntu-latest - timeout-minutes: 15 - steps: - - uses: actions/checkout@v4 - - name: Set up Python 3.11 - uses: actions/setup-python@v5 - with: - python-version: 3.11 - - name: Install python dependencies - run: | - pip install --upgrade pip - pip install -e .[pre-commit,docs,testing] - - name: Run pre-commit - run: | - pre-commit install - pre-commit run --all-files || ( git status --short ; git diff ; exit 1 ) \ No newline at end of file + runs-on: ubuntu-latest + timeout-minutes: 15 + steps: + - uses: actions/checkout@v4 + - name: Set up Python 3.11 + uses: actions/setup-python@v5 + with: + python-version: 3.11 + - name: Install python dependencies + run: | + pip install --upgrade pip + pip install -e .[pre-commit,docs,testing] + - name: Run pre-commit + run: | + pre-commit install + pre-commit run --all-files || ( git status --short ; git diff ; exit 1 ) + + mdanalysis-compatibility: + if: github.event_name == 'schedule' + runs-on: ubuntu-latest + timeout-minutes: 15 + strategy: + matrix: + python-version: ["3.11", "3.12", "3.13"] + mdanalysis-version: ["2.7.0", "2.8.0", "2.9.0", "latest"] + name: MDAnalysis v${{ matrix.mdanalysis-version }} / Python ${{ matrix.python-version }} + steps: + - name: Checkout repo + uses: actions/checkout@v4 + + - name: Set up Python ${{ matrix.python-version }} + uses: actions/setup-python@v5 + with: + python-version: ${{ matrix.python-version }} + + - name: Install dependencies with MDAnalysis ${{ matrix.mdanalysis-version }} + run: | + pip install --upgrade pip + pip install -e .[testing] + if [ "${{ matrix.mdanalysis-version }}" = "latest" ]; then + pip install MDAnalysis + else + pip install "MDAnalysis==${{ matrix.mdanalysis-version }}" + fi + + - name: Run compatibility tests + run: pytest --cov CodeEntropy --cov-report=term-missing --cov-append + + - name: Create Issue on Failure + if: failure() + uses: JasonEtco/create-an-issue@v2 + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + PYTHON_VERSION: ${{ matrix.python-version }} + MDA_VERSION: ${{ matrix.mdanalysis-version }} + RUN_NUMBER: ${{ github.run_number }} + RUN_URL: ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }} + with: + filename: .github/mdanalysis-compatibility-failure.md + update_existing: true + search_existing: open \ No newline at end of file From 54639736e4a6d66e74d1a93c4026c6a525b67207 Mon Sep 17 00:00:00 2001 From: harryswift01 Date: Thu, 15 May 2025 16:58:24 +0100 Subject: [PATCH 5/5] Final tweaks for refined CI structure: - Pulled in changes from upstream branches - Updaated naming conventions on the `MDAnalysis` tests --- .github/workflows/project-ci.yaml | 2 +- tests/test_CodeEntropy/test_run.py | 9 ++++++--- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/.github/workflows/project-ci.yaml b/.github/workflows/project-ci.yaml index 63aa6fc..566b1b7 100644 --- a/.github/workflows/project-ci.yaml +++ b/.github/workflows/project-ci.yaml @@ -77,7 +77,7 @@ jobs: matrix: python-version: ["3.11", "3.12", "3.13"] mdanalysis-version: ["2.7.0", "2.8.0", "2.9.0", "latest"] - name: MDAnalysis v${{ matrix.mdanalysis-version }} / Python ${{ matrix.python-version }} + name: MDAnalysis Compatibility Tests steps: - name: Checkout repo uses: actions/checkout@v4 diff --git a/tests/test_CodeEntropy/test_run.py b/tests/test_CodeEntropy/test_run.py index 39865cc..4303d9e 100644 --- a/tests/test_CodeEntropy/test_run.py +++ b/tests/test_CodeEntropy/test_run.py @@ -136,9 +136,12 @@ def test_run_entropy_workflow(self): run_manager._config_manager.merge_configs.return_value = mock_args mock_entropy_manager = MagicMock() - with unittest.mock.patch( - "CodeEntropy.run.EntropyManager", return_value=mock_entropy_manager - ), unittest.mock.patch("CodeEntropy.run.mda.Universe") as mock_universe: + with ( + unittest.mock.patch( + "CodeEntropy.run.EntropyManager", return_value=mock_entropy_manager + ), + unittest.mock.patch("CodeEntropy.run.mda.Universe") as mock_universe, + ): run_manager.run_entropy_workflow()