Skip to content

Commit 159d6b6

Browse files
committed
update deploy workflow to run tests and serve them as docs
1 parent 53e5325 commit 159d6b6

File tree

1 file changed

+138
-4
lines changed

1 file changed

+138
-4
lines changed

.github/workflows/deploy.yml

Lines changed: 138 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,128 @@ on:
55
branches: [ main ]
66

77
jobs:
8+
# Run all the test jobs first
9+
arithmetic:
10+
runs-on: ubuntu-latest
11+
steps:
12+
- uses: actions/checkout@v4
13+
- name: Conda config
14+
run: echo -e "channels:\n - conda-forge\n" > .condarc
15+
- uses: conda-incubator/setup-miniconda@v3
16+
with:
17+
python-version: "3.12"
18+
miniforge-version: latest
19+
condarc-file: .condarc
20+
environment-file: binder/environment.yml
21+
- name: Installation and setup
22+
shell: bash -l {0}
23+
run: |
24+
pip install --no-deps --no-build-isolation -e .
25+
conda install -c conda-forge jupyter papermill
26+
verdi presto --profile-name pwd
27+
- name: Tests
28+
shell: bash -l {0}
29+
run: |
30+
cd example_workflows/arithmetic
31+
papermill aiida.ipynb aiida_out.ipynb -k "python3"
32+
papermill cwl.ipynb cwl_out.ipynb -k "python3"
33+
papermill jobflow.ipynb jobflow_out.ipynb -k "python3"
34+
papermill pyiron_base.ipynb pyiron_base_out.ipynb -k "python3"
35+
papermill pyiron_workflow.ipynb pyiron_workflow_out.ipynb -k "python3"
36+
papermill universal_workflow.ipynb universal_workflow_out.ipynb -k "python3"
37+
- name: Upload executed notebooks
38+
uses: actions/upload-artifact@v4
39+
with:
40+
name: arithmetic-notebooks
41+
path: example_workflows/arithmetic/*_out.ipynb
42+
retention-days: 1
43+
44+
quantumespresso:
45+
runs-on: ubuntu-latest
46+
steps:
47+
- uses: actions/checkout@v4
48+
- name: Setup environment
49+
shell: bash -l {0}
50+
run: |
51+
echo -e "channels:\n - conda-forge\n" > .condarc
52+
tail --lines=+4 example_workflows/quantum_espresso/environment.yml >> binder/environment.yml
53+
- uses: conda-incubator/setup-miniconda@v3
54+
with:
55+
python-version: "3.12"
56+
miniforge-version: latest
57+
condarc-file: .condarc
58+
environment-file: binder/environment.yml
59+
- name: Installation and setup
60+
shell: bash -l {0}
61+
run: |
62+
pip install --no-deps --no-build-isolation -e example_workflows/quantum_espresso/qe_xml_parser
63+
pip install --no-deps --no-build-isolation -e .
64+
conda install -c conda-forge jupyter papermill
65+
verdi presto --profile-name pwd
66+
- name: Tests
67+
shell: bash -l {0}
68+
run: |
69+
export ESPRESSO_PSEUDO=$(pwd)/espresso/pseudo
70+
cp -r example_workflows/quantum_espresso/espresso .
71+
cd example_workflows/quantum_espresso
72+
papermill aiida.ipynb aiida_out.ipynb -k "python3"
73+
papermill cwl.ipynb cwl_out.ipynb -k "python3"
74+
papermill jobflow.ipynb jobflow_out.ipynb -k "python3"
75+
papermill pyiron_base.ipynb pyiron_base_out.ipynb -k "python3"
76+
papermill pyiron_workflow.ipynb pyiron_workflow_out.ipynb -k "python3"
77+
papermill universal_workflow.ipynb universal_workflow_out.ipynb -k "python3"
78+
- name: Upload executed notebooks
79+
uses: actions/upload-artifact@v4
80+
with:
81+
name: quantumespresso-notebooks
82+
path: example_workflows/quantum_espresso/*_out.ipynb
83+
retention-days: 1
84+
85+
nfdi4ing:
86+
runs-on: ubuntu-22.04
87+
steps:
88+
- uses: actions/checkout@v4
89+
- name: Conda config
90+
run: echo -e "channels:\n - conda-forge\n" > .condarc
91+
- uses: conda-incubator/setup-miniconda@v3
92+
with:
93+
python-version: "3.12"
94+
miniforge-version: latest
95+
condarc-file: .condarc
96+
environment-file: binder/environment.yml
97+
- name: Installation and setup
98+
shell: bash -l {0}
99+
run: |
100+
pip install --no-deps --no-build-isolation -e .
101+
conda install -c conda-forge jupyter papermill
102+
verdi presto --profile-name pwd
103+
sudo apt-get install -y $(cat binder/apt.txt)
104+
- name: Create Additional Conda Environments
105+
shell: bash -l {0}
106+
run: |
107+
conda env create -n preprocessing -f example_workflows/nfdi/source/envs/preprocessing.yaml -y
108+
conda env create -n processing -f example_workflows/nfdi/source/envs/processing.yaml -y
109+
conda env create -n postprocessing -f example_workflows/nfdi/source/envs/postprocessing.yaml -y
110+
- name: Tests
111+
shell: bash -l {0}
112+
run: |
113+
cd example_workflows/nfdi/
114+
papermill aiida.ipynb aiida_out.ipynb -k "python3"
115+
papermill cwl.ipynb cwl_out.ipynb -k "python3"
116+
papermill jobflow.ipynb jobflow_out.ipynb -k "python3"
117+
papermill pyiron_base.ipynb pyiron_base_out.ipynb -k "python3"
118+
papermill pyiron_workflow.ipynb pyiron_workflow_out.ipynb -k "python3"
119+
papermill universal_workflow.ipynb universal_workflow_out.ipynb -k "python3"
120+
- name: Upload executed notebooks
121+
uses: actions/upload-artifact@v4
122+
with:
123+
name: nfdi-notebooks
124+
path: example_workflows/nfdi/*_out.ipynb
125+
retention-days: 1
126+
8127
documentation:
9128
runs-on: ubuntu-latest
129+
needs: [arithmetic, quantumespresso, nfdi4ing]
10130
steps:
11131
- uses: actions/checkout@v4
12132
- name: Conda config
@@ -17,7 +137,21 @@ jobs:
17137
miniforge-version: latest
18138
condarc-file: .condarc
19139
environment-file: documentation/environment.yml
20-
- name: Install Jupyterbook
140+
- name: Download executed notebooks
141+
uses: actions/download-artifact@v4
142+
with:
143+
path: executed-notebooks
144+
- name: Copy executed notebooks to their locations
145+
run: |
146+
# Copy arithmetic notebooks
147+
cp executed-notebooks/arithmetic-notebooks/*.ipynb example_workflows/arithmetic/
148+
149+
# Copy quantum espresso notebooks
150+
cp executed-notebooks/quantumespresso-notebooks/*.ipynb example_workflows/quantum_espresso/
151+
152+
# Copy nfdi notebooks
153+
cp executed-notebooks/nfdi-notebooks/*.ipynb example_workflows/nfdi/
154+
- name: Build Jupyterbook
21155
shell: bash -l {0}
22156
run: |
23157
cp documentation/_config.yml .
@@ -30,6 +164,6 @@ jobs:
30164
uses: JamesIves/github-pages-deploy-action@3.7.1
31165
with:
32166
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
33-
BRANCH: gh-pages # The branch the action should deploy to.
34-
FOLDER: public_html # The folder the action should deploy.
35-
CLEAN: true
167+
BRANCH: gh-pages
168+
FOLDER: public_html
169+
CLEAN: true

0 commit comments

Comments
 (0)