Skip to content

Improved attraction strength construction (#99) #255

Improved attraction strength construction (#99)

Improved attraction strength construction (#99) #255

Workflow file for this run

name: Docs
on:
push:
branches:
- "main"
tags:
- v*
pull_request:
branches:
- "main"
jobs:
build_and_deploy_docs:
name: Documentation Building and Deployment
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
token: ${{ secrets.GITHUB_TOKEN }}
- name: Additional info about the build
shell: bash
run: |
uname -a
df -h
ulimit -a
- uses: mamba-org/setup-micromamba@v1
with:
environment-file: devtools/conda-envs/docs_env.yaml
environment-name: docs
create-args: >-
python=3.11
openmm>=8.1
- name: Install package
shell: bash -l {0}
run: |
micromamba install -y -c mdtools openmm-cpp-forces
python -m pip install . --no-deps
micromamba list
- name: Build Documentation
shell: bash -l {0}
run: |
if [ "$GITHUB_EVENT_NAME" == "push" ] && [ "$GITHUB_REF_TYPE" == "tag" ]; then
export CVPACK_VERSION=${{ github.ref_name }}
else
export CVPACK_VERSION=dev
fi
sphinx-build ./docs ./html
- name: Run tests
shell: bash -l {0}
run: |
pytest
- name: Get coverage report
id: coverage
shell: bash -l {0}
run: |
COVERAGE=$(coverage report | tail -1 | awk '{print $4}')
OFFSET=$(((${COVERAGE::-1}-35)/6-1))
[[ $OFFSET < 0 ]] && OFFSET=0
PALETTE="000111222333"
CODE=${PALETTE:$OFFSET:3}
COLOR=$(echo $CODE | sed -e "s/0/red,/g; s/1/orange,/g; s/2/yellow,/g; s/3/green,/g; s/,$//")
echo "coverage=${COVERAGE}" | tee -a "${GITHUB_OUTPUT}"
echo "color=${COLOR}" | tee -a "${GITHUB_OUTPUT}"
- name: Generate coverage badge
uses: emibcn/badge-action@v2.0.2
with:
label: 'Coverage'
label-color: 'black'
status: ${{ steps.coverage.outputs.coverage }}
color: ${{ steps.coverage.outputs.color }}
path: 'htmlcov/coverage.svg'
- name: Deploy documentation
shell: bash -l {0}
run: |
if [ "$GITHUB_EVENT_NAME" == "pull_request" ]; then
echo "Deployment is deactivated on pull requests"
exit 0
elif [ "$GITHUB_REF_TYPE" == "tag" ]; then
subdirs=(${{ github.ref_name }} latest)
else
subdirs=(development)
fi
git reset --hard HEAD
set -x
echo "::group::Push page to gh-pages branch"
git config user.name "$(git show --format=%an -s)"
git config user.email "$(git show --format=%ae -s)"
git fetch origin
git switch gh-pages
for subdir in ${subdirs[@]}; do
dir=docs/$subdir
rsync -va --delete-excluded html/ $dir/
rsync -va --delete-excluded htmlcov/ $dir/coverage/
git add -f $dir/*
done
touch docs/.nojekyll
git commit -m "Docs from $GITHUB_REF $GITHUB_SHA" || echo "Branch is up to date"
git push -f origin gh-pages
echo "::endgroup::"