-
Notifications
You must be signed in to change notification settings - Fork 0
44 lines (32 loc) · 969 Bytes
/
python.yml
File metadata and controls
44 lines (32 loc) · 969 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
name: Python Examples CI
on:
push:
pull_request:
jobs:
check-python-examples:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: "3.11"
- name: Find and check all Python examples
run: |
set -e
if [ ! -d "examples" ]; then
echo "No examples/ directory. Skipping."
exit 0
fi
echo "Searching for Python examples..."
for dir in $(find examples -type f -name "main.py" -exec dirname {} \;); do
echo "=============================="
echo "Checking example in: $dir"
cd $dir
if [ -f "requirements.txt" ]; then
pip install -r requirements.txt
fi
echo "Compiling Python files..."
python -m compileall .
cd - > /dev/null
done