Skip to content

Commit ba0036a

Browse files
committed
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
1 parent bd3655c commit ba0036a

2 files changed

Lines changed: 82 additions & 33 deletions

File tree

Lines changed: 80 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,80 @@
1+
name: MDAnalysis Compatibility Matrix
2+
3+
on:
4+
schedule:
5+
- cron: '0 8 * * 1'
6+
workflow_dispatch:
7+
8+
jobs:
9+
mdanalysis_compatibility:
10+
runs-on: ubuntu-latest
11+
timeout-minutes: 15
12+
strategy:
13+
matrix:
14+
python-version: ["3.11", "3.12", "3.13"]
15+
mdanalysis-version: ["2.7.0", "2.8.0", "2.9.0", "latest"]
16+
name: MDAnalysis v${{ matrix.mdanalysis-version }} / Python ${{ matrix.python-version }}
17+
steps:
18+
- name: Checkout repo
19+
uses: actions/checkout@v4
20+
21+
- name: Set up Python ${{ matrix.python-version }}
22+
uses: actions/setup-python@v5
23+
with:
24+
python-version: ${{ matrix.python-version }}
25+
26+
- name: Install dependencies with MDAnalysis ${{ matrix.mdanalysis-version }}
27+
run: |
28+
pip install --upgrade pip
29+
pip install -e .[testing]
30+
if [ "${{ matrix.mdanalysis-version }}" = "latest" ]; then
31+
pip install MDAnalysis
32+
else
33+
pip install "MDAnalysis==${{ matrix.mdanalysis-version }}"
34+
fi
35+
36+
- name: Run tests
37+
run: pytest --cov CodeEntropy --cov-report=term-missing --cov-append
38+
39+
- name: Create Issue on Failure
40+
if: failure()
41+
uses: actions/github-script@v7
42+
with:
43+
github-token: ${{ secrets.GITHUB_TOKEN }}
44+
script: |
45+
const pythonVersion = "${{ matrix.python-version }}";
46+
const mdaVersion = "${{ matrix.mdanalysis-version }}";
47+
const runNumber = "${{ github.run_number }}";
48+
const runUrl = "${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}";
49+
50+
const title = `CI Failure: MDAnalysis v${mdaVersion} / Python ${pythonVersion}`;
51+
const body =
52+
"### Automated MDAnalysis Compatibility Test Failure",
53+
"",
54+
`**MDAnalysis version**: \`${mdaVersion}\``,
55+
`**Python version**: \`${pythonVersion}\``,
56+
`**Workflow Run**: [Run #${runNumber}`,
57+
"",
58+
"Please investigate the failure and take necessary action."
59+
].join("\n");
60+
61+
const { data: issues } = await github.rest.issues.listForRepo({
62+
owner: context.repo.owner,
63+
repo: context.repo.repo,
64+
state: "open",
65+
});
66+
67+
const issueExists = issues.some(issue => issue.title === title);
68+
69+
if (!issueExists) {
70+
await github.rest.issues.create({
71+
owner: context.repo.owner,
72+
repo: context.repo.repo,
73+
title,
74+
body,
75+
labels: ["CI Failure", "MDAnalysis Compatibility"]
76+
});
77+
console.log("Issue created:", title);
78+
} else {
79+
console.log("An issue with this title already exists. Skipping creation.");
80+
}
Lines changed: 2 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
name: ci
1+
name: CodeEntropy CI
22

33
on:
44
push:
@@ -67,35 +67,4 @@ jobs:
6767
- name: Run pre-commit
6868
run: |
6969
pre-commit install
70-
pre-commit run --all-files || ( git status --short ; git diff ; exit 1 )
71-
72-
mdanalysis_compatibility:
73-
runs-on: ubuntu-latest
74-
timeout-minutes: 15
75-
strategy:
76-
matrix:
77-
python-version: ["3.11", "3.12", "3.13"]
78-
mdanalysis-version: ["2.7.0", "2.8.0", "2.9.0", "latest"]
79-
name: MDAnalysis v${{ matrix.mdanalysis-version }} / Python ${{ matrix.python-version }}
80-
steps:
81-
- name: Checkout repo
82-
uses: actions/checkout@v4
83-
84-
- name: Set up Python ${{ matrix.python-version }}
85-
uses: actions/setup-python@v5
86-
with:
87-
python-version: ${{ matrix.python-version }}
88-
89-
- name: Install dependencies with MDAnalysis ${{ matrix.mdanalysis-version }}
90-
run: |
91-
pip install --upgrade pip
92-
if [ "${{ matrix.mdanalysis-version }}" = "latest" ]; then
93-
pip install -e .[testing]
94-
pip install MDAnalysis
95-
else
96-
pip install -e .[testing]
97-
pip install "MDAnalysis==${{ matrix.mdanalysis-version }}"
98-
fi
99-
100-
- name: Run tests
101-
run: pytest --cov CodeEntropy --cov-report=term-missing --cov-append
70+
pre-commit run --all-files || ( git status --short ; git diff ; exit 1 )

0 commit comments

Comments
 (0)