-
Notifications
You must be signed in to change notification settings - Fork 38
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Connecting C++ and Python sphinx (#311)
* Remove doc for moving into python * Include python.rst in toc * Use 18.04 cp3.7 wheel * Integrating python documentation
- Loading branch information
1 parent
b12561d
commit 4926734
Showing
6 changed files
with
132 additions
and
128 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,6 +3,7 @@ name: "Python Bindings" | |
push: | ||
branches: | ||
- main | ||
- ci-sandbox | ||
tags: | ||
- "v*.*.*" | ||
pull_request: | ||
|
@@ -279,3 +280,88 @@ jobs: | |
- name: "Static typing checks: pytype" | ||
run: |- | ||
python3 -m pytype bindings/python | ||
docs: | ||
runs-on: ubuntu-18.04 | ||
needs: [python-ubuntu] | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v2 | ||
with: | ||
submodules: recursive | ||
|
||
# Runs javascript to extract push events from both tags and branch (only main, due to workflow trigger) | ||
# converts refs/<>/<name> -> <name> | ||
# eg: | ||
# refs/head/main -> main | ||
# refs/tags/v0.1.0 -> v0.1.0 | ||
# | ||
- name: Download artifacts | ||
uses: actions/download-artifact@v2 | ||
- name: Extract tag name | ||
id: tag | ||
uses: actions/[email protected] | ||
if: ${{ github.event_name == 'push' }} | ||
with: | ||
github-token: ${{ secrets.GITHUB_TOKEN }} | ||
script: | | ||
const args = context.payload.ref.split("/"); | ||
[refs, category, ...rest] = args; | ||
return rest.join("/"); | ||
# Patches the BERGAMOT_VERSION file used by sphinx-docs at run time to | ||
# obtain names like 'main' or 'ci-sandbox' to not confuse with version | ||
# based documentation built separately. | ||
- name: Deploy-time patch version | ||
run: | | ||
echo ${{steps.tag.outputs.result }} > BERGAMOT_VERSION | ||
- name: Set up Doxygen | ||
run: sudo apt-get install -y doxygen | ||
|
||
- name: Set up Python | ||
uses: actions/setup-python@v2 | ||
with: | ||
python-version: 3.7 | ||
|
||
- name: Set up dependency cache | ||
uses: actions/cache@v2 | ||
with: | ||
path: ~/.cache/pip | ||
key: ${{ runner.os }}-pip-${{ hashFiles('doc/requirements.txt') }} | ||
restore-keys: | | ||
${{ runner.os }}-pip- | ||
- name: Install dependencies | ||
working-directory: ./doc | ||
run: | | ||
python3 -m pip install -r requirements.txt | ||
python3 -m pip install ${{github.workspace}}/artifact/bergamot-*-cp37*.whl | ||
- name: Build documentation | ||
working-directory: ./doc | ||
run: sphinx-build -b html ./ build/ | ||
|
||
|
||
- name: Deploy 🚀 | ||
uses: JamesIves/[email protected] | ||
if: ${{ github.event_name == 'push' && github.repository == 'browsermt/bergamot-translator' }} | ||
with: | ||
repository-name: 'browsermt/docs' | ||
branch: gh-pages # The branch the action should deploy to. | ||
folder: './doc/build/' # The folder the action should deploy. | ||
target-folder: '${{ steps.tag.outputs.result }}' | ||
ssh-key: ${{ secrets.BERGAMOT_SSH_PRIVATE_KEY }} | ||
|
||
# This artifact contains the HTML output of Sphinx only. | ||
# With index.html at the root of the produced zip file. | ||
# For use for maintainers to download the zip and check render of | ||
# documentation while generated at pull-request. | ||
- name: Upload documentation | ||
uses: actions/upload-artifact@v2 | ||
if: ${{ github.event_name == 'pull_request'}} | ||
with: | ||
name: api-docs | ||
path: ./doc/build/ | ||
if-no-files-found: error | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -17,6 +17,7 @@ This is developer documentation. | |
marian-integration | ||
wasm-example | ||
api/library_index | ||
python | ||
|
||
|
||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -5,3 +5,4 @@ sphinx_rtd_theme | |
mistune<2.0.0 | ||
recommonmark | ||
m2r | ||
sphinx-argparse |