-
Notifications
You must be signed in to change notification settings - Fork 19
134 lines (129 loc) · 3.98 KB
/
main.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
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 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/github-pages-deploy-action@4.1.7
with:
branch: pages
folder: docs/build/html