update docs #171
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: main | |
on: | |
workflow_dispatch: | |
pull_request: | |
push: | |
branches: | |
- main | |
paths-ignore: | |
- ".github/**" | |
- "!.github/workflows/main.yml" | |
- "docs/**" | |
- "*.md" | |
- ".git*" | |
jobs: | |
clean: | |
runs-on: ubuntu-latest | |
container: | |
image: condaforge/mambaforge | |
volumes: | |
- ${{ github.workspace }}:/github/workspace | |
steps: | |
- name: Checkout | |
uses: actions/checkout@master | |
- name: Install Dependencies | |
run: mamba install nbstripout | |
- name: Clean notebooks | |
run: find . -name "*.ipynb" | xargs nbstripout | |
- name: Check if git status is clean | |
run: | | |
if [ ! -z "$(git status --porcelain)" ]; then | |
echo "Notebooks are not cleaned! They still contain outputs and/or metadata." | |
echo "You probably forgot to clear the notebook outputs before pushing." | |
echo "Please make sure all pre-commit hooks are properly installed to prevent this issue." | |
false; | |
fi | |
test: | |
runs-on: ubuntu-latest | |
container: | |
image: condaforge/mambaforge | |
volumes: | |
- ${{ github.workspace }}:/github/workspace | |
steps: | |
- name: Checkout | |
uses: actions/checkout@master | |
- name: Install Library | |
run: pip install --upgrade pip && pip install --use-deprecated=legacy-resolver '.[dev]' | |
- name: Test notebooks | |
run: pytest | |
- name: Expose 'tests' as artifact | |
uses: actions/upload-artifact@master | |
with: | |
name: tests | |
path: /github/workspace/tests | |
run: | |
runs-on: ubuntu-latest | |
container: | |
image: condaforge/mambaforge | |
volumes: | |
- ${{ github.workspace }}:/github/workspace | |
env: | |
PYDEVD_DISABLE_FILE_VALIDATION: 1 | |
steps: | |
- name: Checkout | |
uses: actions/checkout@master | |
- name: Install Dependencies | |
run: mamba install -y python=3.11 parallel gdspy gdstk pymeep=\*=mpi_mpich_\* ipykernel ipywidgets ipympl ipyevents | |
- name: Install Library | |
run: pip install --upgrade pip && pip install --use-deprecated=legacy-resolver '.[dev]' | |
- name: Run source notebooks | |
run: find . -name "*.ipynb" -not -path "*/tests/*" -not -path "*/.ipynb_checkpoints/*" | xargs -I {} papermill {} {} -k python3 | |
- name: Expose 'internals' as artifact | |
uses: actions/upload-artifact@master | |
with: | |
name: internals | |
path: /github/workspace/internals | |
- name: Expose 'examples' as artifact | |
uses: actions/upload-artifact@master | |
with: | |
name: examples | |
path: /github/workspace/examples | |
docs: | |
runs-on: ubuntu-latest | |
needs: | |
- run | |
container: | |
image: condaforge/mambaforge | |
volumes: | |
- ${{ github.workspace }}:/github/workspace | |
steps: | |
- name: Checkout | |
uses: actions/checkout@master | |
- name: Install Dependencies | |
run: mamba install -y make | |
- name: Install Library | |
run: pip install --upgrade pip && pip install --use-deprecated=legacy-resolver '.[dev]' | |
- name: Download 'internals' artifact | |
uses: actions/download-artifact@master | |
with: | |
name: internals | |
path: ./internals | |
- name: Download 'examples' artifact | |
uses: actions/download-artifact@master | |
with: | |
name: examples | |
path: ./examples | |
- name: Build docs | |
run: cd docs && make html | |
- name: Store artifacts | |
uses: actions/upload-artifact@master | |
with: | |
name: docs | |
path: /github/workspace/docs/build/html | |
pages: | |
runs-on: ubuntu-latest | |
needs: | |
- docs | |
steps: | |
- name: Checkout | |
uses: actions/checkout@master | |
- name: Download 'docs' artifact | |
uses: actions/download-artifact@master | |
with: | |
name: docs | |
path: docs/build/html | |
- name: Deploy | |
uses: JamesIves/[email protected] | |
with: | |
branch: pages | |
folder: docs/build/html |