Skip to content

Commit

Permalink
Merge branch 'develop' into write_to_stream
Browse files Browse the repository at this point in the history
  • Loading branch information
MicahGale authored Aug 17, 2024
2 parents a56f294 + 26cfedc commit 1962c78
Show file tree
Hide file tree
Showing 3 changed files with 35 additions and 7 deletions.
31 changes: 31 additions & 0 deletions .github/scripts/check_sitemap.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
import xml.etree.ElementTree as ET
import urllib.request

NS = {"a": "http://www.sitemaps.org/schemas/sitemap/0.9"}
TOLERANCE = 0.8


def discover_urls():
tree = ET.parse("doc/build/html/sitemap.xml")
root = tree.getroot()
return [node.find("a:loc", NS).text for node in root.findall("a:url", NS)]


def test_urls(urls):
passed = 0
for url in urls:
code = 404
try:
code = urllib.request.urlopen(url).getcode()
except urllib.error.HTTPError as e:
print(url, e)
if code == 200:
passed += 1
else:
print(url, code)
if passed / len(urls) < TOLERANCE:
raise ValueError(f"Too many URLs failed")


if __name__ == "__main__":
test_urls(discover_urls())
10 changes: 3 additions & 7 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -101,13 +101,7 @@ jobs:
with:
python-version: 3.12
- run: pip install . montepy[doc,build]
- uses: mathieudutour/github-tag-action@v6.2
name: Get next version number
id: version_num
with:
dry_run: True
github_token: ${{ secrets.GITHUB_TOKEN }}
- run: sphinx-build doc/source/ doc/build/ -W --keep-going -E
- run: sphinx-build doc/source/ doc/build/html -W --keep-going -E
name: Build site strictly
- uses: actions/upload-artifact@v4
with:
Expand All @@ -121,6 +115,8 @@ jobs:
run: |
cd doc
make linkcheck
- name: test sitemap
run: python .github/scripts/check_sitemap.py

format-test:
runs-on: ubuntu-latest
Expand Down
1 change: 1 addition & 0 deletions doc/source/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@
html_logo = "monty.svg"

html_baseurl = "https://www.montepy.org/"
sitemap_url_scheme = "{link}"
html_extra_path = ["robots.txt"]
# List of patterns, relative to source directory, that match files and
# directories to ignore when looking for source files.
Expand Down

0 comments on commit 1962c78

Please sign in to comment.