Skip to content

Commit dfacc6e

Browse files
committed
Update documentation and testing logic
- Update documentation release scripts to use sphinx-cmake instead of embedded the sphinx CMake module; - Use custom logic instead of 'lowdown' to handle changelog, as it doesn't seem to be maintained; - Update README to indicate support of CMake 3.30; - Use requirements.txt file to track Python dependencies used for testing; - Update documentation.
1 parent a0f8342 commit dfacc6e

File tree

15 files changed

+262
-160
lines changed

15 files changed

+262
-160
lines changed

.github/workflows/docs-deploy.yml

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -19,9 +19,9 @@ jobs:
1919
runs-on: ubuntu-latest
2020

2121
steps:
22-
- uses: actions/checkout@v3
22+
- uses: actions/checkout@v4
2323

24-
- uses: actions/setup-python@v4
24+
- uses: actions/setup-python@v5
2525
with:
2626
python-version: 3.9
2727

@@ -30,21 +30,21 @@ jobs:
3030
sudo apt update
3131
sudo apt install -y doxygen
3232
python -m pip install --upgrade pip
33-
python -m pip install -r ${GITHUB_WORKSPACE}/doc/requirements.txt
34-
mkdir -p ${{runner.workspace}}/build
33+
python -m pip install -r ${{github.workspace}}/doc/requirements.txt
34+
mkdir -p ${{github.workspace}}/build
3535
3636
- name: Build documentation
3737
run: |
3838
export BUILD_DOCS_WITHOUT_CMAKE=1
39-
export PYTHONPATH="${GITHUB_WORKSPACE}/doc/sphinx"
39+
export PYTHONPATH="${{github.workspace}}/doc/sphinx"
4040
sphinx-build -T -E -b html \
41-
"${GITHUB_WORKSPACE}/doc/sphinx" \
42-
"${{runner.workspace}}/build"
41+
"${{github.workspace}}/doc/sphinx" \
42+
"${{github.workspace}}/build"
4343
4444
- name: Upload artifact
4545
uses: actions/upload-pages-artifact@v1
4646
with:
47-
path: ${{runner.workspace}}/build
47+
path: ${{github.workspace}}/build
4848

4949
deploy:
5050
environment:

.github/workflows/test-linux.yml

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -30,18 +30,18 @@ jobs:
3030
name: "USD-${{ matrix.usd }}-py${{ matrix.python }}"
3131

3232
steps:
33-
- uses: actions/checkout@v3
33+
- uses: actions/checkout@v4
3434

3535
- name: Set up Python ${{ matrix.python }}
36-
uses: actions/setup-python@v4
36+
uses: actions/setup-python@v5
3737
with:
3838
python-version: ${{ matrix.python }}
3939

4040
- name: Create Build Environment
4141
run: |
4242
sudo apt update
4343
sudo apt install -y libgtest-dev ninja-build
44-
pip install pytest pytest-cmake
44+
python -m pip install -r ${{github.workspace}}/test/requirements.txt
4545
mkdir -p ${{github.workspace}}/build
4646
mkdir -p ${{runner.temp}}/USD
4747
@@ -68,17 +68,17 @@ jobs:
6868
-D "BUILD_DOCS=OFF" \
6969
-D "CMAKE_INCLUDE_PATH=${{runner.temp}}/USD/include" \
7070
-D "CMAKE_LIBRARY_PATH=${{runner.temp}}/USD/lib" \
71-
${GITHUB_WORKSPACE}
71+
..
7272
cmake --build . --config Release
7373
7474
- name: Check for formatting errors
7575
working-directory: ${{github.workspace}}/build
7676
run: |
7777
cmake --build . --target format
78-
STATUS_OUTPUT=$(git -C ${GITHUB_WORKSPACE} status --porcelain)
78+
STATUS_OUTPUT=$(git -C .. status --porcelain)
7979
if [ -n "$STATUS_OUTPUT" ]; then
8080
echo "Code formatting errors found:"
81-
git -C ${GITHUB_WORKSPACE} diff
81+
git -C .. diff
8282
exit 1
8383
else
8484
echo "No formatting errors found."

.github/workflows/test-windows.yml

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -30,19 +30,19 @@ jobs:
3030
name: "USD-${{ matrix.usd }}-py${{ matrix.python }}"
3131

3232
steps:
33-
- uses: actions/checkout@v3
33+
- uses: actions/checkout@v4
3434

3535
- name: Set up Python ${{ matrix.python }}
36-
uses: actions/setup-python@v4
36+
uses: actions/setup-python@v5
3737
with:
3838
python-version: ${{ matrix.python }}
3939

4040
- name: Create Build Environment
4141
run: |
4242
vcpkg install --triplet=x64-windows gtest
43-
pip install pytest pytest-cmake
44-
cmake -E make_directory ${{runner.workspace}}/build
45-
cmake -E make_directory ${{runner.temp}}/USD
43+
python -m pip install -r ${{github.workspace}}\test\requirements.txt
44+
cmake -E make_directory ${{github.workspace}}\build
45+
cmake -E make_directory ${{runner.temp}}\USD
4646
4747
- name: Install USD
4848
working-directory: ${{runner.temp}}/USD
@@ -66,7 +66,7 @@ jobs:
6666
6767
- name: Configure & Build
6868
shell: bash
69-
working-directory: ${{runner.workspace}}/build
69+
working-directory: ${{github.workspace}}/build
7070
run: |
7171
export PATH="${{runner.temp}}/USD/bin;${{runner.temp}}/USD/lib;${PATH}"
7272
export PYTHONPATH="${{runner.temp}}/USD/lib/python;${PYTHONPATH}"
@@ -77,26 +77,26 @@ jobs:
7777
-D "BUILD_DOCS=OFF" \
7878
-D "CMAKE_INCLUDE_PATH=${{runner.temp}}/USD/include" \
7979
-D "CMAKE_LIBRARY_PATH=${{runner.temp}}/USD/lib" \
80-
'${{github.workspace}}'
80+
..
8181
cmake --build . --config Release
8282
8383
- name: Check for formatting errors
8484
shell: bash
85-
working-directory: ${{runner.workspace}}/build
85+
working-directory: ${{github.workspace}}/build
8686
run: |
8787
cmake --build . --target format
88-
STATUS_OUTPUT=$(git -C ${GITHUB_WORKSPACE} status --porcelain)
88+
STATUS_OUTPUT=$(git -C .. status --porcelain)
8989
if [ -n "$STATUS_OUTPUT" ]; then
9090
echo "Code formatting errors found:"
91-
git -C ${GITHUB_WORKSPACE} diff
91+
git -C .. diff
9292
exit 1
9393
else
9494
echo "No formatting errors found."
9595
fi
9696
9797
- name: Run Test
9898
shell: bash
99-
working-directory: ${{runner.workspace}}/build
99+
working-directory: ${{github.workspace}}/build
100100
run: ctest -VV -C Release
101101
env:
102102
CTEST_OUTPUT_ON_FAILURE: True

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# USD Notice Framework
22

3-
[![CMake](https://img.shields.io/badge/CMake-3.20...3.29-blue.svg?logo=CMake&logoColor=blue)](https://cmake.org)
3+
[![CMake](https://img.shields.io/badge/CMake-3.20...3.30-blue.svg?logo=CMake&logoColor=blue)](https://cmake.org)
44
[![test-linux](https://github.com/wdas/unf/actions/workflows/test-linux.yml/badge.svg?branch=main)](https://github.com/wdas/unf/actions/workflows/test-linux.yml)
55
[![test-windows](https://github.com/wdas/unf/actions/workflows/test-windows.yml/badge.svg?branch=main)](https://github.com/wdas/unf/actions/workflows/test-windows.yml)
66
[![License](https://img.shields.io/badge/License-Modified%20Apache%202.0-yellow.svg)](https://github.com/wdas/unf/blob/main/LICENSE.txt)

cmake/modules/FindSphinx.cmake

Lines changed: 0 additions & 64 deletions
This file was deleted.

doc/CMakeLists.txt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,8 +26,8 @@ file(COPY sphinx DESTINATION ${CMAKE_CURRENT_BINARY_DIR})
2626
configure_file(sphinx/conf.py sphinx/conf.py @ONLY)
2727

2828
sphinx_add_docs(unfDoc
29-
SOURCE "${CMAKE_CURRENT_BINARY_DIR}/sphinx"
30-
OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/doc"
29+
SOURCE_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/sphinx"
30+
OUTPUT_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/doc"
3131
DEPENDS unfApiRefDoc
3232
)
3333

doc/requirements.txt

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
Lowdown==0.2.1
2-
Sphinx==5.1.1
3-
sphinx-rtd-theme==1.0.0
4-
sphinxcontrib-doxylink==1.12.2
1+
Sphinx==7.*
2+
sphinx-cmake==0.*
3+
sphinx-rtd-theme==2.*
4+
sphinxcontrib-doxylink==1.*
Lines changed: 91 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,91 @@
1+
from datetime import datetime
2+
3+
from docutils import nodes
4+
from docutils.parsers.rst import directives
5+
from sphinx.util.docutils import SphinxDirective
6+
7+
8+
class ReleaseDirective(SphinxDirective):
9+
has_content = True
10+
required_arguments = 1
11+
optional_arguments = 0
12+
option_spec = {
13+
"date": directives.unchanged_required
14+
}
15+
16+
def run(self):
17+
"""Creates a section for release notes with version and date."""
18+
version = self.arguments[0]
19+
20+
# Fetch today's date as default if no date is provided
21+
today_date_str = datetime.now().strftime("%Y-%m-%d")
22+
date_str = self.options.get("date", today_date_str)
23+
24+
try:
25+
parsed_date = datetime.strptime(date_str, "%Y-%m-%d")
26+
release_date = parsed_date.strftime("%e %B %Y")
27+
except ValueError:
28+
raise ValueError(f"Invalid date format: {date_str}")
29+
30+
# Create the version title node
31+
version_node = nodes.strong(text=version)
32+
section_title = nodes.title("", "", version_node)
33+
34+
# Create the section node with a specific ID
35+
section_id = f"release-{version.replace(' ', '-')}"
36+
section = nodes.section(
37+
"", section_title,
38+
ids=[section_id],
39+
classes=["changelog-release"]
40+
)
41+
42+
# Append formatted date
43+
section.append(
44+
nodes.emphasis(text=release_date, classes=["release-date"])
45+
)
46+
47+
# Parse content into a list of changes
48+
content_node = nodes.Element()
49+
self.state.nested_parse(self.content, self.content_offset, content_node)
50+
51+
# Create a bullet list of changes
52+
changes_list = nodes.bullet_list("", classes=["changelog-change-list"])
53+
for child in content_node:
54+
item = nodes.list_item("")
55+
item.append(child)
56+
changes_list.append(item)
57+
58+
section.append(changes_list)
59+
60+
return [section]
61+
62+
63+
class ChangeDirective(SphinxDirective):
64+
has_content = True
65+
required_arguments = 1
66+
optional_arguments = 0
67+
68+
def run(self):
69+
"""Generates a categorized list item for a changelog entry."""
70+
category = self.arguments[0]
71+
72+
# Create a paragraph for the category with specific styling
73+
class_name = f"changelog-category-{category.lower().replace(' ', '-')}"
74+
category_node = nodes.inline(
75+
"", category,
76+
classes=["changelog-category", class_name]
77+
)
78+
paragraph_node = nodes.paragraph("", "", category_node)
79+
80+
# Parse the detailed content under the category
81+
content_node = nodes.container()
82+
self.state.nested_parse(self.content, 0, content_node)
83+
paragraph_node += content_node
84+
85+
return [paragraph_node]
86+
87+
88+
def setup(app):
89+
"""Register extension with Sphinx."""
90+
app.add_directive("release", ReleaseDirective)
91+
app.add_directive("change", ChangeDirective)

doc/sphinx/_static/style.css

Lines changed: 62 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,62 @@
1+
.changelog-release {
2+
position: relative;
3+
}
4+
5+
.changelog-release > h1, h2, h3, h4, h5 {
6+
margin-bottom: 5px;
7+
}
8+
9+
.changelog-release em.release-date {
10+
color: #999;
11+
position: absolute;
12+
line-height: 2.5em;
13+
top: 0;
14+
right: 0;
15+
}
16+
17+
.changelog-release ul.changelog-change-list {
18+
list-style: outside none none;
19+
}
20+
21+
.changelog-release ul.changelog-change-list > li {
22+
list-style: outside none none;
23+
position: relative;
24+
margin: 0;
25+
padding: 8px 0 2px 120px;
26+
border-top: 1px solid #D6D6D6;
27+
}
28+
29+
.rst-content .section .changelog-change-list ul li {
30+
list-style: initial;
31+
}
32+
33+
.changelog-category {
34+
border-right: 3px solid #CCC;
35+
box-shadow: 0px 1px 1px rgba(0, 0, 0, 0.05), 0px -1px 0px rgba(0, 0, 0, 0.05) inset;
36+
color: #333;
37+
display: inline-block;
38+
font-size: 0.7em;
39+
font-style: normal;
40+
font-weight: bold;
41+
line-height: 14px;
42+
padding: 4px 2px 4px 10px;
43+
text-shadow: 1px 1px 0px #FFF;
44+
text-transform: uppercase;
45+
width: 102px;
46+
position: absolute;
47+
top: 10px;
48+
left: 0px;
49+
background-color: #f8f8f8;
50+
}
51+
52+
.changelog-category-fixed {
53+
border-color: #7C0;
54+
}
55+
56+
.changelog-category-new {
57+
border-color: #11B0E9;
58+
}
59+
60+
.changelog-category-changed {
61+
border-color: #EB3F3F;
62+
}

0 commit comments

Comments
 (0)