diff --git a/.github/workflows/notebooks.yml b/.github/workflows/notebooks.yml new file mode 100644 index 0000000..1f174be --- /dev/null +++ b/.github/workflows/notebooks.yml @@ -0,0 +1,33 @@ +name: Reproduce notebooks + +on: + push: + branches: [main] + pull_request: + +permissions: + contents: read + +jobs: + execute: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - uses: actions/setup-python@v5 + with: + python-version: "3.11" + cache: pip + - name: Install dependencies + run: python -m pip install -r requirements.txt + - name: Execute every study from a clean kernel + env: + MPLBACKEND: Agg + run: | + mkdir -p /tmp/executed-notebooks + for notebook in notebooks/*.ipynb; do + jupyter nbconvert \ + --to notebook \ + --execute "$notebook" \ + --output-dir /tmp/executed-notebooks \ + --ExecutePreprocessor.timeout=300 + done diff --git a/READMe.md b/READMe.md index 6241d5c..e90b69a 100644 --- a/READMe.md +++ b/READMe.md @@ -1,5 +1,7 @@ # Surrogate Model Learning +[![Reproduce notebooks](https://github.com/triasha72/Surrogate-model-learning/actions/workflows/notebooks.yml/badge.svg)](https://github.com/triasha72/Surrogate-model-learning/actions/workflows/notebooks.yml) + Learning surrogate modeling from scratch — starting with the basics and working toward real engineering applications. @@ -114,6 +116,10 @@ pip install -r requirements.txt jupyter notebook ``` +Every notebook is also executed from a clean kernel in GitHub Actions. This +checks that the committed studies can be reproduced with the pinned dependency +versions instead of relying on variables left in an interactive session. + ## Notebooks | Notebook | Topic | Key Result | diff --git a/Requirements.txt b/Requirements.txt deleted file mode 100644 index 10610e1..0000000 --- a/Requirements.txt +++ /dev/null @@ -1,19 +0,0 @@ -numpy -scipy -matplotlib -jupyter -scikit-learn -pyDOE2 - -## Installation - -Create environment and install dependencies: - -pip install -r requirements.txt - -numpy==1.26.4 -scipy==1.11.4 -matplotlib==3.8.2 -scikit-learn==1.4.0 -pyDOE2==1.3.0 -jupyter==1.0.0ß \ No newline at end of file diff --git a/requirements.txt b/requirements.txt new file mode 100644 index 0000000..8fb2859 --- /dev/null +++ b/requirements.txt @@ -0,0 +1,7 @@ +numpy==1.26.4 +scipy==1.11.4 +matplotlib==3.8.2 +scikit-learn==1.4.0 +pyDOE2==1.3.0 +jupyter==1.0.0 +ipython==8.22.1