From f9eb291c0f480066e997b4f9a54fba9b40035161 Mon Sep 17 00:00:00 2001 From: Oliver Beckstein Date: Sun, 10 Oct 2021 02:33:23 -0700 Subject: [PATCH 1/2] [CI] switch from Travis CI to GitHub actions - fix #146 - test MDAnalysis >= 1.0.0, <2 (noted in CHANGELOG) --- .github/workflows/docs.yaml | 59 ++++++++++++++ .github/workflows/gh-ci.yaml | 152 +++++++++++++++++++++++++++++++++++ .travis.yml | 76 ------------------ CHANGELOG | 2 +- ci/deploy_docs.sh | 55 ------------- setup.py | 4 +- 6 files changed, 214 insertions(+), 134 deletions(-) create mode 100644 .github/workflows/docs.yaml create mode 100644 .github/workflows/gh-ci.yaml delete mode 100644 .travis.yml delete mode 100755 ci/deploy_docs.sh diff --git a/.github/workflows/docs.yaml b/.github/workflows/docs.yaml new file mode 100644 index 00000000..90f82fe5 --- /dev/null +++ b/.github/workflows/docs.yaml @@ -0,0 +1,59 @@ +name: docs deployment +on: + push: + branches: + - master + +concurrency: + group: "${{ github.ref }}-${{ github.head_ref }}" + cancel-in-progress: true + +defaults: + run: + shell: bash -l {0} + +jobs: + docs: + if: "github.repository == 'MDAnalysis/pmda'" + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v2 + + - name: setup_miniconda + uses: conda-incubator/setup-miniconda@v2 + with: + python-version: 3.7 + auto-update-conda: true + channel-priority: flexible + channels: conda-forge + add-pip-as-python-dependency: true + mamba-version: "*" + + - name: install package deps + run: | + mamba install 'mdanalysis<2' dask distributed sphinx + pip install sphinx-sitemap sphinx-rtd-theme + + - name: check install + run: | + which python + which pip + conda info + conda list + + - name: install package + run: | + pip install -v . + + - name: build docs + run: | + python setup.py build_sphinx + + - name: deploy docs + uses: peaceiris/actions-gh-pages@v3 + with: + github_token: ${{ secrets.GITHUB_TOKEN }} + publish_dir: ./build/sphinx/html + user_name: 'github-actions' + user_email: 'github-action@users.noreply.github.com' diff --git a/.github/workflows/gh-ci.yaml b/.github/workflows/gh-ci.yaml new file mode 100644 index 00000000..e4bbb7aa --- /dev/null +++ b/.github/workflows/gh-ci.yaml @@ -0,0 +1,152 @@ +name: GH Actions CI +on: + push: + branches: + - develop + - master + pull_request: + branches: + - develop + - master + +concurrency: + # Probably overly cautious group naming. + # Commits to develop/master will cancel each other, but PRs will only cancel + # commits within the same PR + group: "${{ github.ref }}-${{ github.head_ref }}" + cancel-in-progress: true + +defaults: + run: + shell: bash -l {0} + +jobs: + unittests: + if: "github.repository == 'MDAnalysis/pmda'" + runs-on: ${{ matrix.os }} + strategy: + fail-fast: false + matrix: + os: [ubuntu-latest, ] + python-version: [2.7, 3.7, 3.8] + include: + - name: macOS_bigsur_py39 + os: macOS-11 + python-version: 3.8 + - name: macOS_catalina_py37 + os: macOS-10.15 + python-version: 3.7 + env: + CYTHON_TRACE_NOGIL: 1 + MPLBACKEND: agg + GH_OS: ${{ matrix.os }} + + steps: + - uses: actions/checkout@v2 + + - name: setup_miniconda + uses: conda-incubator/setup-miniconda@v2 + with: + python-version: ${{ matrix.python-version }} + auto-update-conda: true + channel-priority: flexible + # The order of these channel matters: both provide "fundamental" + # software (curl, ssh, ...), but the version in biobuilds are very + # outdated. This can lead to problem when loading shared libraries, + # see https://github.com/MDAnalysis/mdanalysis/pull/3126#issuecomment-813112080 + channels: conda-forge, biobuilds + add-pip-as-python-dependency: true + mamba-version: "*" + architecture: x64 + + - name: install_deps + run: | + mamba install 'mdanalysis>=1.1.1,<2' 'mdanalysistests>=1.1.1,<2' dask distributed joblib mock codecov + pip install 'coverage<5' 'pytest-cov==2.10.1' pytest-xdist + + - name: check_setup + run: | + # Check OS and python setup + echo "OS: ${OS_NAME}" + which python + which pip + pip list + conda info + conda list + + - name: install PMDA package + run: python -m pip install -v . + + - name: run tests + run: | + pytest -v --cov=pmda --cov-report=xml --color=yes ./pmda/test + + - name: codecov + uses: codecov/codecov-action@v2 + with: + file: coverage.xml + fail_ci_if_error: True + verbose: True + + pylint_check: + if: "github.repository == 'MDAnalysis/pmda'" + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v2 + + - name: setup_miniconda + uses: conda-incubator/setup-miniconda@v2 + with: + python-version: 3.7 + auto-update-conda: true + channel-priority: flexible + channels: conda-forge + add-pip-as-python-dependency: true + architecture: x64 + + - name: install + run: | + which pip + which python + pip install pylint + + - name: pylint + env: + PYLINTRC: .pylintrc + run: | + pylint pmda + + + pypi_check: + if: "github.repository == 'MDAnalysis/pmda'" + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v2 + + - name: setup_miniconda + uses: conda-incubator/setup-miniconda@v2 + with: + python-version: 3.7 + auto-update-conda: true + channel-priority: flexible + channels: conda-forge + add-pip-as-python-dependency: true + # mamba not enabled as install longer than deps install + architecture: x64 + + - name: install_conda + run: | + conda install setuptools twine + + - name: install PMDA + run: | + python setup.py sdist + + - name: check package build + run: | + DISTRIBUTION=$(ls -t1 dist/pmda-*.tar.gz | head -n 1) + test -n "${DISTRIBUTION}" || { echo "no distribution dist/pmda-*.tar.gz found"; exit 1; } + echo "twine check $DISTRIBUTION" + twine check $DISTRIBUTION diff --git a/.travis.yml b/.travis.yml deleted file mode 100644 index 768474f4..00000000 --- a/.travis.yml +++ /dev/null @@ -1,76 +0,0 @@ -language: generic -sudo: false - -# Only build for develop and master (and PRs) -branches: - only: - - master - -os: - linux - -env: - global: - - secure: "ifPjMMIP4eV58IF3//zrPpN8hYPrcT9Sfq953yX3Wu3ObQ0r3y7qHCMBwRLqf14SYDSf4siYPm+GTkKW9Gb4jIZzmOJPFOgSJJx6MjtaS+kbzG3uNGpjqOVz9RfGzXlZM1cNkuPZjofq2pBOIIqrE7psWUJiOfDtAkTa+BGMl6Oc8pBCVtVQt0XT1xkg1nejjNNuRvuKnLCyx40SMReDU68ai4Q0PFmIkbf6duMd8zWfR9ITZJYQETRmZn85KiyW0Ax6W9dQgK0O6n3ucId3QIQ5Iim3MyLzp/d/KeLBnO/i3spTvGrlyPGQLKk78nVjZRVaqKaubJpAXWgCGHOF51LRVvdFc73TTvivu0GPiY0FlyKOsY+MHE13+RJHsLXa9aueO0NUw4/2WjwtCkV2LYHJRszc8VbyD6b8mgJwc6lchaptmNknn9TvlCTNzI3GS7QVuhZJzNGkCvH86IMdMf9NyxeNBEW0HyAbST8LTArbqMtBZlU5HwxhI50JcdmKhudZCZs2k/YipWp8PIz3R+gmSHRtwseV7paM0Np12Q9+xvIYNKto9+frGlPDChP4wTdSpJBN7fY5bcwHrN6v/AFPIHXSIne+8UvKrjlNa8ZFaCMWC8Yc+GBwjCe+dhbV4+UtuDoC1ABgyY3haFXMu8mtWslzbwozzw0W30OFYWg=" - # Set default python version to avoid repetition later - - PYTHON_VERSION=3.7 - - MAIN_CMD="pytest" - - SETUP_CMD="pmda --cov pmda" - # mdanalysis develop from source (see below), which needs - # minimal CONDA_MDANALYSIS_DEPENDENCIES - #- CONDA_DEPENDENCIES="mdanalysis mdanalysistests dask joblib mock codecov cython hypothesis sphinx" - #- CONDA_MDANALYSIS_DEPENDENCIES="cython mmtf-python six biopython networkx scipy griddataformats gsd hypothesis" - - CONDA_MDANALYSIS_DEPENDENCIES="mdanalysis mdanalysistests" - # pin to matplotlib 3.2 should be removed once mda > 1.0.0 is available. - - CONDA_DEPENDENCIES="${CONDA_MDANALYSIS_DEPENDENCIES} dask distributed joblib mock codecov matplotlib=3.2" - - CONDA_CHANNELS='conda-forge' - - CONDA_CHANNEL_PRIORITY=True - # install development version of MDAnalysis (needed until the test - # files for analysis.rdf are available in release 0.19.0) - #- PIP_DEPENDENCIES="git+https://github.com/MDAnalysis/mdanalysis#egg=mdanalysis&subdirectory=package git+https://github.com/MDAnalysis/mdanalysis#egg=mdanalysistests&subdirectory=testsuite" - - NUMPY_VERSION=stable - - BUILD_CMD='python setup.py develop' - - CODECOV=false - # for automatic doc building & deployment - - BUILD_DOCS=false - - GH_DOC_BRANCH: master - - GH_REPOSITORY: github.com/MDAnalysis/pmda.git - - GIT_CI_USER: TravisCI - - GIT_CI_EMAIL: TravisCI@mdanalysis.org - - MDA_DOCDIR: ${TRAVIS_BUILD_DIR}/build/sphinx/html - - - matrix: - - PYTHON=3.8 CODECOV=true - - PYTHON=3.7 CODECOV=true - - PYTHON=3.6 CODECOV=true - - PYTHON=2.7 CODECOV=true - - NAME='lint' MAIN_CMD='pylint pmda' BUILD_CMD='' SETUP_CMD='' - -matrix: - fast_finish: true - include: - - env: NAME="Doc" - MAIN_CMD="python setup.py" - SETUP_CMD="build_sphinx" - BUILD_DOCS=true - PIP_DEPENDENCIES="${PIP_DEPENDENCIES} sphinx-sitemap sphinx-rtd-theme" - -install: - - git clone --depth 1 git://github.com/astropy/ci-helpers.git - - source ci-helpers/travis/setup_conda.sh - - echo $BUILD_CMD - - $BUILD_CMD - -script: - - echo $MAIN_CMD $SETUP_CMD - - eval $MAIN_CMD $SETUP_CMD - -after_success: - - | - if [[ $CODECOV == 'true' ]]; then \ - codecov; \ - fi - - if [[ ${TRAVIS_PULL_REQUEST} == "false" ]] && [[ ${BUILD_DOCS} == "true" ]] && [[ ${TRAVIS_BRANCH} == ${GH_DOC_BRANCH} ]]; then - bash ${TRAVIS_BUILD_DIR}/ci/deploy_docs.sh; - fi diff --git a/CHANGELOG b/CHANGELOG index 58b1ab97..77937fca 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -33,7 +33,7 @@ Fixes * raise ValueError when n_blocks > n_frames (Issue #137, PR #138) Changes - * requires MDAnalysis >= 1.0.0 (#122) + * requires MDAnalysis >= 1.0.0 and <2.0.0 (#122) * dropped official support for Python 3.5 (2.7 and >= 3.6 are supported) diff --git a/ci/deploy_docs.sh b/ci/deploy_docs.sh deleted file mode 100755 index 7160349f..00000000 --- a/ci/deploy_docs.sh +++ /dev/null @@ -1,55 +0,0 @@ -#!/bin/bash -# Deploying docs from travis-ci. -# See https://github.com/MDAnalysis/mdanalysis/issues/386 -# Script based on https://github.com/steveklabnik/automatically_update_github_pages_with_travis_example - -# Run this script from the top-level of the checked out git -# repository. A github OAuth token must be available in the evironment -# variable GH_TOKEN and is set up through the .travis.yml -# env:global:secure parameter (encrypted with travis-ci's public key)/ -# -# Additional environment variables set in .travis.yml -# GH_REPOSITORY repo to full from and push to -# GH_DOC_BRANCH branch from which the docs are built -# GIT_CI_USER name of the user to push docs as -# GIT_CI_EMAIL email of the user to push docs as -# MDA_DOCDIR path to the docdir from top of repo -# -# NOTE: If any of these environment variables are not set or -# empty then the script will exit with an error (-o nounset). - -set -o errexit -o nounset - -function die () { - local msg="$1" err=${2:-1} - echo "ERROR: $msg [$err]" - exit $err -} - -rev=$(git rev-parse --short HEAD) - -# the following tests should be superfluous because of -o nounset -test -n "${GH_TOKEN}" || die "GH_TOKEN is empty: need OAuth GitHub token to continue" 100 -test -n "${GH_REPOSITORY}" || die "GH_REPOSITORY must be set in .travis.yml" 100 -test -n "${MDA_DOCDIR}" || die "MDA_DOCDIR must be set in .travis.yml" 100 - -cd ${MDA_DOCDIR} || die "Failed to 'cd ${MDA_DOCDIR}'. Run from the top level of the repository" - -git init -git config user.name "${GIT_CI_USER}" -git config user.email "${GIT_CI_EMAIL}" - -git remote add upstream "https://${GH_TOKEN}@${GH_REPOSITORY}" -git fetch --depth 50 upstream ${GH_DOC_BRANCH} gh-pages -git reset upstream/gh-pages - -touch . -touch .nojekyll - -git add -A . -# check for anything to commit -# https://stackoverflow.com/questions/3878624/how-do-i-programmatically-determine-if-there-are-uncommited-changes -git diff-index --quiet HEAD -- || git commit -m "rebuilt html docs from branch ${GH_DOC_BRANCH} with sphinx at ${rev}" -git push -q upstream HEAD:gh-pages - - diff --git a/setup.py b/setup.py index 0d465d87..b892d191 100644 --- a/setup.py +++ b/setup.py @@ -48,7 +48,7 @@ }, packages=find_packages(), install_requires=[ - 'MDAnalysis>=1.0.0', + 'MDAnalysis>=1.1.1,<2', 'dask>=0.18', 'distributed', 'six', @@ -58,5 +58,5 @@ ], tests_require=[ 'pytest', - 'MDAnalysisTests>=1.0.0', # keep + 'MDAnalysisTests>=1.0.0,<2', # keep ], ) From 1c911c11fe16e5c0ab4a5ad68de763344e018bab Mon Sep 17 00:00:00 2001 From: Oliver Beckstein Date: Thu, 28 Oct 2021 15:13:22 -0700 Subject: [PATCH 2/2] update Python tests - drop 2.7 (see #152) - add 3.6 - note: 3.9 not supported in MDAnalysis 1.1.1 - update CHANGELOG --- .github/workflows/gh-ci.yaml | 9 +++------ CHANGELOG | 9 +++++---- 2 files changed, 8 insertions(+), 10 deletions(-) diff --git a/.github/workflows/gh-ci.yaml b/.github/workflows/gh-ci.yaml index e4bbb7aa..0fcf9b58 100644 --- a/.github/workflows/gh-ci.yaml +++ b/.github/workflows/gh-ci.yaml @@ -27,12 +27,9 @@ jobs: strategy: fail-fast: false matrix: - os: [ubuntu-latest, ] - python-version: [2.7, 3.7, 3.8] + os: [ubuntu-latest,] + python-version: [3.6, 3.7, 3.8] include: - - name: macOS_bigsur_py39 - os: macOS-11 - python-version: 3.8 - name: macOS_catalina_py37 os: macOS-10.15 python-version: 3.7 @@ -140,7 +137,7 @@ jobs: run: | conda install setuptools twine - - name: install PMDA + - name: package PMDA run: | python setup.py sdist diff --git a/CHANGELOG b/CHANGELOG index 77937fca..019ad940 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -18,6 +18,11 @@ MM/DD/YYYY VOD555, lilyminium, orbeckst, yuxuanzhuang * 0.4.0 +Changes + * requires MDAnalysis >= 1.0.0 and <2.0.0 (#122) + * dropped official support for Python 2.7 and 3.5 (all versions + of Python >= 3.6 supported by MDAnalysis 1.x are supported) (#152) + Enhancements * Update doc theme to use sphinx-rtd-theme (Issue #124, PR #126) * add parallel hbond analysis class (Issue #95) @@ -32,10 +37,6 @@ Fixes * fixed Contact fails with uneven blocks. (#140) * raise ValueError when n_blocks > n_frames (Issue #137, PR #138) -Changes - * requires MDAnalysis >= 1.0.0 and <2.0.0 (#122) - * dropped official support for Python 3.5 (2.7 and >= 3.6 are supported) - 10/14/2019 VOD555, nawtrey