Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
59 changes: 59 additions & 0 deletions .github/workflows/examples.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
# Runs the examples and notebooks a pull request adds or changes against the latest QuantLibAAD
# release from PyPI; the wheels themselves are only built for changes that go into them
# (quantlib-risks.yml). An example that needs a change to the package itself fails here until
# that change is released.

name: Examples
on:
pull_request:
branches:
- main
paths:
- ".github/workflows/examples.yml"
- "binder/requirements.txt"
- "Python/examples/**"
- "notebooks/**"
workflow_dispatch:

concurrency:
group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }}
cancel-in-progress: true

permissions:
contents: read

jobs:
examples:
name: Examples on the latest release
runs-on: ubuntu-24.04
steps:
- uses: actions/checkout@v7
with:
fetch-depth: 0
persist-credentials: false
- uses: actions/setup-python@v7
with:
python-version: "3.12"
- name: Install the latest QuantLibAAD release
run: pip install -r binder/requirements.txt
- name: Run the changed examples and notebooks
env:
BASE: ${{ github.event.pull_request.base.sha }}
MPLBACKEND: Agg
run: |
# only those the pull request adds or changes; all of them on a manual run or when this
# workflow or the requirements change
if [ -n "$BASE" ] && git diff --quiet "$BASE" HEAD -- .github/workflows/examples.yml binder/requirements.txt; then
files=$(git diff --name-only --diff-filter=AMR "$BASE" HEAD -- 'Python/examples/*.py' 'notebooks/*.ipynb')
else
files=$(ls Python/examples/*.py notebooks/*.ipynb)
fi
python -c "import QuantLibAAD, xad; print('QuantLibAAD', QuantLibAAD.__version__, 'xad', xad.__version__)"
for f in $files; do
echo "::group::$f"
case "$f" in
*.py) (cd "$(dirname "$f")" && python "$(basename "$f")") ;;
*.ipynb) jupyter nbconvert --to notebook --execute --output-dir /tmp/executed "$f" ;;
esac
echo "::endgroup::"
done
18 changes: 17 additions & 1 deletion .github/workflows/quantlib-risks.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# builds only on the following conditions:
# - pull requests into main
# - pull requests into main that change what goes into the wheels (paths below)
# - OR pushes of tags starting with v*
# - OR manual dispatch on repo
# publishes to test pypi if:
Expand All @@ -17,6 +17,22 @@ on:
pull_request:
branches:
- main
# only changes that go into the wheels; examples and notebooks are tested in examples.yml
paths:
- ".github/workflows/quantlib-risks.yml"
- ".gitmodules"
- "CMakeLists.txt"
- "LICENSE.md"
- "pyproject.toml"
- "cmake/**"
- "lib/**"
- "patches/**"
- "tools/**"
- "SWIG/**"
- "Python/CMakeLists.txt"
- "Python/QuantLibAAD/**"
- "Python/README.md"
- "Python/test/**"
push:
tags:
- v*
Expand Down