forked from finos/open-resource-broker
-
Notifications
You must be signed in to change notification settings - Fork 0
195 lines (181 loc) · 7.21 KB
/
Copy pathtest-matrix.yml
File metadata and controls
195 lines (181 loc) · 7.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
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
name: Test Matrix
on:
schedule:
# Run nightly comprehensive testing at 2 AM UTC
- cron: '0 2 * * *'
workflow_dispatch:
# Allow manual triggering
push:
branches: [main]
paths:
- 'src/**'
- 'tests/**'
- 'pyproject.toml'
- 'requirements*.txt'
- 'uv.lock'
- 'Makefile'
- 'makefiles/**'
- '.github/workflows/test-matrix.yml'
# Only run on main branch for comprehensive testing
jobs:
config:
name: Get Configuration
uses: ./.github/workflows/shared-config.yml
unit-tests:
name: Unit Tests
needs: config
permissions:
contents: read
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest] # Disabled windows-latest, macos-latest for now
# Dynamic matrix from config with static fallback for act/dry-run
# Update static list when adding new Python versions (currently 3.10-3.14)
python-version: ${{ fromJSON(needs.config.outputs.python-versions || '["3.10", "3.11", "3.12", "3.13", "3.14"]') }}
uses: ./.github/workflows/reusable-test.yml
with:
test-type: unit
python-version: ${{ matrix.python-version }}
os: ${{ matrix.os }}
default-python-version: ${{ needs.config.outputs.default-python-version }}
aws-region: ${{ needs.config.outputs.aws-region }}
aws-access-key: ${{ needs.config.outputs.aws-access-key }}
aws-secret-key: ${{ needs.config.outputs.aws-secret-key }}
environment: ${{ needs.config.outputs.environment }}
testing-flag: ${{ needs.config.outputs.testing-flag }}
integration-tests:
name: Integration Tests
needs: [config]
permissions:
contents: read
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest] # Disabled windows-latest, macos-latest for now
# Dynamic matrix from config with static fallback for act/dry-run
# Update static list when adding new Python versions (currently 3.10-3.14)
python-version: ${{ fromJSON(needs.config.outputs.python-versions || '["3.10", "3.11", "3.12", "3.13", "3.14"]') }}
uses: ./.github/workflows/reusable-test.yml
with:
test-type: integration
python-version: ${{ matrix.python-version }}
os: ${{ matrix.os }}
default-python-version: ${{ needs.config.outputs.default-python-version }}
aws-region: ${{ needs.config.outputs.aws-region }}
aws-access-key: ${{ needs.config.outputs.aws-access-key }}
aws-secret-key: ${{ needs.config.outputs.aws-secret-key }}
environment: ${{ needs.config.outputs.environment }}
testing-flag: ${{ needs.config.outputs.testing-flag }}
package-variant-tests:
name: Package Variant Tests
needs: [config, unit-tests]
permissions:
contents: read
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest]
# Dynamic matrix from config with static fallback
python-version: ${{ fromJSON(needs.config.outputs.python-versions || '["3.10", "3.11", "3.12", "3.13", "3.14"]') }}
package-variant:
- "."
- ".[cli]"
- ".[api]"
- ".[monitoring]"
- ".[all]"
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@ece7cb06caefa5fff74198d8649806c4678c61a1 # v6
with:
python-version: ${{ matrix.python-version }}
- name: Install package variant
run: |
python -m pip install --upgrade pip setuptools wheel
pip install -e "${{ matrix.package-variant }}"
- name: Test import guards
run: |
python -c "
import sys
variant = '${{ matrix.package-variant }}'
# Test basic imports (should always work)
try:
import orb
print('✓ Basic orb import works')
except ImportError as e:
print(f'✗ Basic orb import failed: {e}')
sys.exit(1)
# Test CLI flag: RICH_AVAILABLE reflects whether rich is installed
from orb.cli.console import RICH_AVAILABLE
if variant in ['.[cli]', '.[all]']:
if not RICH_AVAILABLE:
print(f'✗ Expected RICH_AVAILABLE=True for {variant} but got False')
sys.exit(1)
print(f'✓ RICH_AVAILABLE=True as expected for {variant}')
else:
print(f'✓ RICH_AVAILABLE={RICH_AVAILABLE} (rich not required for {variant})')
# Test API imports: fastapi is only available with .[api] or .[all]
try:
from orb.api.routers.machines import router
if variant in ['.', '.[cli]', '.[monitoring]']:
print(f'✗ Expected API import to fail for {variant} but it succeeded')
sys.exit(1)
print(f'✓ API router import works for {variant}')
except ImportError as e:
if variant in ['.[api]', '.[all]']:
print(f'✗ Unexpected API import failure for {variant}: {e}')
sys.exit(1)
print(f'✓ Expected API import failure for {variant}')
print(f'✓ All import tests passed for {variant}')
"
e2e-tests:
name: End-to-End Tests
needs: [config]
permissions:
contents: read
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest] # Disabled windows-latest, macos-latest for now
# Dynamic matrix from config with static fallback for act/dry-run
# Update static list when adding new Python versions (currently 3.10-3.14)
python-version: ${{ fromJSON(needs.config.outputs.python-versions || '["3.10", "3.11", "3.12", "3.13", "3.14"]') }}
uses: ./.github/workflows/reusable-test.yml
with:
test-type: e2e
python-version: ${{ matrix.python-version }}
os: ${{ matrix.os }}
default-python-version: ${{ needs.config.outputs.default-python-version }}
aws-region: ${{ needs.config.outputs.aws-region }}
aws-access-key: ${{ needs.config.outputs.aws-access-key }}
aws-secret-key: ${{ needs.config.outputs.aws-secret-key }}
environment: ${{ needs.config.outputs.environment }}
testing-flag: ${{ needs.config.outputs.testing-flag }}
test-summary:
name: Test Summary
runs-on: ubuntu-latest
needs: [unit-tests, integration-tests, package-variant-tests, e2e-tests]
if: always()
permissions:
contents: read
steps:
- name: Download all test results
uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8
with:
path: test-results/
- name: Display test summary
run: |
# 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 "## Test Matrix Results"
echo ""
echo "- Unit test configurations: $UNIT_RESULTS"
echo "- Integration test configurations: $INTEGRATION_RESULTS"
echo ""
echo "### Test Result Files:"
} >> "$GITHUB_STEP_SUMMARY"
find test-results/ -name "*.xml" | sort >> "$GITHUB_STEP_SUMMARY"