Skip to content
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

Build documentation using Sphinx #441

Open
wants to merge 57 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
57 commits
Select commit Hold shift + click to select a range
7946324
Build documentation using Sphinx
azeey May 15, 2024
a6afd14
Build documentation using Sphinx
azeey May 15, 2024
5f30f92
Add documentation for Gazebo vendor packages
azeey May 21, 2024
e3049d5
Indicate that Gazebo Fortress is recommended for ROS 2 Humble and Iro…
azeey May 7, 2024
10742d5
Installing Gazebo11 side by side with new Gazebo Tutorial (#438)
j-rivero May 14, 2024
9795585
Minor updates on Noble references (#439)
j-rivero May 15, 2024
4d2759b
contributing.md: suggest multi-repo features target main (#440)
scpeters May 15, 2024
51b6f90
Build documentation using Sphinx
azeey May 15, 2024
9ab84fc
Enable 'edit this page'
azeey May 21, 2024
99fd22c
Suppress warnings for external links
azeey May 21, 2024
28c3b54
Update warning style
azeey Jun 3, 2024
dc03207
Handle dev and old versions, fix going to the correct page after vers…
azeey Jun 3, 2024
650a3e4
Use different background for eol vs supported versions
azeey Jun 3, 2024
c9ab794
Add .gitignore
azeey Jun 3, 2024
7653220
Add /libs
azeey Jun 4, 2024
7582ec7
Refactor
azeey Jun 4, 2024
289cacb
Fetch content from github
azeey Jun 4, 2024
65fcaf6
Add individual library pages
azeey Jun 4, 2024
ba16cad
Add support for "latest" and "all"
azeey Jun 4, 2024
66b4cf1
Merge remote-tracking branch 'origin/master' into gz_vendor_pkgs
azeey Jun 4, 2024
44a1f69
Check if symlink already exists
azeey Jun 4, 2024
bf0f3ce
Fix formatting of /libs pagse
azeey Jun 4, 2024
99eb778
Add redirect from /docs
azeey Jun 4, 2024
d5f3024
Share conf.py file between docs and libs
azeey Jun 4, 2024
f0e8e85
Add option for building pointers
azeey Jun 4, 2024
3807824
Customize footer
azeey Jun 5, 2024
b8ca4cb
Add more menu items, tweak style
azeey Jun 5, 2024
7a363ed
Add option to specify output directory, build libs only
azeey Jun 5, 2024
ffef1b4
Remove .github from .gitignore
azeey Jun 5, 2024
32361de
Add deployment workflow
azeey Jun 5, 2024
a8fc361
Merge branch 'gz_vendor_pkgs' into sphinx_docs
azeey Jun 5, 2024
83f6449
Merge remote-tracking branch 'origin/master' into sphinx_docs
azeey Jun 5, 2024
751d271
Use branch that supports GA, fix path
azeey Jun 5, 2024
afbc9cd
Set base-href so frontend website works even when deployed to a githu…
azeey Jun 5, 2024
9dc4e25
Fix npm command
azeey Jun 5, 2024
b55f9cc
Add pointer pages
azeey Jun 5, 2024
32d1e73
Add GZ_DEPLOY_URL
azeey Jun 5, 2024
8fdd22b
Fix base-href usage, use GZ_DEPLOY_URL in more places
azeey Jun 6, 2024
346718c
Update on-push branches. $default-branch only works on workflow templ…
azeey Jun 6, 2024
74b46dc
Use full base url for base-href
azeey Jun 6, 2024
972736e
Fix warning banner link, add favicon, use subprocess to run sphinx
azeey Jun 6, 2024
d4bfbb0
Treat all links as external, fix warnings
azeey Jun 6, 2024
7f4d8e1
Fix scroll padding
azeey Jun 6, 2024
12d605c
Fix all warnings
azeey Jun 6, 2024
c9bd06b
WIP
azeey Jun 26, 2024
ef5ac69
Merge remote-tracking branch 'origin/master' into azeey/sphinx_docs
azeey Jul 2, 2024
ad14a78
Merge remote-tracking branch 'origin/master' into sphinx_docs
azeey Jul 2, 2024
6744a27
Deploy to gh-pagse
azeey Jul 2, 2024
b9af76b
Keep files
azeey Jul 2, 2024
eff9088
Update permissions
azeey Jul 2, 2024
c9c68bb
Test on test_sphinx_docs
azeey Jul 2, 2024
268ea01
Parallel builds
azeey Jul 2, 2024
4366b60
Fix upload
azeey Jul 2, 2024
ec8d140
Fix yaml
azeey Jul 2, 2024
cd5e151
Add concurrency
azeey Jul 2, 2024
14684e5
Merge branch 'test_sphinx_docs' into azeey/sphinx_docs
azeey Jul 2, 2024
e44c638
Remove test_sphinx_docs
azeey Jul 2, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
97 changes: 97 additions & 0 deletions .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,97 @@
# yaml-language-server: $schema=https://json.schemastore.org/github-workflow.json
name: Deploy Website and Docs

on:
pull_request:
push:
branches:
- master

# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:

jobs:
build_website:
runs-on: ubuntu-latest
steps:
# Build website from gazebosim-web-frontend
- name: Checkout
uses: actions/checkout@v4
with:
repository: gazebo-web/gazebosim-web-frontend
ref: support_github_pages
- name: Setup Node
uses: actions/setup-node@v4
with:
node-version: "20"
cache: npm
cache-dependency-path: package-lock.json
- name: Setup Pages
id: pages
uses: actions/configure-pages@v5
- name: Install Website dependencies
run: npm ci
- name: Build Website
run: npm run build -- --base-href "${{ steps.pages.outputs.base_url }}/"
# Upload the artifact for local preview
- name: Upload artifact
uses: actions/upload-artifact@v4
with:
name: website
path: dist

# Build Docs
build_docs:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup Pages
id: pages
uses: actions/configure-pages@v5
- name: Setup Python
uses: actions/setup-python@v5
with:
python-version: '3.12'
cache: 'pip'
- name: Install Docs dependencies
run: pip install -r requirements.txt
- name: Build Docs
run: python build_multiversion.py --pointers --libs --output_dir .build
env:
GZ_DEPLOY_URL: "${{ steps.pages.outputs.base_url }}"

# Upload the artifact for local preview
- name: Upload artifact
uses: actions/upload-artifact@v4
with:
name: docs
path: .build

deploy:
runs-on: ubuntu-latest
needs: [build_website, build_docs]
permissions:
contents: write
# Allow only one concurrent deployment between this and the nightly-upload workflow.
concurrency:
group: pages
cancel-in-progress: false
steps:
- uses: actions/download-artifact@v4
with:
merge-multiple: true
- name: Upload merged
uses: actions/upload-artifact@v4
with:
name: website-docs-merged
path: ./
- name: Commit
uses: peaceiris/actions-gh-pages@v4
# The workflow upto this point is good for generating a preview,
# but only commit to deploy if we are on the master branch (not a pull request).
if: github.ref == 'refs/heads/master'
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
publish_dir: ./
keep_files: true
25 changes: 12 additions & 13 deletions .github/workflows/nightly-upload.yml
Original file line number Diff line number Diff line change
Expand Up @@ -58,17 +58,14 @@ jobs:
needs: build
runs-on: ubuntu-latest
permissions:
id-token: write
contents: read
contents: write
# Allow only one concurrent deployment between this and the deploy workflow.
concurrency:
group: pages
cancel-in-progress: false
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Configure AWS Credentials
id: creds
uses: aws-actions/configure-aws-credentials@v4
with:
aws-region: us-east-1
role-to-assume: arn:aws:iam::200670743174:role/github-oidc-deployment-gz-web-app
- uses: actions/download-artifact@v4
id: download
with:
Expand All @@ -81,8 +78,10 @@ jobs:
with:
name: api-docs
path: .api-out/*
- name: Run nightly upload
run: aws s3 sync .api-out/ s3://gazebosim.org/api/
- name: Invalidate Cloudfront distribution
run: |
aws cloudfront create-invalidation --distribution-id ${{ secrets.CLOUDFRONT_DISTRIBUTION_ID }} --paths '/*' --region us-east-1
- name: Commit
uses: peaceiris/actions-gh-pages@v4
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
publish_dir: ./.api-out
destination_dir: api
keep_files: true
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
.build
.tmp
.venv
42 changes: 39 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,45 @@ found under the `API Reference` section of [https://gazebosim.org/docs](https://

## Main docs

The documentation in this repository is updated whenever the
[gazebosim-web-backend](https://github.com/gazebo-web/gazebosim-web-backend),
is deployed. The gazebosim-web-backend webserver maintains a clone of this repository, and serves the markdown pages to https://gazebosim.org/docs.
The documentation in this repository is built using [Sphinx](https://www.sphinx-doc.org/).
To build, you need to install the following:

* python virtualenv

Create the virtual env and activate it:

```bash
python3 -m venv .venv
source .venv/bin/activate
```

Then install the necessary dependencies:

```bash
pip install -r requirements.txt
```

```bash
python3 build_multiversion.py
```

This will build all the documentation for all versions of Gazebo.
You can preview the result locally by running an HTTP server on
the output directory `.build`. For example:

```bash
python3 -m http.server 8000 -d .build

```

This will serve the website on <http://localhost:8000>

For quicker iteration, you can build the documentation for a subset
of Gazebo versions. To build `garden` and `harmonic`:

```bash
python3 build_multiversion.py --release garden harmonic
```

## Library docs

Expand Down
149 changes: 149 additions & 0 deletions _static/css/gazebo.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,149 @@
html {
--pst-font-family-base: Roboto, var(--pst-font-family-base-system);
--pst-font-size-base: 14px;
--pst-header-height: 64px;
--gz-doc-header-height: 120px;
scroll-padding-top: calc(var(--pst-header-height) + var(--gz-doc-header-height) + 1rem);
}

html[data-theme="light"] {
--gz-color-doc-header: #4fc3f7;
--gz-color-doc-header-text: #fff;
--pst-color-primary: #0277bd;
--gz-color-primary-sidebar: #f8f9fa;
}

html[data-theme="dark"] {
--gz-color-doc-header: rgb(15 23 36 / 30%);
--gz-color-doc-header-text: #fff;
--pst-color-primary: #0277bd;
--gz-color-primary-sidebar: #1a1c1e;
--pst-color-background: #131416;
}

a {
text-decoration: none;
}

pre {
border: none;
}
.bd-main .bd-content .bd-article-container {
max-width: 160em;
}

.bd-page-width {
max-width: 100%;
}

.bd-sidebar {
max-width: 20em;
}

.sidebar-primary-items__end {
display: none;
}

.bd-links__title {
display: none;
}

.navbar-nav .nav-item {
letter-spacing: normal;
text-transform: uppercase;
font-size: 16px;
text-decoration: none;
outline: 0;
transition: 0.5s;
font-weight: 400;
color: #6e6e6e;
border-bottom: 1px solid rgba(0, 0, 0, 0);
}
.navbar-nav li a {
margin-right: 20px;
}

.bd-header .navbar-header-items {
padding-left: 5em;
}

.nav-link.nav-external:after {
display: none;
}

.doc-header {
width: 100%;
background-color: var(--gz-color-doc-header);
color: var(--gz-color-doc-header-text);
height: var(--gz-doc-header-height);
}

.banner {
align-items: center;
padding: 20px 40px;
place-content: center space-between;
height: 100%;
}

header.navbar {
display: block;
}

.bd-sidebar-primary {
max-height: calc(100vh - var(--pst-header-height) + var(--gz-doc-header-height));
top: calc(var(--pst-header-height) + var(--gz-doc-header-height));
background-color: var(--gz-color-primary-sidebar);
}

.bd-sidebar-secondary {
max-height: calc(100vh - var(--pst-header-height) + var(--gz-doc-header-height));
top: calc(var(--pst-header-height) + var(--gz-doc-header-height));
}

.gz-version-switcher {
display: flex;
}
button.btn.version-switcher__button {
color: var(--gz-color-doc-header-text);
border-color: var(--gz-color-doc-header-text);
}
.bd-header-version-info {
background-color: var(--pst-color-info-bg);
}

.navbar-brand img {
height: 84px;
}

.warning {
border-left: 3px solid rgb(228, 167, 2);
padding: 15px;
margin: 15px 0;
color: #8a6c40;
background: rgb(252, 248, 228);
}

/* Style for /libs */
.gz-libs-lists {
display: inline;
padding: 0;
}

.gz-libs-lists p {
display: inline;
}

.gz-libs-lists li, .gz-libs-cards li {
list-style-type: none;
display: inline;
padding-left: 0px;
padding-right: 30px;
}

.gz-libs-cards ul {
padding-left: 1em;
}

.gz-libs-cards .sd-card-text {
display: inline;
}
Binary file added _static/icon/favicon.ico
Binary file not shown.
Loading
Loading