Merge pull request #87 from SPARC-X/update-api-12266898999 #48
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
name: Publish Document Pages for SPARC-X-API | |
# SPARC source code components are also parsed at each submission | |
on: | |
push: | |
branches: | |
- master | |
- badges | |
paths: | |
- 'doc/**' | |
- 'sparc/**' | |
- '.coverage' | |
- '.github/workflows/publish_doc_pages.yml' | |
pull_request: | |
branches: | |
- master | |
- badges | |
paths: | |
- 'doc/**' | |
- 'sparc/**' | |
- '.coverage' | |
- '.github/workflows/publish_doc_pages.yml' | |
workflow_dispatch: | |
jobs: | |
sphinx-build: | |
defaults: | |
run: | |
shell: bash -l {0} | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Checkout the latest .coverage file from badges branch | |
uses: actions/checkout@v4 | |
with: | |
ref: badges | |
path: coverage | |
- name: List current files | |
run: | | |
if [ -f coverage/.coverage ]; then | |
cp coverage/.coverage . | |
fi | |
ls -al coverage/ | |
ls -al . | |
- uses: conda-incubator/setup-miniconda@v3 | |
with: | |
python-version: "3.11" | |
mamba-version: "*" | |
channels: conda-forge,defaults | |
channel-priority: true | |
activate-environment: sparc-api-build-doc | |
- name: Install doc-build dependencies | |
run: | | |
pip install -e ".[doc]" | |
- name: Generate coverage files | |
run: | | |
mkdir -p doc/_static | |
if [ -f .coverage ]; then | |
coverage html --omit="tests/*.py" -d doc/_static/htmlcov | |
fi | |
ls -al . | |
ls -al doc/_static | |
- name: Build sphix doc | |
run: | | |
cd doc | |
make clean && make html | |
- name: Deploy to github pages | |
uses: peaceiris/actions-gh-pages@v4 | |
if: github.ref == 'refs/heads/master' && (github.event_name != 'pull_request') | |
with: | |
github_token: ${{ secrets.GITHUB_TOKEN }} | |
publish_branch: gh_pages | |
publish_dir: doc/_build/html | |
- name: Upload preview when creating pull request | |
if: github.event_name == 'pull_request' | |
uses: actions/upload-artifact@v3 | |
with: | |
name: docs_build_preview | |
path: doc/_build/html |