update github workflow #93
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 | |
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 '.[dev]' | |
- name: Test notebooks | |
run: pytest | |
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 parallel gdspy gdstk pymeep=\*=mpi_mpich_\* ipykernel ipywidgets ipympl ipyevents | |
- name: Install Library | |
run: pip install '.[dev]' | |
- name: Run source notebooks | |
run: find . -name "*.ipynb" -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 '.[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/github-pages-deploy-action@4.1.7 | |
with: | |
branch: pages | |
folder: docs/build/html |