• Stars
    star
    193
  • Rank 201,081 (Top 4 %)
  • Language
    Python
  • License
    Apache License 2.0
  • Created about 5 years ago
  • Updated 5 months ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

Github action that builds docs using sphinx and places errors inline

Sphinx Build Action

Build Status Test Coverage

This is a Github action that looks for Sphinx documentation folders in your project. It builds the documentation using Sphinx and any errors in the build process are bubbled up as Github status checks.

The main purposes of this action are:

  • Run a CI test to ensure your documentation still builds.

  • Allow contributors to get build errors on simple doc changes inline on Github without having to install Sphinx and build locally.

Example Screenshot

How to use

Create a workflow for the action, for example:

name: "Pull Request Docs Check"
on: 
- pull_request

jobs:
  docs:
    runs-on: ubuntu-latest
    steps:
    - uses: actions/checkout@v1
    - uses: ammaraskar/sphinx-action@master
      with:
        docs-folder: "docs/"
  • If you have any Python dependencies that your project needs (themes, build tools, etc) then place them in a requirements.txt file inside your docs folder.

  • If you have multiple sphinx documentation folders, please use multiple uses blocks.

For a full example repo using this action including advanced usage, take a look at https://github.com/ammaraskar/sphinx-action-test

Great Actions to Pair With

Some really good actions that work well with this one are actions/upload-artifact and ad-m/github-push-action.

You can use these to make built HTML and PDFs available as artifacts:

    - uses: actions/upload-artifact@v1
      with:
        name: DocumentationHTML
        path: docs/_build/html/

Or to push docs changes automatically to a gh-pages branch:

Code for your workflow

    - name: Commit documentation changes
      run: |
        git clone https://github.com/your_git/repository.git --branch gh-pages --single-branch gh-pages
        cp -r docs/_build/html/* gh-pages/
        cd gh-pages
        git config --local user.email "[email protected]"
        git config --local user.name "GitHub Action"
        git add .
        git commit -m "Update documentation" -a || true
        # The above command will fail if no changes were present, so we ignore
        # the return code.
    - name: Push changes
      uses: ad-m/github-push-action@master
      with:
        branch: gh-pages
        directory: gh-pages
        github_token: ${{ secrets.GITHUB_TOKEN }}

For a full fledged example of this in action take a look at: https://github.com/ammaraskar/sphinx-action-test

Advanced Usage

If you wish to customize the command used to build the docs (defaults to make html), you can provide a build-command in the with block. For example, to invoke sphinx-build directly you can use:

    - uses: ammaraskar/sphinx-action@master
      with:
        docs-folder: "docs/"
        build-command: "sphinx-build -b html . _build"

If there's system level dependencies that need to be installed for your build, you can use the pre-build-command argument like so:

    - uses: ammaraskar/sphinx-action@master
      with:
        docs-folder: "docs2/"
        pre-build-command: "apt-get update -y && apt-get install -y latexmk texlive-latex-recommended texlive-latex-extra texlive-fonts-recommended"
        build-command: "make latexpdf"

Running the tests

python -m unittest

Formatting

Please use black for formatting:

black entrypoint.py sphinx_action tests

More Repositories

1

pyCraft

Minecraft-client networking library in Python
Python
815
star
2

GeoIP-Scraper

Scrapes specified files, generating a pretty google powered map with geoip results
HTML
43
star
3

gcc-problem-matcher

Github Action to problem match gcc output
JavaScript
24
star
4

sphinx-action-test

Testing repo for my sphinx github action
Python
16
star
5

MinecraftPacketNames

An automatically updating git repo scraping wiki.vg to generate json specification files of minecraft paket names per protocol version
Python
14
star
6

ghidra-fujitsu-risc

Ghidra processor for Fujitsu RISC (FR)
Python
9
star
7

iClicker-base-reversing

Notes and files from reverse engineering the iClicker base station
Assembly
8
star
8

BungeeCountSync

Synchronize player counts across multiple bungee instances
Java
5
star
9

SimsReiaParser

Libraries to parse and (maybe) encode .reia file for sims2
Python
5
star
10

black-holes-black-boxes

The supporting code behind "Finding Black Holes With Black Boxes"
Python
5
star
11

msvc-problem-matcher

Github Action to problem match MSVC output
JavaScript
5
star
12

nand-2-fpga-tetris

An attempt to follow nand2tetris in SystemVerilog and an FPGA
Python
4
star
13

faa-instrument-approach-db

Analyze and create friendly dumps of FAA instrument approaches
Python
3
star
14

synchronizo

CS307 Project - Group Music Listening WebApp
TeX
2
star
15

Purdue-Laundry-API

Scrapes purdue's wash alert/laundry page to provide a JSON API
Python
2
star
16

PyVerpisor

Python
2
star
17

sphinx-matcher-test

Python
1
star
18

rust-dwarf-x86

Rust crate that offers a higher level API for parsing dwarf files for x86 binaries
Rust
1
star
19

binutils-libfuzzer

libFuzzer harnesses for binutils binaries
Dockerfile
1
star
20

MilkshakeEventsBot

Syncs events from an events forum to a Google calendar and bumps them when the event is coming up.
Python
1
star