-
Notifications
You must be signed in to change notification settings - Fork 3
145 lines (128 loc) · 4.21 KB
/
test-matrix.yml
File metadata and controls
145 lines (128 loc) · 4.21 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
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
name: Test Matrix
on:
push:
branches: [ main, develop ]
paths:
- 'src/**'
- 'tests/**'
- 'requirements*.txt'
- 'pyproject.toml'
- 'pytest.ini'
pull_request:
branches: [ main, develop ]
paths:
- 'src/**'
- 'tests/**'
- 'requirements*.txt'
- 'pyproject.toml'
- 'pytest.ini'
env:
AWS_DEFAULT_REGION: us-east-1
AWS_ACCESS_KEY_ID: testing
AWS_SECRET_ACCESS_KEY: testing
ENVIRONMENT: testing
TESTING: true
jobs:
test-matrix:
name: Test Matrix
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest] # Disabled windows-latest, macos-latest for now
python-version: ['3.9', '3.10', '3.11', '3.12']
test-type: [unit, integration]
# exclude:
# # Reduce matrix size for faster CI
# - os: windows-latest
# python-version: '3.9'
# - os: windows-latest
# python-version: '3.10'
# - os: macos-latest
# python-version: '3.9'
# - os: macos-latest
# python-version: '3.10'
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
cache: 'pip'
- name: Install uv
uses: astral-sh/setup-uv@v1
with:
enable-cache: true
cache-dependency-glob: "requirements*.txt"
- name: Install dependencies with uv (Unix)
if: runner.os != 'Windows'
run: |
uv pip install --system -r requirements.txt -r requirements-dev.txt
- name: Install dependencies with uv (Windows)
if: runner.os == 'Windows'
run: |
uv pip install --system -r requirements.txt -r requirements-dev.txt
- name: Run unit tests
if: matrix.test-type == 'unit'
run: |
python -m pytest tests/unit/ \
-v \
--tb=short \
--cov=src \
--cov-report=term-missing \
--cov-report=xml:coverage-${{ matrix.os }}-${{ matrix.python-version }}-unit.xml \
--cov-branch \
--no-cov-on-fail \
--durations=10 \
--maxfail=5 \
-m "unit and not slow" \
--timeout=60 \
--junitxml=junit-${{ matrix.os }}-${{ matrix.python-version }}-unit.xml
- name: Run integration tests
if: matrix.test-type == 'integration'
run: |
python -m pytest tests/integration/ \
-v \
--tb=short \
--cov=src \
--cov-report=term-missing \
--cov-report=xml:coverage-${{ matrix.os }}-${{ matrix.python-version }}-integration.xml \
--cov-branch \
--no-cov-on-fail \
--durations=10 \
--maxfail=3 \
-m "integration and not slow" \
--timeout=300 \
--junitxml=junit-${{ matrix.os }}-${{ matrix.python-version }}-integration.xml
- name: Upload test results
uses: actions/upload-artifact@v4
if: always()
with:
name: test-results-${{ matrix.os }}-${{ matrix.python-version }}-${{ matrix.test-type }}
path: |
junit-*.xml
coverage-*.xml
test-summary:
name: Test Summary
runs-on: ubuntu-latest
needs: [test-matrix]
if: always()
steps:
- name: Download all test results
uses: actions/download-artifact@v4
with:
path: test-results/
- name: Display test summary
run: |
echo "## Test Matrix Results" >> $GITHUB_STEP_SUMMARY
echo "" >> $GITHUB_STEP_SUMMARY
# Count test result files
UNIT_RESULTS=$(find test-results/ -name "*unit.xml" | wc -l)
INTEGRATION_RESULTS=$(find test-results/ -name "*integration.xml" | wc -l)
echo "- Unit test configurations: $UNIT_RESULTS" >> $GITHUB_STEP_SUMMARY
echo "- Integration test configurations: $INTEGRATION_RESULTS" >> $GITHUB_STEP_SUMMARY
echo "" >> $GITHUB_STEP_SUMMARY
# List all test result files
echo "### Test Result Files:" >> $GITHUB_STEP_SUMMARY
find test-results/ -name "*.xml" | sort >> $GITHUB_STEP_SUMMARY