Skip to content

Commit b1ceb14

Browse files
authored
add run-examples workflow (#576)
* add run-examples workflow * fix ruff * run all examples in parallel --------- Co-authored-by: Walter Simson <waltsims@users.noreply.github.com>
1 parent 93cb6b3 commit b1ceb14

2 files changed

Lines changed: 51 additions & 1 deletion

File tree

.github/workflows/run-examples.yml

Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
name: Run K-Wave Examples
2+
3+
on:
4+
schedule:
5+
- cron: '0 0 * * 1' # Every Monday at 00:00 UTC
6+
workflow_dispatch: # Manual trigger
7+
8+
jobs:
9+
discover-examples:
10+
runs-on: ubuntu-latest
11+
outputs:
12+
example_paths: ${{ steps.find-examples.outputs.examples }}
13+
steps:
14+
- uses: actions/checkout@v4
15+
- id: find-examples
16+
run: |
17+
# Find all Python files in examples subdirectories
18+
EXAMPLES=$(find examples -name "*.py" -not -path "*/\.*" | jq -R -s -c 'split("\n")[:-1]')
19+
echo "examples=$EXAMPLES" >> "$GITHUB_OUTPUT"
20+
21+
run-examples:
22+
needs: discover-examples
23+
runs-on: ubuntu-latest
24+
timeout-minutes: 60 # 1 hour timeout per example
25+
strategy:
26+
fail-fast: false # Continue running other examples even if one fails
27+
matrix:
28+
example: ${{ fromJson(needs.discover-examples.outputs.example_paths) }}
29+
30+
steps:
31+
- name: Checkout repository
32+
uses: actions/checkout@v4
33+
34+
- name: Set up Python
35+
uses: actions/setup-python@v5
36+
with:
37+
python-version: '3.10' # Matches requires-python from pyproject.toml
38+
cache: 'pip'
39+
40+
- name: Install dependencies
41+
run: |
42+
python -m pip install --upgrade pip
43+
# Install the package with example dependencies
44+
pip install -e ".[example]"
45+
46+
- name: Run example
47+
env:
48+
KWAVE_FORCE_CPU: 1
49+
run: |
50+
echo "Running example: ${{ matrix.example }}"
51+
python "${{ matrix.example }}"

tests/test_create_pixel_dim.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
import pytest
21
import numpy as np
32

43
from kwave.utils.mapgen import create_pixel_dim

0 commit comments

Comments
 (0)