-
Notifications
You must be signed in to change notification settings - Fork 0
97 lines (80 loc) · 2.79 KB
/
validate_examples.yml
File metadata and controls
97 lines (80 loc) · 2.79 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
86
87
88
89
90
91
92
93
94
95
96
97
name: Validate R Equivalence
on:
push:
branches: [ main, develop ]
pull_request:
branches: [ main ]
schedule:
# Run weekly on Mondays at 9 AM UTC
- cron: '0 9 * * 1'
jobs:
validate:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: '3.9'
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install -e .
pip install pandas numpy requests
- name: Run comprehensive example validator
env:
CANCENSUS_API_KEY: ${{ secrets.CANCENSUS_API_KEY }}
run: |
python3 comprehensive_example_validator.py > validation_output.txt 2>&1
cat validation_output.txt
- name: Check validation results
run: |
# Extract pass/fail/skip counts from output
PASSED=$(grep "✅ PASSED:" validation_output.txt | awk '{print $3}')
FAILED=$(grep "❌ FAILED:" validation_output.txt | awk '{print $3}')
SKIPPED=$(grep "⏭️ SKIPPED:" validation_output.txt | awk '{print $3}')
TOTAL=$(grep "📝 TOTAL:" validation_output.txt | awk '{print $3}')
echo "Validation Results:"
echo " Passed: $PASSED"
echo " Failed: $FAILED"
echo " Skipped: $SKIPPED"
echo " Total: $TOTAL"
# Fail if there are any actual failures
if [ "$FAILED" -gt 0 ]; then
echo "❌ $FAILED test(s) failed!"
exit 1
fi
# If all tests passed or were skipped (no failures), success
if [ "$PASSED" -gt 0 ]; then
echo "✅ All $PASSED executed tests passed ($SKIPPED skipped)"
else
echo "⚠️ All tests skipped (R not available) - no failures"
fi
- name: Upload validation report
if: always()
uses: actions/upload-artifact@v4
with:
name: validation-report
path: validation_output.txt
retention-days: 30
- name: Comment PR with results
if: github.event_name == 'pull_request'
uses: actions/github-script@v6
with:
script: |
const fs = require('fs');
const output = fs.readFileSync('validation_output.txt', 'utf8');
// Extract summary
const summaryMatch = output.match(/VALIDATION SUMMARY[\s\S]*?={70}/);
const summary = summaryMatch ? summaryMatch[0] : 'Summary not found';
const comment = `## 🧪 R Equivalence Validation Results
\`\`\`
${summary}
\`\`\`
See full validation report in artifacts.`;
github.rest.issues.createComment({
issue_number: context.issue.number,
owner: context.repo.owner,
repo: context.repo.repo,
body: comment
});