Skip to content

Commit

Permalink
Merge pull request #3224 from rajat2004/docs-gh-action
Browse files Browse the repository at this point in the history
Add Actions script to build and deploy to gh-pages
  • Loading branch information
Jonathan authored Dec 18, 2020
2 parents 4e6f1e3 + 05acb49 commit d9114f2
Show file tree
Hide file tree
Showing 4 changed files with 56 additions and 4 deletions.
47 changes: 47 additions & 0 deletions .github/workflows/test_docs.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
name: Documentation Build & Deploy

# Controls when the action will run.
on: [push, pull_request, workflow_dispatch]

jobs:
build:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v2

- name: Setup Python
uses: actions/setup-python@v2
with:
python-version: '3.7'
architecture: 'x64'

- name: Install dependencies
run: |
python3 -m pip install --upgrade pip
python3 -m pip install mkdocs pymdown-extensions # Mkdocs requirements
- name: Build API reference docs
run: |
python3 -m venv .env # Virtual env to avoid dep. issues
source .env/bin/activate
pip install Sphinx sphinx_rtd_theme numpy msgpack-rpc-python
pushd PythonClient >/dev/null
./build_api_docs.sh
popd >/dev/null
cp -r PythonClient/docs/_build docs/api_docs/ # Copy generated files
deactivate
- name: Build AirSim Documentation
run: ./build_docs.sh

# Only on commits to 'master' branch
- name: Deploy
uses: peaceiris/actions-gh-pages@v3
if: ${{ github.event_name == 'push' && github.ref == 'refs/heads/master' }}
with:
github_token: $
publish_dir: ./build_docs

4 changes: 3 additions & 1 deletion PythonClient/airsim/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -836,10 +836,12 @@ def simCreateVoxelGrid(self, position, x, y, z, res, of):
Args:
position (Vector3r): Position around which voxel grid is centered in m
x, y, z (float): Size of each voxel grid dimension in m
x, y, z (int): Size of each voxel grid dimension in m
res (float): Resolution of voxel grid in m
of (str): Name of output file to save voxel grid as
Returns:
bool: True if output written to file successfully, else False
"""
return self.client.call('simCreateVoxelGrid', position, x, y, z, res, of)

Expand Down
3 changes: 2 additions & 1 deletion PythonClient/airsim/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
import inspect
import types
import re
import cv2 # pip install opencv-python
import logging

from .types import *
Expand Down Expand Up @@ -202,6 +201,8 @@ def write_pfm(file, image, scale=1):
def write_png(filename, image):
""" image must be numpy array H X W X channels
"""
import cv2 # pip install opencv-python

ret = cv2.imwrite(filename, image)
if not ret:
logging.error(f"Writing PNG file {filename} failed")
6 changes: 4 additions & 2 deletions PythonClient/build_api_docs.sh
Original file line number Diff line number Diff line change
@@ -1,2 +1,4 @@
cd docs;
make html;
#!/bin/sh

cd docs
make html

0 comments on commit d9114f2

Please sign in to comment.