Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
53 changes: 51 additions & 2 deletions .github/workflows/gh-ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ env:
MDA_PIP_MIN_DEPS: 'coveralls coverage<5 pytest-cov pytest-xdist'
MDA_PIP_EXTRA_DEPS: 'duecredit parmed'


jobs:
main_tests:
if: "github.repository == 'MDAnalysis/mdanalysis'"
Expand Down Expand Up @@ -211,9 +212,57 @@ jobs:

- name: deploy_docs
if: github.event_name != 'pull_request'
env:
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Moved deployment to within this file because it saved a lot of variable checking and possibly insecure token passing

GH_USER: github-actions
GH_EMAIL: "github-action@users.noreply.github.com"
GH_REPOSITORY: "github.com/${{ github.repository }}.git"
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
URL: https://docs.mdanalysis.org

run: |
# place the deploy call here
echo "Oh, maple syrup roast parsnips [Richard Gowers]"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Almost a shame to loose this citation ;-)

# 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)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the comment. Btw, I think what we're doing here we enabled blocking mode again, in case it was switched to non-blocking, at least that's how I read travis-ci/travis-ci#4704 (comment) and flags&~os.O_NONBLOCK.

Was this someone we only needed for Travis or is this a general problem, i.e., does gh-actions also have something weird running that switches to non-blocking mode?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P.S.: Even if we don't strictly need it here anymore, I would only ever comment the line and not delete it, just in case we need it ever again.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for pointing that out @orbeckst; you're right, gh-actions did not have this problem the 2 times I ran the deployment (where Travis was previously failing every time). I've commented it out and left a note.

# 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/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


pylint_check:
Expand Down
82 changes: 0 additions & 82 deletions maintainer/deploy_docs_via_travis.sh

This file was deleted.