-
Notifications
You must be signed in to change notification settings - Fork 3
46 lines (38 loc) · 1.47 KB
/
test.yml
File metadata and controls
46 lines (38 loc) · 1.47 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
name: test
on:
push:
branches: [main]
pull_request:
branches: [main]
jobs:
test:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: '3.12'
- name: Install uv
uses: astral-sh/setup-uv@v4
- name: Install dependencies
run: uv sync --extra dev --no-sources
- name: Guard against bare heavy imports in tests
run: |
# Fail CI if any test file has a bare top-level import of a heavy package.
# Heavy packages must use pytest.importorskip() at module level.
if grep -rn '^import \(torch\|transformers\|trl\|datasets\|unsloth\|accelerate\|peft\|bitsandbytes\)\b' tests/ || \
grep -rn '^from \(torch\|transformers\|trl\|datasets\|unsloth\|accelerate\|peft\|bitsandbytes\|openadapt_ml\)\b' tests/; then
echo ""
echo "ERROR: Found bare top-level import of heavy package in tests."
echo "Use pytest.importorskip() instead. Example:"
echo ' torch = pytest.importorskip("torch")'
echo ' openadapt_ml = pytest.importorskip("openadapt_ml")'
exit 1
fi
- name: Run tests
run: |
uv run --no-sources pytest tests/ -q \
-m "not heavy and not gpu and not vm" \
-k "not (test_demo_format_and_persistence or test_synthetic_demos)"