|
| 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 | + } |
0 commit comments