add test for assert sample and rtype #856
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: website | |
on: | |
push: | |
branches: [main] | |
pull_request: | |
branches: [main] | |
release: | |
types: [published] | |
# Sets permissions of the GITHUB_TOKEN to allow deployment to GitHub Pages | |
permissions: | |
contents: read | |
pages: write | |
id-token: write | |
jobs: | |
render-docs: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: quarto-dev/quarto-actions/setup@v2 | |
- uses: actions/setup-python@v5 | |
with: | |
python-version: "3.12" | |
- name: cache poetry | |
uses: actions/cache@v4 | |
with: | |
path: ~/.local | |
key: ${{ runner.os }}-poetry | |
- name: install poetry | |
run: pip install poetry | |
- name: install package | |
run: poetry install --with dev | |
# This section renders the quarto documents (and the README file) | |
# and moves them to the docs/source/_compiled_qmd directory | |
# which is then uploaded as an artifact. | |
- name: Render documents | |
run: | | |
poetry run quarto render README.md --to rst -o index2.rst | |
mv docs/source/tutorials model/ | |
cd model | |
mkdir _compiled_qmd | |
mv ../index2.rst _compiled_qmd | |
for file in $(find tutorials -name '*.qmd'); do | |
poetry run quarto render $file --to rst --output-dir ../_compiled_qmd | |
done | |
for rst_file in _compiled_qmd/*.rst; do | |
poetry run python ../docs/post_process_rst.py "$rst_file" | |
done | |
# Upload | |
- name: Upload artifacts | |
uses: actions/upload-artifact@v4 | |
with: | |
name: tutorials | |
path: model/_compiled_qmd/ | |
build: | |
needs: render-docs | |
runs-on: ubuntu-latest | |
permissions: | |
contents: write | |
steps: | |
- uses: actions/checkout@v4 | |
# Setting up the environment | |
- name: Setup Pages | |
uses: actions/configure-pages@v4 | |
# Load the artifact github-pages-tutorials | |
- name: Download artifacts | |
uses: actions/download-artifact@v4 | |
with: | |
name: tutorials | |
path: docs/source/tutorials/ | |
- run: mv docs/source/tutorials/index2.rst docs/source/index.rst | |
- name: Set up Python | |
uses: actions/setup-python@v5 | |
with: | |
python-version: '3.12' | |
- name: Install Poetry | |
run: pip install poetry | |
- name: Install dependencies with Poetry | |
run: poetry install --with dev | |
# Building | |
- name: Build HTML using Poetry | |
run: poetry run sphinx-build -M html docs/source/ docs/build/ | |
# Upload | |
- name: Upload artifacts | |
uses: actions/upload-pages-artifact@v3 | |
with: | |
name: github-pages | |
path: docs/build/html/ | |
deploy: | |
# Deploy to the github-pages environment | |
# but not on PRs | |
if: ${{ github.event_name != 'pull_request' }} | |
environment: | |
name: github-pages | |
url: ${{ steps.deployment.outputs.page_url }} | |
needs: build | |
# Specify runner + deployment step | |
runs-on: ubuntu-latest | |
steps: | |
- name: Deploy to GitHub Pages | |
id: deployment | |
uses: actions/deploy-pages@v4 | |
with: | |
artifact_name: github-pages | |
preview: true # Not yet available to the public. |