Merge pull request #1440 from Sage-Bionetworks/develop-async-set-anno… #233
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: pdoc | |
# build the documentation whenever there are new commits on main | |
on: | |
push: | |
branches: | |
- develop | |
workflow_dispatch: # Allow manually triggering the workflow | |
# security: restrict permissions for CI jobs. | |
permissions: | |
contents: read | |
concurrency: | |
# cancel the current running workflow from the same branch, PR when a new workflow is triggered | |
# when the trigger is not a PR but a push, it will use the commit sha to generate the concurrency group | |
# {{ github.workflow }}: the workflow name is used to generate the concurrency group. This allows you to have more than one workflows | |
# {{ github.ref_type }}: the type of Git ref object created in the repository. Can be either branch or tag | |
# {{ github.event.pull_request.number}}: get PR number | |
# {{ github.sha }}: full commit sha | |
# credit: https://github.com/Sage-Bionetworks-Workflows/sagetasks/blob/main/.github/workflows/ci.yml | |
group: >- | |
${{ github.workflow }}-${{ github.ref_type }}- | |
${{ github.event.pull_request.number || github.sha }} | |
cancel-in-progress: true | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
env: | |
POETRY_VERSION: 1.3.0 | |
strategy: | |
matrix: | |
python-version: ["3.9", "3.10"] | |
steps: | |
#---------------------------------------------- | |
# check-out repo and set-up python | |
#---------------------------------------------- | |
- name: Check out repository | |
uses: actions/checkout@v3 | |
- name: Set up Python ${{ matrix.python-version }} | |
uses: actions/setup-python@v3 | |
with: | |
python-version: ${{ matrix.python-version }} | |
#---------------------------------------------- | |
# install & configure poetry | |
#---------------------------------------------- | |
- name: Install Poetry | |
run: | | |
curl -sSL https://install.python-poetry.org \ | |
| python3 - --version ${{ env.POETRY_VERSION }}; | |
poetry config virtualenvs.create true; | |
poetry config virtualenvs.in-project true; | |
#---------------------------------------------- | |
# load cached venv if cache exists | |
#---------------------------------------------- | |
- name: Load cached venv | |
id: cached-poetry-dependencies | |
uses: actions/cache@v3 | |
with: | |
path: .venv | |
key: venv-${{ runner.os }}-${{ hashFiles('**/poetry.lock') }} | |
#---------------------------------------------- | |
# install dependencies and root project | |
#---------------------------------------------- | |
- name: Install dependencies and root project | |
if: steps.cached-poetry-dependencies.outputs.cache-hit != 'true' | |
run: poetry install --no-interaction --all-extras | |
# create documentation | |
- run: poetry add [email protected] | |
- run: poetry show pdoc | |
- run: poetry run pdoc --docformat google -o docs/schematic schematic/manifest schematic/models schematic/schemas schematic/store schematic/utils schematic/visualization | |
- uses: actions/upload-pages-artifact@v1 | |
with: | |
path: docs/schematic | |
# Deploy the artifact to GitHub pages. | |
# This is a separate job so that only actions/deploy-pages has the necessary permissions. | |
deploy: | |
needs: build | |
runs-on: ubuntu-latest | |
permissions: | |
pages: write | |
id-token: write | |
environment: | |
name: github-pages | |
url: ${{ steps.deployment.outputs.page_url }} | |
steps: | |
- id: deployment | |
uses: actions/deploy-pages@v1 |