-
Notifications
You must be signed in to change notification settings - Fork 1
246 lines (208 loc) · 7.87 KB
/
feature-test.yml
File metadata and controls
246 lines (208 loc) · 7.87 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
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
name: 🧪 Feature Integration Tests
on:
push:
branches: [ feature/* ]
pull_request:
branches: [ feature/* ]
workflow_dispatch:
workflow_call:
jobs:
# 🔬 Unit tests on multiple Python versions (fast)
unit-tests:
name: 🧪 Unit Tests
runs-on: ubuntu-latest
strategy:
matrix:
# Floor (3.10), mid (3.12) and ceiling (3.14) of the supported range
python-version: ["3.10", "3.12", "3.14"]
steps:
- name: 📥 Checkout code
uses: actions/checkout@v6
- name: 🐍 Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v6
with:
python-version: ${{ matrix.python-version }}
- name: 📦 Cache pip dependencies
uses: actions/cache@v5
with:
path: ~/.cache/pip
key: ${{ runner.os }}-pip-${{ hashFiles('**/requirements*.txt', '**/pyproject.toml') }}
restore-keys: |
${{ runner.os }}-pip-
- name: ⚙️ Install dependencies
run: |
python -m pip install --upgrade pip
pip install -e .
pip install -e ".[dev]"
- name: 🧪 Run unit tests
run: |
python scripts/run-all.py --ci
env:
PYTHONPATH: ${{ github.workspace }}/src
# 📦 Validate optional dependencies installation
validate-extras:
name: 📦 Validate Optional Dependencies
runs-on: ubuntu-latest
needs: unit-tests
strategy:
matrix:
python-version: ["3.10", "3.11", "3.12", "3.13", "3.14"]
extra: ["cli", "async", "config", "dotenv", "dev"]
steps:
- name: 📥 Checkout code
uses: actions/checkout@v6
- name: 🐍 Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v6
with:
python-version: ${{ matrix.python-version }}
- name: 📦 Install base package
run: |
python -m pip install --upgrade pip
pip install -e .
- name: 📦 Install optional extra [${{ matrix.extra }}]
run: |
pip install -e ".[${{ matrix.extra }}]"
- name: ✅ Verify installation
run: |
echo "=== Installed packages ==="
pip list | grep -E "(nocodb|click|rich|aiohttp|aiofiles|pyyaml|tomli|python-dotenv)" || true
echo "=== Testing imports ==="
python -c "from nocodb_simple_client import NocoDBClient; print('✓ Base client imports')"
# Test extra-specific imports
case "${{ matrix.extra }}" in
cli)
python -c "import click; import rich; print('✓ CLI dependencies available')"
python -c "from nocodb_simple_client.cli import main; print('✓ CLI module imports')"
;;
async)
python -c "import aiohttp; import aiofiles; print('✓ Async dependencies available')"
python -c "from nocodb_simple_client.async_client import AsyncNocoDBClient; print('✓ Async client imports')"
;;
config)
python -c "import yaml; print('✓ PyYAML available')"
# tomllib is stdlib on 3.11+; only 3.10 needs the tomli backport.
# Let Python decide so new versions (3.14+) never break this check.
python -c "import sys; m = 'tomllib' if sys.version_info >= (3, 11) else 'tomli'; __import__(m); print(f'✓ {m} available')"
python -c "from nocodb_simple_client.config import NocoDBConfig; from pathlib import Path; print('✓ Config module imports')"
;;
dotenv)
python -c "import dotenv; print('✓ python-dotenv available')"
;;
dev)
python -c "import pytest; import ruff; import mypy; print('✓ Dev dependencies available')"
;;
esac
echo "✅ Extra '${{ matrix.extra }}' validated successfully!"
# 🔗 Integration tests with Python-managed NocoDB instance
integration-test:
name: 🔗 Integration Tests (Python-Managed)
runs-on: ubuntu-latest
needs: validate-extras
steps:
- name: 📥 Checkout code
uses: actions/checkout@v6
- name: 🐍 Set up Python 3.12
uses: actions/setup-python@v6
with:
python-version: "3.12"
- name: ⚙️ Install dependencies
run: |
python -m pip install --upgrade pip
pip install -e .
pip install -e ".[dev]"
- name: 🐳 Setup NocoDB Container
run: |
# Make script executable
chmod +x scripts/ci-setup.sh
# Run setup script
CONTAINER_NAME=nocodb-integration-test \
NOCODB_PORT=8080 \
NC_ADMIN_EMAIL=test@integration.local \
NC_ADMIN_PASSWORD=IntegrationTest123 \
./scripts/ci-setup.sh setup
# Verify that config files were created
echo "=== Checking generated config files ==="
ls -la nocodb-config.json .env.test 2>/dev/null || echo "Config files not found!"
# Show config content (without sensitive data in logs)
if [ -f nocodb-config.json ]; then
echo "✅ nocodb-config.json created"
cat nocodb-config.json | jq 'del(.NOCODB_TOKEN)' || cat nocodb-config.json
fi
- name: 🔗 Run integration tests
run: |
# Verify config files are available
if [ ! -f nocodb-config.json ]; then
echo "❌ ERROR: nocodb-config.json not found!"
exit 1
fi
# Run tests with config file
python -m pytest tests/test_integration.py -v --tb=short
env:
PYTHONPATH: ${{ github.workspace }}/src
SKIP_INTEGRATION: 0
# Test configuration
TEST_TIMEOUT: 300
MAX_FILE_SIZE_MB: 1
CLEANUP_TEST_DATA: true
- name: 🔍 Show Docker logs on failure
if: failure()
run: |
echo "=== Available Docker containers ==="
docker ps -a
echo "=== Docker system info ==="
docker system df
echo "=== Check for NocoDB container logs ==="
docker logs nocodb-integration-test 2>/dev/null || echo "Container not found or no logs"
- name: 🧹 Cleanup Docker containers
if: always()
run: |
# Use cleanup script
chmod +x scripts/ci-setup.sh
CONTAINER_NAME=nocodb-integration-test ./scripts/ci-setup.sh cleanup
# ⚡ Optional performance tests (when PR has performance label)
performance-test:
name: ⚡ Performance Tests (Python-managed)
runs-on: ubuntu-latest
needs: unit-tests
if: contains(github.event.pull_request.labels.*.name, 'test-performance')
steps:
- name: 📥 Checkout code
uses: actions/checkout@v6
- name: 🐍 Set up Python 3.12
uses: actions/setup-python@v6
with:
python-version: "3.12"
- name: ⚙️ Install dependencies
run: |
python -m pip install --upgrade pip
pip install -e .
pip install -e ".[dev]"
- name: 🐳 Setup NocoDB Container
run: |
# Make script executable
chmod +x scripts/ci-setup.sh
# Run setup script with performance test configuration
CONTAINER_NAME=nocodb-integration-test \
NOCODB_PORT=8080 \
NC_ADMIN_EMAIL=test@integration.local \
NC_ADMIN_PASSWORD=IntegrationTest123 \
./scripts/ci-setup.sh setup
env:
PYTHONPATH: ${{ github.workspace }}/src
- name: ⚡ Run Python-managed performance tests
run: |
python -m pytest tests/test_integration.py::TestIntegration::test_bulk_operations -v --tb=short
python -m pytest tests/test_performance.py -v --tb=short 2>/dev/null || echo "Performance tests not available"
env:
PYTHONPATH: ${{ github.workspace }}/src
SKIP_INTEGRATION: 0
# Performance test configuration
PERFORMANCE_TEST_RECORDS: 100
BULK_TEST_BATCH_SIZE: 20
TEST_TIMEOUT: 600
- name: 🧹 Cleanup performance test containers
if: always()
run: |
# Use cleanup script
chmod +x scripts/ci-setup.sh
CONTAINER_NAME=nocodb-integration-test ./scripts/ci-setup.sh cleanup