Updated examples from cookiecutter-mdakit at 9adc17f #582
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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: | |
environment-config: | |
runs-on: ubuntu-latest | |
outputs: | |
stable-python-version: ${{ steps.get-compatible-python.outputs.stable-python }} | |
python-matrix: ${{ steps.get-compatible-python.outputs.python-versions }} | |
steps: | |
- uses: actions/setup-python@v4 | |
with: | |
python-version: "3.11" | |
- id: get-compatible-python | |
uses: MDAnalysis/mdanalysis-compatible-python@main | |
main-tests: | |
if: "github.repository == 'MDAnalysis/mdakit-cookie'" | |
needs: environment-config | |
runs-on: ${{ matrix.os }} | |
strategy: | |
fail-fast: false | |
matrix: | |
os: [macOS-latest, ubuntu-latest, windows-latest] | |
python-version: ${{ fromJSON(needs.environment-config.outputs.python-matrix) }} | |
mdanalysis-version: ["latest", "develop"] | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Build information | |
run: | | |
uname -a | |
df -h | |
ulimit -a | |
- name: Set up Python ${{ matrix.python-version }} | |
uses: actions/setup-python@v4 | |
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=mdakit_cookie --cov-report=xml --color=yes mdakit_cookie/tests/ | |
- name: codecov | |
if: github.repository == 'MDAnalysis/mdakit-cookie' && github.event_name != 'schedule' | |
uses: codecov/codecov-action@v3 | |
with: | |
file: coverage.xml | |
name: codecov-${{ matrix.os }}-py${{ matrix.python-version }} | |
verbose: True | |
pylint_check: | |
if: "github.repository == 'MDAnalysis/mdakit-cookie'" | |
needs: environment-config | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Set up Python | |
uses: actions/setup-python@v4 | |
with: | |
python-version: ${{ needs.environment-config.outputs.stable-python-version }} | |
- 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 == 'MDAnalysis/mdakit-cookie'" | |
needs: environment-config | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Set up Python ${{ needs.environment-config.outputs.stable-python-version }} | |
uses: actions/setup-python@v4 | |
with: | |
python-version: ${{ needs.environment-config.outputs.stable-python-version }} | |
- name: Install dependencies | |
run: | | |
pip install setuptools cython numpy twine | |
- name: Build package | |
run: | | |
python setup.py 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 |