-
Notifications
You must be signed in to change notification settings - Fork 26
85 lines (72 loc) · 2.68 KB
/
notebook-tests.yml
File metadata and controls
85 lines (72 loc) · 2.68 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
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
name: Notebook Tests
on:
push:
branches: [main]
pull_request:
branches: [main]
workflow_dispatch:
jobs:
test:
name: Validation & Tests
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: '3.12'
cache: 'pip'
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install -e ".[test]"
- name: Run validation tests
run: |
pytest tests/validation/ -v --tb=short --junit-xml=validation-results.xml | tee validation-output.txt
continue-on-error: true
- name: Run smoke tests
run: |
pytest tests/examples/ -v --tb=short --junit-xml=smoke-results.xml | tee smoke-output.txt
continue-on-error: true
- name: Check test results
run: |
# Fail the workflow if any tests failed (excluding validation warnings)
grep -q "failed" validation-output.txt && exit 1 || true
grep -q "failed" smoke-output.txt && exit 1 || true
exit 0
- name: Upload test results
if: always()
uses: actions/upload-artifact@v4
with:
name: test-results
path: |
validation-results.xml
smoke-results.xml
validation-output.txt
smoke-output.txt
retention-days: 7
- name: Generate test summary
if: always()
run: |
echo "## Test Results" >> $GITHUB_STEP_SUMMARY
echo "" >> $GITHUB_STEP_SUMMARY
# Extract validation warnings section
echo "### Validation Tests" >> $GITHUB_STEP_SUMMARY
echo "" >> $GITHUB_STEP_SUMMARY
# Check if there are validation warnings
if grep -q "Validation Warnings Summary" validation-output.txt; then
echo "**Validation Warnings Found:**" >> $GITHUB_STEP_SUMMARY
echo "" >> $GITHUB_STEP_SUMMARY
echo '```' >> $GITHUB_STEP_SUMMARY
sed -n '/Validation Warnings Summary/,/passed\|failed\|error/p' validation-output.txt | head -n -1 >> $GITHUB_STEP_SUMMARY
echo '```' >> $GITHUB_STEP_SUMMARY
else
echo "No validation warnings." >> $GITHUB_STEP_SUMMARY
fi
echo "" >> $GITHUB_STEP_SUMMARY
# Show test result summary line
echo "**Result:** $(tail -n 1 validation-output.txt)" >> $GITHUB_STEP_SUMMARY
echo "" >> $GITHUB_STEP_SUMMARY
echo "### Smoke Tests" >> $GITHUB_STEP_SUMMARY
echo "**Result:** $(tail -n 1 smoke-output.txt)" >> $GITHUB_STEP_SUMMARY