forked from redai-infra/Relax
-
Notifications
You must be signed in to change notification settings - Fork 0
113 lines (97 loc) · 3.47 KB
/
ci.yml
File metadata and controls
113 lines (97 loc) · 3.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
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
name: CI
on:
push:
branches: [main, develop]
pull_request:
branches: [main, develop]
workflow_dispatch:
concurrency:
group: ci-${{ github.ref }}
cancel-in-progress: true
jobs:
# ── Pre-commit checks (ruff, copyright, gitleaks, trailing-whitespace …) ──
pre-commit:
name: Pre-commit Checks
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup Python
uses: actions/setup-python@v5
with:
python-version: "3.10"
- name: Run pre-commit
uses: pre-commit/action@v3.0.1
# ── Lint (ruff check + ruff format --check) ───────────────────────────────
lint:
name: Lint
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup Python
uses: actions/setup-python@v5
with:
python-version: "3.10"
- name: Install ruff
run: pip install ruff==0.15.9
- name: Ruff check
run: ruff check relax/ tests/
- name: Ruff format check
run: ruff format --check relax/ tests/
# ── Unit tests (matrix: Python 3.10 / 3.11 / 3.12) ────────────────────────
test:
name: Tests (Python ${{ matrix.python-version }})
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
python-version: ["3.10", "3.11", "3.12"]
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup Python ${{ matrix.python-version }}
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
- name: Cache pip
uses: actions/cache@v4
with:
path: ~/.cache/pip
key: ${{ runner.os }}-pip-${{ matrix.python-version }}-${{ hashFiles('requirements.txt') }}
restore-keys: |
${{ runner.os }}-pip-${{ matrix.python-version }}-
- name: Install system deps
run: |
sudo apt-get update && sudo apt-get install -y libsndfile1
- name: Install dependencies
run: |
python -m pip install --upgrade pip
# Install PyTorch CPU-only build
pip install torch --index-url https://download.pytorch.org/whl/cpu
pip install tensordict
# Install project in editable mode (--no-deps to avoid re-installing
# torch from PyPI and to tolerate packages that may fail to compile)
pip install --no-deps -e .
# Install requirements, skipping packages that need GPU or are unavailable in CI
pip install -r requirements.txt || true
# Create a stub for transfer_queue (internal package, not on PyPI)
python -c "
import os, site
sp = site.getsitepackages()[0]
os.makedirs(sp, exist_ok=True)
with open(os.path.join(sp, 'transfer_queue.py'), 'w') as f:
f.write('# CI stub for transfer_queue (internal package)\n')
f.write('class _Stub:\n')
f.write(' def __getattr__(self, name): return self\n')
f.write(' def __call__(self, *a, **k): return self\n')
f.write('_s = _Stub()\n')
f.write('def __getattr__(name): return _s\n')
"
- name: Run tests
run: |
pytest tests/ \
-v \
--tb=short \
-x \
--ignore=tests/autoscale