-
Notifications
You must be signed in to change notification settings - Fork 75
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
Github action to check for docs generator build errors during PRs #317
Merged
Merged
Changes from 6 commits
Commits
Show all changes
8 commits
Select commit
Hold shift + click to select a range
d9dfc8d
add github action for PRs
0297d65
apt update
c5f3b7a
add apt update to main action too
c4f438a
catch pandoc errors
f49ce0b
added pandoc error for testing
eb453f0
remove test error
13ea90a
ran black
3420e68
ran isort
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
name: Build docs to check for errors | ||
|
||
on: | ||
pull_request: | ||
# only runs on PRs that target main | ||
branches: | ||
- main | ||
|
||
jobs: | ||
deploy: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v4 | ||
- name: Apt update | ||
run: sudo apt update | ||
- name: Install prereqs | ||
run: sudo apt install python3-pip inkscape texlive-latex-extra -y | ||
- name: Pip installs | ||
run: sudo pip install pylatex | ||
- name: Install a more recent version of Pandoc than available from apt or pip (to get svg support) | ||
run: | | ||
wget "https://github.com/jgm/pandoc/releases/download/3.2/pandoc-3.2-linux-amd64.tar.gz" | ||
tar -xvf pandoc-3.2-linux-amd64.tar.gz | ||
sudo cp pandoc-3.2/bin/pandoc /usr/local/bin | ||
- name: Build docs | ||
run: python3 docs-generator.py | ||
- name: Check if docs are generated | ||
run: ls -la | ||
- name: Check pandoc version | ||
run: pandoc -v |
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Run |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
from pylatex import Document, Section, Subsection, Subsubsection, Package, Tabular, Figure | ||
from pylatex import Document, Section, Subsection, Subsubsection, Package, Tabular, Figure, Command | ||
from pylatex.utils import bold, NoEscape | ||
import json | ||
import time | ||
|
@@ -58,6 +58,7 @@ def gen_fields(doc, d): | |
|
||
geometry_options = {"tmargin": "1in", "lmargin": "1in", "rmargin": "1in", "bmargin": "1in"} | ||
doc = Document(geometry_options=geometry_options) | ||
doc.preamble.append(Command('title', 'SigMF')) # doesn't actually show up anywhere, but was causing a warning when not included | ||
doc.packages.append(Package("underscore")) # makes it so _ never means math mode! | ||
doc.packages.append(Package("xcolor", options=["table"])) # allows for \rowcolors | ||
doc.packages.append(Package("listings")) | ||
|
@@ -213,6 +214,8 @@ def gen_fields(doc, d): | |
with open("main.css", "w") as f: | ||
f.write(css_string) | ||
|
||
# Generate HTML | ||
# Generate HTML from tex with Pandoc | ||
css_url = "https://cdn.jsdelivr.net/npm/[email protected]/dist/css/bootstrap.min.css" | ||
subprocess.run(f"pandoc sigmf-spec.tex -f latex -t html -s -o sigmf-spec.html --toc --toc-depth=3 -c {css_url} -c main.css".split()) | ||
pandoc_out = subprocess.run(f"pandoc sigmf-spec.tex -f latex -t html -s -o sigmf-spec.html --toc --toc-depth=3 -c {css_url} -c main.css".split(), capture_output = True, text = True) | ||
if len(pandoc_out.stderr): | ||
raise Exception("Pandoc error: " + pandoc_out.stderr) |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.