-
Notifications
You must be signed in to change notification settings - Fork 0
67 lines (57 loc) · 2.11 KB
/
Copy pathtesting.yml
File metadata and controls
67 lines (57 loc) · 2.11 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
name: Python Testing Demo - Automated Tests
on:
push:
branches: [main, develop]
pull_request:
branches: [main]
workflow_dispatch: # Allow manual trigger
jobs:
test:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: ["3.9", "3.10", "3.11", "3.12", "3.13", "3.14"]
steps:
- name: 🛒 Checkout code
uses: actions/checkout@v4
- name: 🐍 Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
- name: 📦 Install dependencies
run: |
python -m pip install --upgrade pip
pip install pytest pytest-html pytest-cov
- name: 🧪 Run tests with coverage
run: |
mkdir -p reports
pytest test_main.py -v \
--html=reports/test_report_python${{ matrix.python-version }}.html \
--self-contained-html \
--cov=main \
--cov-report=html:reports/coverage_python${{ matrix.python-version }} \
--cov-report=xml:reports/coverage_python${{ matrix.python-version }}.xml \
--junit-xml=reports/junit_python${{ matrix.python-version }}.xml
- name: 📊 Upload test results
uses: actions/upload-artifact@v4
if: always()
with:
name: test-results-python${{ matrix.python-version }}
path: reports/
retention-days: 30
summary:
needs: test
runs-on: ubuntu-latest
if: always()
steps:
- name: 🎉 All tests completed
run: |
echo "## 🧪 Test Summary" >> $GITHUB_STEP_SUMMARY
echo "- **Status**: ${{ needs.test.result }}" >> $GITHUB_STEP_SUMMARY
echo "- **Python versions tested**: 3.9, 3.10, 3.11, 3.12" >> $GITHUB_STEP_SUMMARY
echo "- **Reports**: Available in job artifacts" >> $GITHUB_STEP_SUMMARY
if [ "${{ needs.test.result }}" == "success" ]; then
echo "✅ All tests passed across all Python versions!"
else
echo "❌ Some tests failed. Check the individual job logs for details."
fi