Skip to content

Commit d64d907

Browse files
Add documentation (#208)
* Initial scaffold Signed-off-by: Ashwin Vaidya <[email protected]> * file ending Signed-off-by: Ashwin Vaidya <[email protected]> * cpp scaffold Signed-off-by: Ashwin Vaidya <[email protected]> * python scaffold Signed-off-by: Ashwin Vaidya <[email protected]> * Fix titles Signed-off-by: Ashwin Vaidya <[email protected]> * delete removed models Signed-off-by: Ashwin Vaidya <[email protected]> * Populate documentation Signed-off-by: Ashwin Vaidya <[email protected]> * refactor Signed-off-by: Ashwin Vaidya <[email protected]> * add workflow Signed-off-by: Ashwin Vaidya <[email protected]> * run pre-commit Signed-off-by: Ashwin Vaidya <[email protected]> * update workflow Signed-off-by: Ashwin Vaidya <[email protected]> * add node setup to workflow Signed-off-by: Ashwin Vaidya <[email protected]> * struct from class Signed-off-by: Ashwin Vaidya <[email protected]> * remove make.bat Signed-off-by: Ashwin Vaidya <[email protected]> --------- Signed-off-by: Ashwin Vaidya <[email protected]>
1 parent a6b8956 commit d64d907

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

75 files changed

+4007
-1
lines changed

.github/workflows/docs.yml

Lines changed: 80 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,80 @@
1+
name: Build Docs
2+
permissions: read-all
3+
4+
on:
5+
workflow_dispatch: # run on request (no need for PR)
6+
push:
7+
branches:
8+
- master
9+
10+
jobs:
11+
Build-Docs:
12+
runs-on: ubuntu-20.04
13+
permissions:
14+
contents: write
15+
steps:
16+
- name: Checkout repository
17+
uses: actions/checkout@v4
18+
- name: Set up Python
19+
uses: actions/setup-python@v5
20+
with:
21+
python-version: "3.10"
22+
- name: Install dependencies
23+
run: pip install 'model_api/python/.[docs]'
24+
- name: Install and Generate Doxygen
25+
uses: mattnotmitt/[email protected]
26+
- name: Build Docs
27+
run: |
28+
cd docs
29+
make html
30+
- name: Create gh-pages branch
31+
run: |
32+
if [[ ${{github.event_name}} == 'workflow_dispatch' ]]; then
33+
echo RELEASE_VERSION="test_build" >> $GITHUB_ENV
34+
else
35+
echo RELEASE_VERSION=${GITHUB_REF#refs/*/} >> $GITHUB_ENV
36+
fi
37+
echo SOURCE_NAME=${GITHUB_REF#refs/*/} >> $GITHUB_OUTPUT
38+
echo SOURCE_BRANCH=${GITHUB_REF#refs/heads/} >> $GITHUB_OUTPUT
39+
echo SOURCE_TAG=${GITHUB_REF#refs/tags/} >> $GITHUB_OUTPUT
40+
41+
existed_in_remote=$(git ls-remote --heads origin gh-pages)
42+
43+
if [[ -z ${existed_in_remote} ]]; then
44+
echo "Creating gh-pages branch"
45+
git config --local user.email "[email protected]"
46+
git config --local user.name "GitHub Action"
47+
git checkout --orphan gh-pages
48+
git reset --hard
49+
touch .nojekyll
50+
git add .nojekyll
51+
git commit -m "Initializing gh-pages branch"
52+
git push origin gh-pages
53+
git checkout ${{steps.branch_name.outputs.SOURCE_NAME}}
54+
echo "Created gh-pages branch"
55+
else
56+
echo "Branch gh-pages already exists"
57+
fi
58+
- name: Commit docs to gh-pages branch
59+
run: |
60+
git fetch
61+
git checkout gh-pages
62+
mkdir -p /tmp/docs_build
63+
cp -r docs/build/html/* /tmp/docs_build/
64+
rm -rf ${{ env.RELEASE_VERSION }}/*
65+
echo '<html><head><meta http-equiv="refresh" content="0; url=stable/" /></head></html>' > index.html
66+
mkdir -p ${{ env.RELEASE_VERSION }}
67+
cp -r /tmp/docs_build/* ./${{ env.RELEASE_VERSION }}
68+
rm -rf /tmp/docs_build
69+
git config --local user.email "[email protected]"
70+
git config --local user.name "GitHub Action"
71+
if [[ ${{ env.RELEASE_VERSION }} != 'test_build' ]]; then
72+
ln -sfn ${{ env.RELEASE_VERSION }} latest
73+
fi
74+
git add ./latest ${{ env.RELEASE_VERSION }}
75+
git commit -m "Update documentation" -a || true
76+
- name: Push changes
77+
uses: ad-m/github-push-action@master
78+
with:
79+
github_token: ${{ secrets.GITHUB_TOKEN }}
80+
branch: gh-pages

.github/workflows/pre_commit.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,10 @@ jobs:
2323
uses: actions/setup-python@v5
2424
with:
2525
python-version: "3.10"
26+
- name: Set up Node.js
27+
uses: actions/setup-node@v4
28+
with:
29+
node-version: 22
2630
- name: Install clang-format
2731
run: sudo apt-get install -y clang-format-10
2832
- name: Install dependencies

.gitignore

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -136,5 +136,10 @@ dmypy.json
136136
# Pyre type checker
137137
.pyre/
138138

139+
# Sphinx documentation
140+
docs/build/
141+
docs/build_cpp/
142+
docs/source/_build/
143+
139144
# vs-code
140145
.vscode/

.pre-commit-config.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
default_language_version:
2-
node: 18.15.0
2+
node: 22.10.0
33

44
repos:
55
- repo: https://github.com/pre-commit/pre-commit-hooks

0 commit comments

Comments
 (0)