Skip to content

Commit a137cf1

Browse files
committed
add script to run py files
1 parent 1dc42cd commit a137cf1

File tree

2 files changed

+40
-0
lines changed

2 files changed

+40
-0
lines changed

.github/workflows/wasm_test.yml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,3 +40,8 @@ jobs:
4040
run: |
4141
source .venv-pyodide/bin/activate
4242
python testing/install_pyodide_libs.py
43+
44+
- name: Run python files in pyodide environment
45+
run: |
46+
source .venv-pyodide/bin/activate
47+
bash testing/run_py_files.sh testing/py_files

testing/run_py_files.sh

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
#!/bin/bash
2+
3+
# Exit immediately if a command fails
4+
set -e
5+
6+
# Check if a directory argument is provided
7+
if [ $# -eq 0 ]; then
8+
echo "Usage: $0 <directory>"
9+
exit 1
10+
fi
11+
12+
TARGET_DIR="$1"
13+
14+
# Ensure the directory exists
15+
if [ ! -d "$TARGET_DIR" ]; then
16+
echo "Error: Directory '$TARGET_DIR' does not exist."
17+
exit 1
18+
fi
19+
20+
# Find and execute all Python files
21+
echo "Searching for Python files in $TARGET_DIR..."
22+
PYTHON_FILES=$(find "$TARGET_DIR" -type f -name "*.py")
23+
24+
if [ -z "$PYTHON_FILES" ]; then
25+
echo "No Python files found in $TARGET_DIR"
26+
exit 0
27+
fi
28+
29+
# Run each Python file
30+
for file in $PYTHON_FILES; do
31+
echo " Running: $file"
32+
MPLBACKEND=Agg python "$file"
33+
done
34+
35+
echo "✅ All scripts ran successfully!"

0 commit comments

Comments
 (0)