Skip to content

Add terse links for gradient-based calculation using graph-based collection definition #501

Add terse links for gradient-based calculation using graph-based collection definition

Add terse links for gradient-based calculation using graph-based collection definition #501

name: CI/CD test suite
on:
push:
branches:
- '*'
pull_request:
branches:
- '*'
jobs:
setup-install:
name: Setup and install Ard
strategy:
matrix:
python-version: [3.12] # ["3.10", "3.11", "3.12", "3.13"]
os: [macos-latest, ubuntu-latest, windows-latest]
include:
- os: ubuntu-latest
path: ~/.cache/pip
- os: macos-latest
path: ~/Library/Caches/pip
- os: windows-latest
path: ~\AppData\Local\pip\Cache
runs-on: ${{ matrix.os }}
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Cache dependencies
id: cache
uses: actions/cache@v4
with:
path: ${{ matrix.path }}
key: ${{ runner.os }}-pip-${{ hashFiles('requirements.txt') }}
restore-keys:
${{ runner.os }}-pip-
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
- name: Install dependencies
run: |
python -m pip install --upgrade pip
- name: Install Ard
run: |
pip install .[dev]
test-unit:
name: Run unit tests
needs: setup-install
strategy:
matrix:
python-version: [3.12] # ["3.10", "3.11", "3.12", "3.13"]
os: [macos-latest, ubuntu-latest, windows-latest]
include:
- os: ubuntu-latest
path: ~/.cache/pip
- os: macos-latest
path: ~/Library/Caches/pip
- os: windows-latest
path: ~\AppData\Local\pip\Cache
runs-on: ${{ matrix.os }}
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
- name: Get cache dependencies
id: cache
uses: actions/cache@v4
with:
path: ${{ matrix.path }}
key: ${{ runner.os }}-pip-${{ hashFiles('requirements.txt') }}
restore-keys:
${{ runner.os }}-pip-
- name: Install dependencies
run: |
python -m pip install --upgrade pip
- name: Install Ard
run: |
pip install .[dev]
- name: Run unit tests with coverage
run: |
pytest --cov=ard --cov-fail-under=80 test/ard/unit
test-system:
name: Run system tests
needs: test-unit
strategy:
matrix:
python-version: [3.12] # ["3.10", "3.11", "3.12", "3.13"]
os: [macos-latest, ubuntu-latest, windows-latest]
include:
- os: ubuntu-latest
path: ~/.cache/pip
- os: macos-latest
path: ~/Library/Caches/pip
- os: windows-latest
path: ~\AppData\Local\pip\Cache
runs-on: ${{ matrix.os }}
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
- name: Get cache dependencies
id: cache
uses: actions/cache@v4
with:
path: ${{ matrix.path }}
key: ${{ runner.os }}-pip-${{ hashFiles('requirements.txt') }}
restore-keys:
${{ runner.os }}-pip-
- name: Install dependencies
run: |
python -m pip install --upgrade pip
- name: Install Ard
run: |
pip install .[dev]
- name: Run system tests with coverage
run: |
pytest --cov=ard --cov-fail-under=50 test/ard/system
# pytest --cov=ard --cov-fail-under=80 test/ard/system
find-examples:
name: Find all examples
needs: [test-unit, test-system]
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
- name: Find example python scripts
id: find_scripts
run: |
echo "scripts<<EOF" >> $GITHUB_OUTPUT
find examples -mindepth 2 -maxdepth 2 -name "*.py" | jq -R -s -c 'split("\n")[:-1]' >> $GITHUB_OUTPUT
echo "EOF" >> $GITHUB_OUTPUT
outputs:
scripts: ${{ steps.find_scripts.outputs.scripts }}
test-examples:
name: Run all examples
needs: find-examples
if: needs.find-examples.outputs.scripts != '[]' # skip empty
strategy:
fail-fast: false
matrix:
python-version: [3.12] # ["3.10", "3.11", "3.12", "3.13"]
os: [macos-latest, ubuntu-latest, windows-latest]
include:
- os: ubuntu-latest
path: ~/.cache/pip
- os: macos-latest
path: ~/Library/Caches/pip
- os: windows-latest
path: ~\AppData\Local\pip\Cache
script: ${{fromJson(needs.find-examples.outputs.scripts)}}
runs-on: ${{ matrix.os }}
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
- name: Get cache dependencies
id: cache
uses: actions/cache@v4
with:
path: ${{ matrix.path }}
key: ${{ runner.os }}-pip-${{ hashFiles('requirements.txt') }}
restore-keys:
${{ runner.os }}-pip-
- name: Install dependencies
run: |
python -m pip install --upgrade pip
- name: Install Ard
run: |
pip install .[dev]
- name: Run examples
shell: python
run: |
import os
import pathlib
import subprocess
env = os.environ.copy()
env["MPLBACKEND"] = "Agg" # Non-interactive backend
path_script = pathlib.Path("${{ matrix.script }}").absolute()
print(f"RUNNING {path_script}")
subprocess.run(
["python", str(path_script.name)],
check=True,
cwd=str(path_script.parent),
env=env,
)
find-examples_nb:
name: Find all example notebooks
needs: [test-unit, test-system]
if: needs.find-examples_nb.outputs.scripts != '[]' # skip empty
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
- name: Find example python notebooks
id: find_notebooks
run: |
echo "scripts<<EOF"
find examples -mindepth 2 -maxdepth 2 -name "*.ipynb" | jq -R -s -c 'split("\n")[:-1]'
echo "EOF"
echo "scripts<<EOF" >> $GITHUB_OUTPUT
find examples -mindepth 2 -maxdepth 2 -name "*.ipynb" | jq -R -s -c 'split("\n")[:-1]' >> $GITHUB_OUTPUT
echo "EOF" >> $GITHUB_OUTPUT
outputs:
scripts: ${{ steps.find_notebooks.outputs.scripts }}
test-examples_nb:
name: Run all example notebooks
needs: find-examples_nb
strategy:
fail-fast: false
matrix:
python-version: [3.12] # ["3.10", "3.11", "3.12", "3.13"]
os: [macos-latest, ubuntu-latest, windows-latest]
include:
- os: ubuntu-latest
path: ~/.cache/pip
- os: macos-latest
path: ~/Library/Caches/pip
- os: windows-latest
path: ~\AppData\Local\pip\Cache
script: ${{fromJson( needs.find-examples_nb.outputs.scripts )}}
runs-on: ${{ matrix.os }}
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
- name: Get cache dependencies
id: cache
uses: actions/cache@v4
with:
path: ${{ matrix.path }}
key: ${{ runner.os }}-pip-${{ hashFiles('requirements.txt') }}
restore-keys:
${{ runner.os }}-pip-
- name: Install dependencies
run: |
python -m pip install --upgrade pip
- name: Install Ard
run: |
pip install .[dev]
- name: Run examples
shell: python
run: |
import os
import pathlib
import subprocess
env = os.environ.copy()
env["MPLBACKEND"] = "Agg" # Non-interactive backend
path_script = pathlib.Path("${{ matrix.script }}").absolute()
print(f"RUNNING {path_script}")
subprocess.run(
["jupyter", "nbconvert", "--execute", "--to", "notebook", str(path_script.name)],
check=True,
cwd=str(path_script.parent),
env=env,
)