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

[Feat][Doc] switch to poetry project for docs generating #384

Merged
merged 11 commits into from
Feb 28, 2024
Merged
20 changes: 14 additions & 6 deletions .github/workflows/docs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ jobs:
ref: ${{ github.event.pull_request.head.ref }}
submodules: true
fetch-depth: 0

- name: Check License Header
uses: apache/skywalking-eyes/header@main
with:
Expand All @@ -68,18 +68,26 @@ jobs:
<sub>🤖 By [surge-preview](https://surge.sh/)</sub>
body-include: '<!-- Sticky Pull Request Comment: Surge Preview build -->'

- name: Install Python
uses: actions/setup-python@v4
with:
python-version: 3.9

- name: Install Poetry
uses: abatilo/actions-poetry@v2

- name: Install dependencies
run: |
sudo apt-get update -y
sudo apt-get install -y ca-certificates cmake doxygen python3-pip
sudo pip3 install -r docs/requirements.txt
sudo apt-get install -y ca-certificates doxygen
poetry install --with=docs,spark
working-directory: ./pyspark

- name: Generate Doc
run: |
export JAVA_HOME=${JAVA_HOME_11_X64}
pushd docs
make html
popd
make html-poetry
working-directory: ./docs

- name: Preview using surge
if: ${{ github.event_name == 'pull_request' && github.event.pull_request.head.repo.full_name == 'alibaba/GraphAr' }}
Expand Down
28 changes: 6 additions & 22 deletions docs/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,12 @@
# from the environment for the first two.
# Do not fail the build if there are warnings
SPHINXOPTS = -j8
SPHINXBUILD ?= sphinx-build
SPHINXBUILD ?= sphinx.cmd.build
SemyonSinchenko marked this conversation as resolved.
Show resolved Hide resolved
SOURCEDIR = .
BUILDDIR = _build

# Internal variables.
ALLSPHINXOPTS = -d $(BUILDDIR)/doctrees $(SPHINXOPTS) $(SOURCEDIR)
ALLSPHINXOPTS = -b html -d ../docs/$(BUILDDIR)/doctrees $(SPHINXOPTS)
DOXYGEN = doxygen
ROOTDIR = ..

Expand Down Expand Up @@ -40,30 +40,14 @@ spark-apidoc:
mvn --no-transfer-progress clean install -DskipTests -Dspotless.check.skip=true && \
mvn --no-transfer-progress scala:doc

.PHONY: html
html: cpp-apidoc spark-apidoc
$(SPHINXBUILD) -b html $(ALLSPHINXOPTS) $(BUILDDIR)/html
rm -fr $(BUILDDIR)/html/spark/reference
cp -fr $(ROOTDIR)/spark/graphar/target/site/scaladocs $(BUILDDIR)/html/spark/reference/
cd $(ROOTDIR)/java && \
mvn --no-transfer-progress -P javadoc javadoc:aggregate \
-Dmaven.antrun.skip=true \
-DskipTests \
-Djavadoc.output.directory=$(ROOTDIR)/docs/$(BUILDDIR)/html/java/ \
-Djavadoc.output.destDir=reference \
--quiet
@echo
@echo "Build finished. The HTML pages are in $(BUILDDIR)/html."

.PHONY: pyspark-apidoc
pyspark-apidoc:
cd $(ROOTDIR)/pyspark && \
poetry run sphinx-apidoc -o $(ROOTDIR)/docs/pyspark/api graphar_pyspark/
cd ../pyspark && poetry run sphinx-apidoc -o ../docs/pyspark/api graphar_pyspark/

.PHONY: html-poetry
html-poetry:
cd $(ROOTDIR)/pyspark && \
poetry run bash -c "cd $(ROOTDIR)/docs && $(SPHINXBUILD) -b html $(ALLSPHINXOPTS) $(BUILDDIR)/html"
html-poetry: cpp-apidoc spark-apidoc pyspark-apidoc
SemyonSinchenko marked this conversation as resolved.
Show resolved Hide resolved
SemyonSinchenko marked this conversation as resolved.
Show resolved Hide resolved
echo "Generate docs..."
cd $(ROOTDIR)/pyspark && poetry run python -m $(SPHINXBUILD) $(ALLSPHINXOPTS) $(ROOTDIR)/docs $(ROOTDIR)/docs/$(BUILDDIR)/html
rm -fr $(BUILDDIR)/html/spark/reference
cp -fr $(ROOTDIR)/spark/graphar/target/site/scaladocs $(BUILDDIR)/html/spark/reference/
cd $(ROOTDIR)/java && \
Expand Down
Loading