-
Notifications
You must be signed in to change notification settings - Fork 0
62 lines (52 loc) · 1.73 KB
/
test.yml
File metadata and controls
62 lines (52 loc) · 1.73 KB
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
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
name: Test
on:
push:
branches: [main]
pull_request:
branches: [main]
jobs:
smoke-test:
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-latest, macos-latest]
python-version: ["3.10", "3.11", "3.12", "3.13"]
steps:
- uses: actions/checkout@v4
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
- name: Install dependencies
run: pip install matplotlib numpy
- name: Test basic execution
run: |
python3 scripts/run.py --code "print('hello world')" --no-header
- name: Test math
run: |
python3 scripts/run.py --code "
import math
data = list(range(1, 11))
mean = sum(data) / len(data)
std = math.sqrt(sum((x-mean)**2 for x in data) / len(data))
print(f'mean={mean}, std={std:.4f}')
" --no-header
- name: Test matplotlib (non-interactive)
run: |
python3 scripts/run.py --code "
import matplotlib
matplotlib.use('Agg')
import matplotlib.pyplot as plt
import numpy as np
x = np.linspace(0, 2*3.14159, 50)
plt.plot(x, np.sin(x))
plt.savefig('/tmp/test_chart.png', dpi=72)
print('chart ok')
" --no-header
- name: Test file execution
run: |
echo "print('file exec ok')" > /tmp/test_file.py
python3 scripts/run.py --file /tmp/test_file.py --no-header
- name: Test error handling
run: |
python3 scripts/run.py --code "raise ValueError('intentional error')" && exit 1 || echo "Error correctly propagated"