Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Github action to publish documentation #275

Merged
merged 2 commits into from
Dec 13, 2021
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
76 changes: 40 additions & 36 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,25 +4,29 @@ on:
push:
branches:
- master
pull_request: {}
paths:
- "**.py"
pull_request:
paths:
- "**.py"

jobs:
check:
name: Run pre-commit checks
runs-on: ubuntu-latest
steps:
- uses: actions/cache@v2
with:
path: ~/.cache/pip
key: pip
- uses: actions/checkout@v2
- uses: actions/setup-python@v2
- name: install pre-commit
run: |
python -m pip install --upgrade pip
pip install pre-commit
- name: Run pre-commit
run: pre-commit run --all-files
- uses: actions/cache@v2
with:
path: ~/.cache/pip
key: pip
- uses: actions/checkout@v2
- uses: actions/setup-python@v2
- name: Install pre-commit
run: |
python -m pip install --upgrade pip
pip install pre-commit
- name: Run pre-commit
run: pre-commit run --all-files
test:
name: Test ${{ matrix.python-version }}${{ matrix.compile && ' compiled' || '' }}
runs-on: ubuntu-latest
Expand All @@ -33,28 +37,28 @@ jobs:
python-version: ['3.6', '3.7', '3.8', '3.9', '3.10', 'pypy3']
compile: [true, false]
exclude:
- python-version: pypy3
compile: true
- python-version: pypy3
compile: true
steps:
- uses: actions/cache@v2
with:
path: ~/.cache/pip
key: pip
- uses: actions/checkout@v2
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v2
with:
python-version: ${{ matrix.python-version }}
- name: cythonize
if: matrix.compile
run: |
python -m pip install cython ${{ (matrix.python-version == '3.6' || matrix.python-version == 'pypy3') && 'dataclasses' || '' }}
python scripts/cythonize.py
python setup.py build_ext --inplace
- name: Install tox
run: |
python -m pip install --upgrade pip
pip install tox tox-gh-actions
- name: Run tox
run: tox
- uses: actions/cache@v2
with:
path: ~/.cache/pip
key: pip
- uses: actions/checkout@v2
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v2
with:
python-version: ${{ matrix.python-version }}
- name: cythonize
if: matrix.compile
run: |
python -m pip install cython ${{ (matrix.python-version == '3.6' || matrix.python-version == 'pypy3') && 'dataclasses' || '' }}
python scripts/cythonize.py
python setup.py build_ext --inplace
- name: Install tox
run: |
python -m pip install --upgrade pip
pip install tox tox-gh-actions
- name: Run tox
run: tox

46 changes: 46 additions & 0 deletions .github/workflows/doc.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
name: Documentation

on:
push:
branches:
- master
tags:
- v[0-9]*.*.*
paths:
- examples/**
- docs/**

jobs:
publish_doc:
name: Publish documentation
runs-on: ubuntu-latest
steps:
- uses: actions/cache@v2
with:
path: ~/.cache/pip
key: pip
- uses: actions/checkout@v2
with:
fetch-depth: 0
- uses: actions/setup-python@v2
- name: Install requirements
run: |
python -m pip install --upgrade pip
pip install -r docs/requirements.txt
- name: Setup git
run: |
git config user.name github-actions
git config user.email github-actions@github.com
git fetch origin gh-pages --depth=1
- name: Publish documentation
run: |
export version=$(python setup.py --version | cut -d. -f-2)
export revision=$(python setup.py --version | cut -d. -f3)
if [[ $GITHUB_REF != refs/tags/* ]]; then
mike deploy $version dev -t "$version (dev)" -u
elif [[ $revision == 0 ]]; then
mike retitle latest "$(mike list latest -j | jq .version -r)"
mike deploy $version latest -t "$version (latest)" -u
else
mike deploy $version
fi