Skip to content

Commit 9f3bc7d

Browse files
committed
Configured a continuous integration (CI) workflow
1 parent e3f48ad commit 9f3bc7d

29 files changed

+214
-48130
lines changed

.github/workflows/ci.yml

Lines changed: 132 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,132 @@
1+
name: CI
2+
3+
on:
4+
pull_request:
5+
push:
6+
workflow_dispatch:
7+
8+
permissions:
9+
contents: read
10+
11+
env:
12+
ENV_NAME: aenet-torch
13+
PYTHON_VERSION: "3.11"
14+
15+
jobs:
16+
unit-tests:
17+
name: Unit Tests
18+
runs-on: ubuntu-latest
19+
20+
steps:
21+
- name: Check out repository
22+
uses: actions/checkout@v4
23+
24+
- name: Set up micromamba environment
25+
uses: mamba-org/setup-micromamba@v2
26+
with:
27+
environment-name: ${{ env.ENV_NAME }}
28+
create-args: >-
29+
python=${{ env.PYTHON_VERSION }}
30+
pip
31+
cache-environment: true
32+
cache-downloads: true
33+
init-shell: bash
34+
35+
- name: Install project and dependencies
36+
run: |
37+
micromamba run -n "${ENV_NAME}" python -m pip install --upgrade pip
38+
micromamba run -n "${ENV_NAME}" python -m pip install -e ".[dev,torch]"
39+
40+
- name: Run general pytest suite
41+
run: |
42+
micromamba run -n "${ENV_NAME}" pytest -q -m "not docs_examples"
43+
44+
docs:
45+
name: Docs
46+
runs-on: ubuntu-latest
47+
48+
steps:
49+
- name: Check out repository
50+
uses: actions/checkout@v4
51+
52+
- name: Set up micromamba environment
53+
uses: mamba-org/setup-micromamba@v2
54+
with:
55+
environment-name: ${{ env.ENV_NAME }}
56+
create-args: >-
57+
python=${{ env.PYTHON_VERSION }}
58+
pip
59+
cache-environment: true
60+
cache-downloads: true
61+
init-shell: bash
62+
63+
- name: Install project and dependencies
64+
run: |
65+
micromamba run -n "${ENV_NAME}" python -m pip install --upgrade pip
66+
micromamba run -n "${ENV_NAME}" python -m pip install -e ".[dev,torch]"
67+
68+
- name: Run pytest docs examples
69+
run: |
70+
micromamba run -n "${ENV_NAME}" pytest -q -m docs_examples
71+
72+
- name: Run Sphinx doctest
73+
run: |
74+
micromamba run -n "${ENV_NAME}" \
75+
python -m sphinx -b doctest docs/source docs/build/doctest
76+
77+
- name: Run warning-clean Sphinx HTML build
78+
run: |
79+
micromamba run -n "${ENV_NAME}" \
80+
python -m sphinx -W --keep-going -b html docs/source docs/build/html
81+
82+
notebooks:
83+
name: Notebook (${{ matrix.notebook_name }})
84+
runs-on: ubuntu-latest
85+
strategy:
86+
fail-fast: false
87+
matrix:
88+
include:
89+
- notebook: notebooks/example-01-featurization.ipynb
90+
notebook_name: example-01-featurization
91+
- notebook: notebooks/example-04-torch-featurization.ipynb
92+
notebook_name: example-04-torch-featurization
93+
- notebook: notebooks/example-05-torch-training.ipynb
94+
notebook_name: example-05-torch-training
95+
- notebook: notebooks/example-06-torch-inference.ipynb
96+
notebook_name: example-06-torch-inference
97+
- notebook: notebooks/example-07-neighbor-list.ipynb
98+
notebook_name: example-07-neighbor-list
99+
100+
steps:
101+
- name: Check out repository
102+
uses: actions/checkout@v4
103+
104+
- name: Set up micromamba environment
105+
uses: mamba-org/setup-micromamba@v2
106+
with:
107+
environment-name: ${{ env.ENV_NAME }}
108+
create-args: >-
109+
python=${{ env.PYTHON_VERSION }}
110+
pip
111+
cache-environment: true
112+
cache-downloads: true
113+
init-shell: bash
114+
115+
- name: Install project and dependencies
116+
run: |
117+
micromamba run -n "${ENV_NAME}" python -m pip install --upgrade pip
118+
micromamba run -n "${ENV_NAME}" python -m pip install -e ".[dev,torch]"
119+
120+
- name: Prepare disposable notebook worktree
121+
run: |
122+
mkdir -p "${RUNNER_TEMP}/notebook-worktree"
123+
rsync -a --delete --exclude ".git" ./ "${RUNNER_TEMP}/notebook-worktree/"
124+
125+
- name: Execute notebook
126+
run: |
127+
mkdir -p "${RUNNER_TEMP}/executed-notebooks"
128+
micromamba run -n "${ENV_NAME}" \
129+
python -m jupyter nbconvert --to notebook --execute \
130+
"${RUNNER_TEMP}/notebook-worktree/${{ matrix.notebook }}" \
131+
--output-dir "${RUNNER_TEMP}/executed-notebooks" \
132+
--ExecutePreprocessor.timeout=600

.gitignore

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,16 @@ profiling/
1414
outputs/
1515
.virtual_documents
1616

17+
# Notebook-generated outputs
18+
notebooks/features.h5
19+
notebooks/features_torch.h5
20+
notebooks/generate.out
21+
notebooks/predict.out
22+
notebooks/run/
23+
notebooks/example-01-outputs/
24+
notebooks/example-05-outputs/
25+
notebooks/example-08-outputs/
26+
1727
debug/
1828
profiling/
1929
fortran/

docs/source/api/trainset.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -168,4 +168,4 @@ The implementation maintains full backward compatibility:
168168
See Also
169169
--------
170170

171-
* :doc:`torch_featurization` - PyTorch-based featurization APIs
171+
* :doc:`/usage/torch_featurization` - PyTorch-based featurization APIs

docs/source/dev/docs_examples.rst

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,45 @@ Use a file path for a narrower loop while editing a single page:
4545
/Users/aurban/.local/bin/micromamba run -n aenet-torch \
4646
pytest -q src/aenet/geometry/tests/test_docs_transformations_basic.py
4747
48+
Run the maintained notebook-first examples without mutating tracked notebooks:
49+
50+
.. code-block:: bash
51+
52+
mkdir -p /tmp/aenet-doc-notebooks
53+
/Users/aurban/.local/bin/micromamba run -n aenet-torch \
54+
python -m jupyter nbconvert --to notebook --execute \
55+
notebooks/example-01-featurization.ipynb \
56+
--output-dir /tmp/aenet-doc-notebooks
57+
58+
Repeat the same pattern for:
59+
60+
- ``notebooks/example-04-torch-featurization.ipynb``
61+
- ``notebooks/example-05-torch-training.ipynb``
62+
- ``notebooks/example-06-torch-inference.ipynb``
63+
- ``notebooks/example-07-neighbor-list.ipynb``
64+
65+
This avoids overwriting the source ``.ipynb`` files. Some notebooks still
66+
write side-effect artifacts such as HDF5 files or checkpoints relative to the
67+
notebook directory, so use a disposable worktree or temporary copy when you
68+
need a perfectly clean checkout.
69+
70+
CI Coverage
71+
-----------
72+
73+
The repository CI is split into three layers so failures are easy to localize:
74+
75+
- general unit tests: ``pytest -q -m "not docs_examples"``
76+
- docs checks: ``pytest -q -m docs_examples`` plus Sphinx doctest and
77+
warning-clean HTML builds
78+
- notebook checks: execution of the maintained notebook-first examples listed
79+
above via ``nbconvert --execute`` from a disposable worktree with a
80+
temporary output directory
81+
82+
Repo-wide ``ruff check .`` is intentionally not a required CI gate yet because
83+
the repository still has a substantial backlog of pre-existing lint violations.
84+
Treat lint as a follow-up ratchet by directory or subsystem rather than
85+
blocking the initial test/docs CI path on legacy cleanup.
86+
4887
Authoring Policy
4988
----------------
5089

-13.8 MB
Binary file not shown.

0 commit comments

Comments
 (0)