Skip to content

Commit

Permalink
Change gh-pages workflow
Browse files Browse the repository at this point in the history
  • Loading branch information
nyLiao committed Jun 13, 2024
1 parent 635227b commit 243f541
Show file tree
Hide file tree
Showing 4 changed files with 101 additions and 18 deletions.
46 changes: 46 additions & 0 deletions .github/actions/docs.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
#!/bin/bash

# set -x
set -e

echo ::group:: Initialize various paths

repo_dir=$GITHUB_WORKSPACE/$INPUT_REPOSITORY_PATH
doc_dir=$repo_dir/$INPUT_DOCUMENTATION_PATH
# https://stackoverflow.com/a/4774063/4799273
action_dir=$GITHUB_ACTION_PATH

echo Action: $action_dir
echo Workspace: $GITHUB_WORKSPACE
echo Repository: $repo_dir
echo Documentation: $doc_dir

echo Adding ~/.local/bin to system path
PATH=$HOME/.local/bin:$PATH
if ! command -v sphinx-build &>/dev/null; then
echo Sphinx is not successfully installed
exit 1
else
echo Everything goes well
fi

echo ::endgroup::

echo ::group:: Creating build directory
build_dir=/tmp/sphinxnotes-pages
mkdir -p $build_dir || true
echo Temp directory \"$build_dir\" is created

echo ::group:: Running Sphinx builder
if ! sphinx-build -b html $INPUT_SPHINX_BUILD_OPTIONS "$doc_dir" "$build_dir"; then
# See: https://github.com/sphinx-notes/pages/issues/28
# echo ::endgroup::
# echo ::group:: Dumping Sphinx error log
# for l in $(ls /tmp/sphinx-err*); do
# cat $l
# done
exit 1
fi
echo ::endgroup::

echo "artifact=$build_dir" >> $GITHUB_OUTPUT
8 changes: 3 additions & 5 deletions .github/actions/setup/action.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -22,13 +22,11 @@ runs:

steps:
- name: Set up Python ${{ inputs.python-version }}
uses: actions/setup-python@v4.3.0
uses: actions/setup-python@v5
with:
python-version: ${{ inputs.python-version }}
check-latest: true
cache: pip
cache-dependency-path: |
pyproject.toml
cache: 'pip'
cache-dependency-path: pyproject.toml

- name: Install PyTorch ${{ inputs.torch-version }}+${{ inputs.cuda-version }}
if: ${{ inputs.torch-version != 'nightly' }}
Expand Down
63 changes: 51 additions & 12 deletions .github/workflows/docs.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: Sphinx docs to gh-pages
name: Docs

on:
push:
Expand All @@ -10,11 +10,22 @@ on:
jobs:
sphinx_docs_to_gh-pages:
runs-on: ubuntu-22.04
name: Sphinx docs to gh-pages
name: Docs
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
permissions:
pages: write
id-token: write
concurrency:
group: ${{ github.ref }}
cancel-in-progress: true

steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
with:
fetch-depth: 0

# Skip workflow if only certain files have been changed.
- name: Get changed files
id: changed-files-specific
Expand All @@ -26,8 +37,6 @@ jobs:
README.md
CHANGELOG.md
requirements.txt
setup.py
pyproject.toml
- name: Setup packages
if: steps.changed-files-specific.outputs.only_changed != 'true'
Expand All @@ -40,12 +49,42 @@ jobs:
run: |
pip install -e .[docs]
- name: Running the Sphinx to gh-pages Action
- name: Enable github problem matcher
uses: sphinx-doc/github-problem-matcher@master

- id: build
name: Build documentation
if: steps.changed-files-specific.outputs.only_changed != 'true'
run: ./.github/actions/docs.sh
shell: bash
env:
# See https://github.com/actions/runner/issues/665
INPUT_DOCUMENTATION_PATH: './docs/source'
INPUT_SPHINX_BUILD_OPTIONS: ''

- name: Setup Pages
uses: actions/configure-pages@v4
if: steps.changed-files-specific.outputs.only_changed != 'true'

- name: Fix file permissions
shell: sh
if: runner.os == 'Linux'
# https://github.com/actions/deploy-pages/issues/188
run: |
chmod -c -R +rX "$INPUT_PATH" |
while read line; do
echo "::warning title=Invalid file permissions automatically fixed::$line"
done
env:
INPUT_PATH: ${{ steps.build.outputs.artifact }}

- name: Upload artifact
uses: actions/upload-pages-artifact@v3
if: steps.changed-files-specific.outputs.only_changed != 'true'
uses: uibcdf/[email protected]
with:
branch: main
dir_docs: docs
sphinx-apidoc-opts: '--separate -o ./source/_include ../pyg_spectral'
sphinx-apidoc-exclude: '../*setup* ../*.ipynb'
sphinx-opts: ''
path: ${{ steps.build.outputs.artifact }}

- id: deployment
name: Deploy to GitHub Pages
uses: actions/deploy-pages@v4
if: steps.changed-files-specific.outputs.only_changed != 'true'
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Benchmarking Spectral Graph Neural Networks

[![Docs](https://github.com/gdmnl/Spectral-GNN-Benchmark/actions/workflows/docs.yml/badge.svg?event=push)](https://pages.github.com/gdmnl/Spectral-GNN-Benchmark/)
[![Docs](https://github.com/gdmnl/Spectral-GNN-Benchmark/workflows/Docs/badge.svg)](https://pages.github.com/gdmnl/Spectral-GNN-Benchmark/)

`pyg_spectral` is a [PyTorch Geometric](https://pyg.org)-based framework for analyzing, implementing, and benchmarking spectral GNNs with effectiveness and efficiency evaluations.

Expand Down

0 comments on commit 243f541

Please sign in to comment.