Pathlib object handling for Universe, SingleFrameReaderBase and Toplogy parsers (Issue #3937) #5925
Workflow file for this run
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: | |
- develop | |
pull_request: | |
branches: | |
- develop | |
workflow_dispatch: | |
concurrency: | |
# Probably overly cautious group naming. | |
# Commits to develop will cancel each other, but PRs will only cancel | |
# commits within the same PR | |
group: "${{ github.ref }}-${{ github.head_ref }}-${{ github.workflow }}" | |
cancel-in-progress: true | |
defaults: | |
run: | |
shell: bash -l {0} | |
jobs: | |
main_tests: | |
if: "github.repository == 'MDAnalysis/mdanalysis'" | |
runs-on: ${{ matrix.os }} | |
timeout-minutes: 60 | |
strategy: | |
fail-fast: false | |
matrix: | |
os: [ubuntu-latest, ] | |
python-version: ["3.10", "3.11", "3.12"] | |
full-deps: [true, ] | |
codecov: [true, ] | |
include: | |
- name: macOS_monterey_py311 | |
os: macOS-12 | |
python-version: "3.12" | |
full-deps: true | |
codecov: true | |
- name: macOS_14_arm64_py312 | |
os: macOS-14 | |
python-version: "3.12" | |
full-deps: false | |
codecov: true | |
- name: numpy_min | |
os: ubuntu-latest | |
python-version: "3.10" | |
full-deps: false | |
codecov: true | |
numpy: numpy=1.23.2 | |
- name: asv_check | |
os: ubuntu-latest | |
python-version: "3.10" | |
full-deps: true | |
codecov: false | |
extra-pip-deps: asv | |
env: | |
CYTHON_TRACE_NOGIL: 1 | |
MPLBACKEND: agg | |
steps: | |
- uses: actions/checkout@v4 | |
- name: setup_os | |
uses: ./.github/actions/setup-os | |
with: | |
os-type: ${{ matrix.os }} | |
- name: setup_micromamba | |
uses: mamba-org/setup-micromamba@v1 | |
with: | |
environment-name: mda | |
create-args: >- | |
python=${{ matrix.python-version }} | |
pip | |
# using jaime's shim to avoid pulling down the cudatoolkit | |
condarc: | | |
channels: | |
- jaimergp/label/unsupported-cudatoolkit-shim | |
- conda-forge | |
- bioconda | |
- name: install_deps | |
uses: ./.github/actions/setup-deps | |
with: | |
micromamba: true | |
full-deps: ${{ matrix.full-deps }} | |
# in most cases will just default to empty, i.e. pick up max version from other deps | |
numpy: ${{ matrix.numpy }} | |
extra-pip-deps: ${{ matrix.extra-pip-deps }} | |
- name: build_srcs | |
uses: ./.github/actions/build-src | |
with: | |
build-tests: true | |
build-docs: false | |
# The standard mdanalysis deployment is to build with the | |
# oldest supported numpy version and then use whatever new | |
# numpy version we want at runtime. To do this we ensure | |
# that we use build isolation | |
isolation: true | |
- name: check_deps | |
run: | | |
micromamba list | |
pip list | |
- name: run_tests | |
if: contains(matrix.name, 'asv_check') != true | |
run: | | |
PYTEST_FLAGS="--disable-pytest-warnings --durations=50" | |
if [ ${{ matrix.codecov }} = "true" ]; then | |
PYTEST_FLAGS="${PYTEST_FLAGS} --cov-config=.coveragerc --cov=MDAnalysis --cov-report=xml" | |
fi | |
echo $PYTEST_FLAGS | |
pytest -n auto --timeout=200 testsuite/MDAnalysisTests $PYTEST_FLAGS | |
- name: run_asv | |
if: contains(matrix.name, 'asv_check') | |
run: | | |
cd benchmarks | |
time python -m asv check -E existing | |
- name: codecov | |
if: matrix.codecov | |
uses: codecov/codecov-action@v4 | |
with: | |
token: ${{ secrets.CODECOV_TOKEN }} | |
file: coverage.xml | |
fail_ci_if_error: False | |
verbose: True | |
build_docs: | |
if: "github.repository == 'MDAnalysis/mdanalysis'" | |
runs-on: ubuntu-latest | |
timeout-minutes: 15 | |
env: | |
CYTHON_TRACE_NOGIL: 1 | |
MPLBACKEND: agg | |
steps: | |
- uses: actions/checkout@v4 | |
- name: setup_micromamba | |
uses: mamba-org/setup-micromamba@v1 | |
with: | |
environment-name: mda | |
create-args: >- | |
python=3.10 | |
pip | |
# using jaime's shim to avoid pulling down the cudatoolkit | |
condarc: | | |
channels: | |
- jaimergp/label/unsupported-cudatoolkit-shim | |
- conda-forge | |
- bioconda | |
- name: install_deps | |
uses: ./.github/actions/setup-deps | |
with: | |
micromamba: true | |
full-deps: true | |
extra-pip-deps: "docutils sphinx-sitemap sphinxcontrib-bibtex pybtex pybtex-docutils" | |
extra-conda-deps: "mdanalysis-sphinx-theme>=1.3.0" | |
- name: build_srcs | |
uses: ./.github/actions/build-src | |
with: | |
build-tests: true | |
build-docs: true | |
isolation: true | |
- name: doctests | |
if: github.event_name == 'pull_request' | |
continue-on-error: true | |
run: | | |
cd package && sphinx-build -b doctest --keep-going ./doc/sphinx/source ./doc/html | |
- name: deploy_docs | |
if: github.event_name != 'pull_request' | |
env: | |
GH_USER: github-actions | |
GH_EMAIL: "[email protected]" | |
GH_REPOSITORY: "github.com/${{ github.repository }}.git" | |
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
URL: https://docs.mdanalysis.org | |
run: | | |
# set up environment variables | |
# cannot execute bash to make variables in env section | |
# export URL for the Python script $UPDATE_JSON | |
export URL | |
export VERSION=$(cd package/MDAnalysis; python -c 'import version; print(version.__version__)') | |
UPDATE_JSON=$(pwd)/maintainer/update_json_stubs_sitemap.py | |
BRANCH="${GITHUB_REF#refs/heads/}" | |
# the below turns off non-blocking as it causes large writes to stdout to fail | |
# (see https://github.com/travis-ci/travis-ci/issues/4704) | |
# commented out as this is not a problem with gh-actions | |
# python -c 'import os,sys,fcntl; flags = fcntl.fcntl(sys.stdout, fcntl.F_GETFL); fcntl.fcntl(sys.stdout, fcntl.F_SETFL, flags&~os.O_NONBLOCK);' | |
cd package/doc/html/ | |
# move docs into version subfolder | |
mkdir ../${VERSION} && mv * ../${VERSION} && mv ../${VERSION} $VERSION | |
# set up git | |
REV=$(git rev-parse --short HEAD) | |
git init | |
git config user.name $GH_USER | |
git config user.email $GH_EMAIL | |
git remote add upstream "https://${GH_USER}:${GH_TOKEN}@${GH_REPOSITORY}" | |
git fetch --depth 50 upstream $BRANCH gh-pages | |
git reset upstream/gh-pages | |
# redirects and copies | |
mkdir latest | |
python $UPDATE_JSON | |
touch . | |
touch .nojekyll | |
git add -A ${VERSION}/ | |
git add .nojekyll versions.json *.xml *.html index.html latest | |
for dirname in dev stable documentation_pages ; do | |
if [ -d $dirname ]; then git add $dirname; fi | |
done | |
# 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 for version ${VERSION} from branch ${BRANCH} with sphinx at ${REV}" | |
git push -q upstream HEAD:gh-pages | |
sdist_check_and_build: | |
if: "github.repository == 'MDAnalysis/mdanalysis'" | |
runs-on: ubuntu-latest | |
timeout-minutes: 30 | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: actions/setup-python@v5 | |
with: | |
python-version: 3.11 | |
- name: install_deps | |
run: | | |
python -m pip install -U pip pipx wheel build | |
python -m pip install twine "readme-renderer>=34.0" pytest-xdist pytest-timeout | |
- name: build_package_sdist | |
run: | | |
pipx run build --sdist --outdir dist package | |
- name: build_testsuite_sdist | |
run: | | |
pipx run build --sdist --outdir dist testsuite | |
- name: check_package_build | |
run: | | |
DISTRIBUTION=$(ls -t1 dist/mdanalysis-*.tar.gz | head -n1) | |
test -n "${DISTRIBUTION}" || { echo "no distribution dist/MDAnalysis-*.tar.gz found"; exit 1; } | |
twine check $DISTRIBUTION | |
- name: check_testsuite_build | |
run: | | |
DISTRIBUTION=$(ls -t1 dist/mdanalysistests-*.tar.gz | head -n1) | |
test -n "${DISTRIBUTION}" || { echo "no distribution dist/MDAnalysisTests-*.tar.gz found"; exit 1; } | |
twine check $DISTRIBUTION | |
- name: install sdist | |
working-directory: ./dist | |
run: | | |
ls -a . | |
python -m pip install mdanalysis-*.tar.gz | |
python -m pip install mdanalysistests-*.tar.gz | |
- name: run tests | |
working-directory: ./dist | |
run: python -m pytest --timeout=200 -n auto --pyargs MDAnalysisTests |