Skip to content

Commit

Permalink
Rename project to docs-versions-menu
Browse files Browse the repository at this point in the history
Closes #13
Closes #9
  • Loading branch information
goerz committed Mar 25, 2021
1 parent ba3ff1e commit f6e97d9
Show file tree
Hide file tree
Showing 63 changed files with 1,013 additions and 1,628 deletions.
2 changes: 1 addition & 1 deletion .github/ISSUE_TEMPLATE.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
* doctr_versions_menu version:
* docs_versions_menu version:
* Python version:
* Operating System:

Expand Down
24 changes: 0 additions & 24 deletions .github/workflows/codestyle.yml

This file was deleted.

142 changes: 142 additions & 0 deletions .github/workflows/docs.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,142 @@
name: Docs

on: [push, ]

jobs:

build_docs:
name: Build Sphinx docs
runs-on: ubuntu-18.04
steps:

- uses: actions/checkout@v2

- uses: actions/setup-python@v2
name: Install Python 3.8
with:
python-version: 3.8

- name: Install apt packages
run: sudo apt-get install graphviz imagemagick pandoc pandoc-citeproc

- name: Install Tox and other Python package requirements
run: pip install tox zip-files

- name: Generate HTML Documentation
run: tox -e docs

- name: Get the version
id: get_version
run: echo ::set-output name=VERSION::$(python -c 'print([line.split("=")[-1].strip()[1:-1] for line in open("./src/docs_versions_menu/__init__.py", encoding="utf8").readlines() if line.startswith("__version__")][0], end="")')

- name: Zip the HTML documentation
run: zip-folder --debug --auto-root --outfile "docs-versions-menu-${{ steps.get_version.outputs.VERSION }}.zip" docs/_build/html

- uses: actions/upload-artifact@v2
name: Upload documentation artifacts
with:
name: docs
# We need at least two files in the artifact to avoid a weird
# double-zip file. Hence README.rst
path: |
README.rst
./docs-versions-menu-${{ steps.get_version.outputs.VERSION }}.*
deploy_gh_pages:
name: Deploy documentation to gh-pages
if: always() && needs.build_docs.result == 'success' && (github.ref == 'refs/heads/master' || startsWith(github.ref, 'refs/tags/'))
runs-on: ubuntu-18.04
needs: [build_docs]
steps:

- uses: actions/setup-python@v2
name: Install Python 3.8
with:
python-version: 3.8

- name: Install deploy requirements
run: pip install git+https://github.com/goerz/docs_versions_menu.git@master#egg=docs_versions_menu

- name: Get branch name
shell: bash
run: |
echo ${{ github.ref }}
echo "BRANCH_NAME=$(echo ${GITHUB_REF##*/} | tr / -)" >> $GITHUB_ENV
cat $GITHUB_ENV
- uses: actions/checkout@v2
name: Check out gh-pages branch (full history)
with:
ref: gh-pages
fetch-depth: 0

- uses: actions/download-artifact@v2
name: Download documentation artifact
with:
name: docs
path: _docs

- name: Unzip html documentation
working-directory: _docs
shell: bash
run: |
unzip *.zip -d _unzip
mv _unzip/* _unzip/${{ env.BRANCH_NAME }}
- name: Rsync html documentation into place
run: rsync -av --delete _docs/_unzip/${{ env.BRANCH_NAME }}/ ./${{ env.BRANCH_NAME }}/

- name: Set download links
if: startsWith(github.ref, 'refs/tags/v')
run: |
echo "[html]: https://github.com/goerz/docs-versions-menu/releases/download/${{ env.BRANCH_NAME }}/docs-versions-menu-${{ env.BRANCH_NAME }}.zip" >> ./${{ env.BRANCH_NAME }}/_downloads
- name: Remove artifact files
shell: bash
run: rm -rf _docs

- name: Run docs-versions-menu
run: docs-versions-menu
env:
DOCS_VERSIONS_MENU_DEBUG: 'true'
DOCS_VERSIONS_MENU_VERSIONS: '(<branches> != (master, rtd-theme)), (<releases>)[:-1], rtd-theme, (<releases>)[-1], master'
DOCS_VERSIONS_MENU_LABEL: 'rtd-theme: v0.4.1 (rtd-theme)'
DOCS_VERSIONS_MENU_WARNING: 'unreleased: (<branches> != rtd-theme), <local-releases>'

- name: Get the previous commit message
id: get_previous_commit
run: |
git log --format=%B -n 1 | tee .git/_github_actions_commit_msg
echo ::set-output name=log::$(cat .git/_github_actions_commit_msg)
echo ::set-output name=lastline::$(cat .git/_github_actions_commit_msg | grep -v '^$' | tail -n1)
echo ::set-output name=author::$(git log --format=%an -n 1)
- name: Set git configuration
shell: bash
run: |
git config user.name github-actions
git config user.email [email protected]
- name: Commit changes
shell: bash
run: |
echo "Committing to gh-pages"
echo "# GIT ADD"
git add -A --verbose
echo "# GIT STATUS"
git status
echo "# GIT COMMIT"
if [[ "${{ steps.get_previous_commit.outputs.author }}" == "github-actions"* && "${{ steps.get_previous_commit.outputs.lastline }}" == *"${{ github.ref }}"* ]];
then
# we ammend if the previous commit was down by Github Actions and was based on the same branch/tag name
echo "Amending previous commit"
echo "Deployed from commit ${GITHUB_SHA} (${GITHUB_REF})" >> .git/_github_actions_commit_msg
git commit --verbose --amend -F .git/_github_actions_commit_msg
else
echo "Making new commit"
git commit --verbose -m "Auto-update from Github Actions Workflow" -m "Deployed from commit ${GITHUB_SHA} (${GITHUB_REF})"
fi
git log -n 1
- name: Push changes
run: git push --verbose --force
75 changes: 48 additions & 27 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,49 +5,70 @@ on: [push, pull_request]
jobs:

run_tests:
name: Run tests on ${{ matrix.os }} for ${{ matrix.python }}
name: ${{ matrix.title }} (Python ${{ matrix.python }} on ${{ matrix.os }})
runs-on: ${{ matrix.os }}
env:
tox: tox
strategy:
fail-fast: false
matrix:
include:
- os: ubuntu-18.04
python: 3.6
tox_env: py36-test
- os: ubuntu-18.04
python: 3.9
tox_env: py39-test
- os: windows-latest
- title: Codestyle and Main Tests
os: ubuntu-18.04
python: 3.8
tox_env: py38-test
- os: macos-latest
commands: |
$tox -e run-blackcheck,run-isortcheck
$tox -e py38-test
coverage: true
- title: Oldest supported Python
os: ubuntu-18.04
python: 3.6
commands: $tox -e py36-test
coverage: true
- title: Windows
os: windows-latest
python: 3.8
tox_env: py38-test
commands: tox -e py38-test
coverage: false
- title: MacOS
os: macos-latest
python: 3.9
commands: $tox -e py39-test
coverage: true
steps:

- uses: actions/checkout@v2

- uses: actions/setup-python@v2
name: Install Python ${{ matrix.python }}
with:
python-version: ${{ matrix.python }}

- name: Install required apt packages
if: runner.os == 'Linux'
run: sudo apt-get install pandoc

- name: Install miniconda
if: runner.os == 'Windows'
uses: conda-incubator/setup-miniconda@v2
with:
auto-update-conda: true
python-version: ${{ matrix.python }}

- name: Install Tox
run: pip install tox

- name: Run Tox
run: tox -e ${{ matrix.tox_env }}
- name: Run Commands
run: ${{ matrix.commands }}

- name: Submit to coveralls
if: runner.os == 'Linux'
uses: AndreMiras/coveralls-python-action@develop
with:
parallel: true
flag-name: pytest
- name: Convert coverage data to xml
if: matrix.coverage == true
shell: bash
run: |
runenv=$(echo "${{ matrix.python }}" | sed 's/\([2-3]\)\.\([0-9]\)/py\1\2-runcmd/')
$tox -e $runenv -- python -m coverage xml
complete_coveralls:
needs: run_tests
runs-on: ubuntu-18.04
steps:
- name: Coveralls Finished
uses: AndreMiras/coveralls-python-action@develop
with:
parallel-finished: true
- uses: codecov/codecov-action@v1
if: matrix.coverage == true
with:
verbose: false
45 changes: 0 additions & 45 deletions .travis.yml

This file was deleted.

Loading

0 comments on commit f6e97d9

Please sign in to comment.