Skip to content

Updated examples from cookiecutter-mdakit at 99b1fb9 #1143

Updated examples from cookiecutter-mdakit at 99b1fb9

Updated examples from cookiecutter-mdakit at 99b1fb9 #1143

Workflow file for this run

name: GH Actions CI
on:
push:
branches:
- "**" # main -- replaced main to allow CI to run in example cookie repo
pull_request:
branches:
- "**" # main -- replaced main to allow CI to run in example cookie repo
schedule:
# Weekly tests at midnight on Sundays run on main by default:
# Scheduled workflows run on the latest commit on the default or base branch.
# (from https://help.github.com/en/actions/reference/events-that-trigger-workflows#scheduled-events-schedule)
- cron: "0 0 * * 0"
concurrency:
# Specific group naming so CI is only cancelled
# within same PR or on merge to main
group: ${{ github.ref }}-${{ github.head_ref }}-${{ github.workflow }}
cancel-in-progress: true
defaults:
run:
shell: bash
jobs:
main-tests:
if: "github.repository == 'other/mdakit-Cookie'"
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, macOS-latest, windows-latest]
mdanalysis-version: ["latest", "develop"]
python-version: ["3.10", "3.11", "3.12"]
exclude:
# Entries here exclude particular combinations of the matrix
# Edit or remove as particular combinations come into or out of date
# Below we exclude runs with the latest release and Python 3.12
- mdanalysis-version: "latest"
python-version: "3.12"
steps:
- uses: actions/checkout@v4
- name: Build information
run: |
uname -a
df -h
ulimit -a
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
- name: Install testing dependencies
run: |
python -m pip install -U pytest pytest-xdist pytest-cov codecov
- name: Install MDAnalysis version
uses: MDAnalysis/install-mdanalysis@main
with:
version: ${{ matrix.mdanalysis-version }}
install-tests: false
installer: pip
shell: bash
- name: Install package
run: |
python --version
python -m pip install .
- name: Python information
run: |
which python
which pip
pip list
- name: Run tests
run: |
pytest -n 2 -v --cov=cookieKit --cov-report=xml --color=yes cookieKit/tests/
- name: codecov
if: github.repository == 'other/mdakit-Cookie' && github.event_name != 'schedule'
uses: codecov/codecov-action@v4
with:
file: coverage.xml
name: codecov-${{ matrix.os }}-py${{ matrix.python-version }}
verbose: True
# to upload coverage reports, set a secret called CODECOV_TOKEN
# in the repository settings
# (Obtain this from the Codecov website after setting up the repository there)
token: ${{ secrets.CODECOV_TOKEN }}
# To fail the CI if there's an error, keep this set to true
# If repository forks need to run CI, you may need to set this to false
# Forks can't access the CODECOV_TOKEN secret,
# and a failed upload registers as an error
fail_ci_if_error: true
pylint_check:
if: "github.repository == 'other/mdakit-Cookie'"
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: "3.11"
- name: Install Pylint
run: |
which pip
which python
pip install pylint mdanalysis
- name: Run Pylint
env:
PYLINTRC: .pylintrc
run: |
pylint mdakit-Cookie
pypi_check:
if: "github.repository == 'other/mdakit-Cookie'"
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: "3.11"
- name: Install dependencies
run: |
pip install pipx twine
- name: Build package
run: |
python -m pipx run build --sdist
- name: Check package build
run: |
DISTRIBUTION=$(ls -t1 dist/mdakit_cookie-*.tar.gz | head -n 1)
test -n "${DISTRIBUTION}" || { echo "no distribution dist/mdakit-Cookie-*.tar.gz found"; exit 1; }
echo "twine check $DISTRIBUTION"
twine check $DISTRIBUTION