update the publish step in docs-publish action and remove test-docs a… #13
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
# This workflow will build the docs and publish them to GitHub Pages/Read the Docs. | |
name: Build Docs with Sphinx and Publish | |
on: | |
push: | |
branches: [ doc, dev, master ] | |
pull_request: | |
branches: [ master ] | |
# Allows you to run this workflow manually from the Actions tab | |
workflow_dispatch: | |
env: | |
# Enable bib-lookup | |
DB_BIB_LOOKUP: true | |
PANDOC_RELEASE: 3.1.7 | |
# Sets permissions of the GITHUB_TOKEN to allow deployment to GitHub Pages | |
permissions: | |
contents: write | |
pages: write | |
id-token: write | |
# Allow one concurrent deployment | |
concurrency: | |
group: "pages" | |
cancel-in-progress: true | |
jobs: | |
build: | |
# Don't run on forked repos. | |
if: github.repository_owner == 'DeepPSP' | |
runs-on: ubuntu-20.04 | |
strategy: | |
matrix: | |
python-version: ["3.9"] | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Clear unnecessary system components | |
run: | | |
echo "Free space:" | |
df -h | |
sudo rm -rf /usr/local/lib/android # will release about 10 GB if you don't need Android | |
sudo rm -rf /usr/share/dotnet # will release about 20GB if you don't need .NET | |
sudo rm -rf /opt/ghc | |
sudo rm -rf /usr/local/share/boost | |
sudo rm -rf "$AGENT_TOOLSDIRECTORY" | |
- name: Install system libraries | |
run: | | |
sudo apt update | |
sudo apt install build-essential ffmpeg libsm6 libxext6 libsndfile1 wget -y | |
- name: Set up Python ${{ matrix.python-version }} | |
uses: actions/setup-python@v4 | |
with: | |
python-version: ${{ matrix.python-version }} | |
cache: 'pip' # caching pip dependencies | |
- name: List existing Python packages | |
run: | | |
python -m pip list | |
- name: Install dependencies | |
run: | | |
python -m pip install --upgrade pip setuptools wheel ipython | |
python -m pip install -r requirements.txt | |
python -m pip install -r docs/requirements.txt | |
python -m pip uninstall torch-ecg --yes # Remove if already installed | |
python setup.py install_egg_info | |
pip install -e .[dev] | |
pip install jupyter 'ipykernel<5.0.0' 'ipython<7.0.0' | |
- name: List installed Python packages | |
run: | | |
python -m pip list | |
- name: Setup TeX Live | |
# This is used to render the tikz plots in the docs. | |
uses: teatimeguest/setup-texlive-action@v2 | |
with: | |
packages: >- | |
scheme-basic | |
algorithm2e | |
biber | |
biblatex | |
pgf | |
pgfplots | |
relsize | |
standalone | |
xetex | |
xecjk | |
- name: Install latexmk and pandoc and extra software | |
run: | | |
sudo apt install latexmk -y | |
wget https://github.com/jgm/pandoc/releases/download/$PANDOC_RELEASE/pandoc-$PANDOC_RELEASE-1-amd64.deb | |
sudo dpkg -i pandoc-$PANDOC_RELEASE-1-amd64.deb | |
sudo rm pandoc-$PANDOC_RELEASE-1-amd64.deb | |
sudo apt install texlive-pictures texlive-latex-extra pdf2svg -y | |
- name: Build docs with Sphinx and check for errors | |
run: | | |
cd docs | |
make html | |
make linkcheck | |
# Publish to GitHub Pages | |
- name: Publish to GitHub Pages | |
# publish only when pushed to 'doc' and 'master' branches or manually triggered | |
if: (github.event_name == 'push' && (contains(fromJson('["refs/heads/doc", "refs/heads/master"]'), github.ref))) || (github.event_name == 'workflow_dispatch') | |
uses: peaceiris/actions-gh-pages@v3 | |
with: | |
github_token: ${{ secrets.GITHUB_TOKEN }} | |
publish_dir: ./docs/build/html | |
publish_branch: gh-pages | |
user_name: 'WEN Hao' | |
user_email: '[email protected]' |