|
| 1 | +name: GH Actions CI |
| 2 | +on: |
| 3 | + push: |
| 4 | + branches: |
| 5 | + - "**" # main -- replaced main to allow CI to run in example cookie repo |
| 6 | + pull_request: |
| 7 | + branches: |
| 8 | + - "**" # main -- replaced main to allow CI to run in example cookie repo |
| 9 | + schedule: |
| 10 | + # Weekly tests at midnight on Sundays run on main by default: |
| 11 | + # Scheduled workflows run on the latest commit on the default or base branch. |
| 12 | + # (from https://help.github.com/en/actions/reference/events-that-trigger-workflows#scheduled-events-schedule) |
| 13 | + - cron: "0 0 * * 0" |
| 14 | + |
| 15 | +concurrency: |
| 16 | + # Specific group naming so CI is only cancelled |
| 17 | + # within same PR or on merge to main |
| 18 | + group: ${{ github.ref }}-${{ github.head_ref }}-${{ github.workflow }} |
| 19 | + cancel-in-progress: true |
| 20 | + |
| 21 | +defaults: |
| 22 | + run: |
| 23 | + shell: bash -l {0} |
| 24 | + |
| 25 | +jobs: |
| 26 | + main-tests: |
| 27 | + if: "github.repository == 'MDAnalysis/mdakit-Cookie'" |
| 28 | + runs-on: ${{ matrix.os }} |
| 29 | + strategy: |
| 30 | + fail-fast: false |
| 31 | + matrix: |
| 32 | + os: [ubuntu-latest, macOS-latest, windows-latest] |
| 33 | + mdanalysis-version: ["latest", "develop"] |
| 34 | + python-version: ["3.11", "3.12", "3.13", "3.14"] |
| 35 | + |
| 36 | + steps: |
| 37 | + - uses: actions/checkout@v4 |
| 38 | + |
| 39 | + - name: Build information |
| 40 | + run: | |
| 41 | + uname -a |
| 42 | + df -h |
| 43 | + ulimit -a |
| 44 | +
|
| 45 | +
|
| 46 | + # More info on options: https://github.com/conda-incubator/setup-miniconda |
| 47 | + - name: Install conda dependencies |
| 48 | + uses: conda-incubator/setup-miniconda@v4 |
| 49 | + with: |
| 50 | + python-version: ${{ matrix.python-version }} |
| 51 | + environment-file: devtools/conda-envs/test_env.yaml |
| 52 | + add-pip-as-python-dependency: true |
| 53 | + |
| 54 | + miniforge-version: "latest" |
| 55 | + use-mamba: true |
| 56 | + channels: conda-forge |
| 57 | + |
| 58 | + activate-environment: mdakit-Cookie-test |
| 59 | + auto-update-conda: true |
| 60 | + auto-activate-base: false |
| 61 | + show-channel-urls: true |
| 62 | + |
| 63 | + |
| 64 | + - name: Install MDAnalysis version |
| 65 | + uses: MDAnalysis/install-mdanalysis@main |
| 66 | + with: |
| 67 | + version: ${{ matrix.mdanalysis-version }} |
| 68 | + install-tests: false |
| 69 | + installer: mamba |
| 70 | + shell: bash -l {0} |
| 71 | + |
| 72 | + - name: Install package |
| 73 | + run: | |
| 74 | + python --version |
| 75 | + python -m pip install . --no-deps |
| 76 | +
|
| 77 | + - name: Python information |
| 78 | + run: | |
| 79 | + which python |
| 80 | + which pip |
| 81 | + pip list |
| 82 | +
|
| 83 | + conda info |
| 84 | + conda list |
| 85 | +
|
| 86 | +
|
| 87 | + - name: Run tests |
| 88 | + run: | |
| 89 | + pytest -n 2 -v --cov=cookieKit --cov-report=xml --color=yes cookieKit/tests/ |
| 90 | +
|
| 91 | + - name: codecov |
| 92 | + if: github.repository == 'MDAnalysis/mdakit-Cookie' && github.event_name != 'schedule' |
| 93 | + uses: codecov/codecov-action@v5 |
| 94 | + with: |
| 95 | + file: coverage.xml |
| 96 | + name: codecov-${{ matrix.os }}-py${{ matrix.python-version }} |
| 97 | + verbose: True |
| 98 | + # to upload coverage reports, set a secret called CODECOV_TOKEN |
| 99 | + # in the repository settings |
| 100 | + # (Obtain this from the Codecov website after setting up the repository there) |
| 101 | + token: ${{ secrets.CODECOV_TOKEN }} |
| 102 | + # To fail the CI if there's an error, keep this set to true |
| 103 | + # If repository forks need to run CI, you may need to set this to false |
| 104 | + # Forks can't access the CODECOV_TOKEN secret, |
| 105 | + # and a failed upload registers as an error |
| 106 | + fail_ci_if_error: false |
| 107 | + |
| 108 | + |
| 109 | + pylint_check: |
| 110 | + if: "github.repository == 'MDAnalysis/mdakit-Cookie'" |
| 111 | + runs-on: ubuntu-latest |
| 112 | + |
| 113 | + steps: |
| 114 | + - uses: actions/checkout@v4 |
| 115 | + |
| 116 | + - name: Set up Python |
| 117 | + uses: actions/setup-python@v5 |
| 118 | + with: |
| 119 | + python-version: "3.12" |
| 120 | + |
| 121 | + - name: Install Pylint |
| 122 | + run: | |
| 123 | + which pip |
| 124 | + which python |
| 125 | + pip install pylint mdanalysis |
| 126 | +
|
| 127 | + - name: Run Pylint |
| 128 | + env: |
| 129 | + PYLINTRC: .pylintrc |
| 130 | + run: | |
| 131 | + pylint . |
| 132 | +
|
| 133 | +
|
| 134 | + pypi_check: |
| 135 | + if: "github.repository == 'MDAnalysis/mdakit-Cookie'" |
| 136 | + runs-on: ubuntu-latest |
| 137 | + |
| 138 | + steps: |
| 139 | + - uses: actions/checkout@v4 |
| 140 | + |
| 141 | + - name: Set up Python |
| 142 | + uses: actions/setup-python@v5 |
| 143 | + with: |
| 144 | + python-version: "3.12" |
| 145 | + |
| 146 | + - name: Install dependencies |
| 147 | + run: | |
| 148 | + pip install pipx twine |
| 149 | +
|
| 150 | + - name: Build package |
| 151 | + run: | |
| 152 | + python -m pipx run build --sdist |
| 153 | +
|
| 154 | + - name: Check package build |
| 155 | + run: | |
| 156 | + DISTRIBUTION=$(ls -t1 dist/mdakit_cookie-*.tar.gz | head -n 1) |
| 157 | + test -n "${DISTRIBUTION}" || { echo "no distribution dist/mdakit-Cookie-*.tar.gz found"; exit 1; } |
| 158 | + echo "twine check $DISTRIBUTION" |
| 159 | + twine check $DISTRIBUTION |
0 commit comments