-
Notifications
You must be signed in to change notification settings - Fork 5
246 lines (210 loc) · 7.37 KB
/
ci.yml
File metadata and controls
246 lines (210 loc) · 7.37 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: CI
on:
push:
branches:
- main
- master
- dev
pull_request:
branches: [ main, master, dev ]
permissions:
contents: write
jobs:
test:
name: test (py${{ matrix.python-version }}, numpy${{ matrix.numpy-version }})
runs-on: ubuntu-latest
strategy:
matrix:
python-version: ['3.10', '3.11', '3.12', '3.13']
numpy-version: ['1.26.4', '2.2.0']
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Free disk space
run: |
sudo rm -rf /usr/local/lib/android
sudo rm -rf /usr/share/dotnet
sudo rm -rf /opt/ghc
sudo rm -rf /usr/local/share/powershell
sudo rm -rf /usr/local/share/chromium
sudo rm -rf /usr/local/.ghcup
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
- name: Install uv
run: curl -LsSf https://astral.sh/uv/install.sh | sh
- name: Cache uv dependencies
uses: actions/cache@v4
with:
path: ~/.cache/uv
key: ${{ runner.os }}-uv-${{ hashFiles('**/pyproject.toml') }}
restore-keys: |
${{ runner.os }}-uv-
- name: Create virtual environment and install dependencies
env:
UV_HTTP_TIMEOUT: 300
UV_CONCURRENT_DOWNLOADS: 4
run: |
uv venv
uv pip install -e ".[test,dev]"
- name: Install specific numpy version
run: |
source .venv/bin/activate
uv pip install "numpy==${{ matrix.numpy-version }}"
- name: Run linting and code quality checks with Ruff
run: |
source .venv/bin/activate
# Check formatting
ruff format --check .
# Check linting
ruff check . --statistics
- name: Run fast tests
run: |
source .venv/bin/activate
pytest tests/ -v -m "not slow" --cov=dnallm --cov-report=xml --cov-report=term-missing --tb=short
- name: Upload coverage to Codecov
uses: codecov/codecov-action@v3
with:
file: ./coverage.xml
fail_ci_if_error: false
- name: Run slow tests
continue-on-error: true
run: |
source .venv/bin/activate
pytest tests/ -v -m "slow" --cov=dnallm --cov-report=xml --cov-report=term-missing --tb=short --cov-append
- name: Run type checking
run: |
source .venv/bin/activate
mypy dnallm/ --show-error-codes --pretty --exclude=dnallm/tasks/metrics/ || true
test-cuda:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: ['3.11']
cuda-version: ['12.1', '12.4']
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Free disk space
run: |
sudo rm -rf /usr/local/lib/android
sudo rm -rf /usr/share/dotnet
sudo rm -rf /opt/ghc
sudo rm -rf /usr/local/share/powershell
sudo rm -rf /usr/local/share/chromium
sudo rm -rf /usr/local/.ghcup
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
- name: Install CUDA dependencies
run: |
sudo apt-get update
sudo apt-get install -y nvidia-cuda-toolkit
- name: Install uv
run: curl -LsSf https://astral.sh/uv/install.sh | sh
- name: Cache uv dependencies
uses: actions/cache@v4
with:
path: ~/.cache/uv
key: ${{ runner.os }}-uv-cuda-${{ matrix.cuda-version }}-${{ hashFiles('**/pyproject.toml') }}
restore-keys: |
${{ runner.os }}-uv-cuda-${{ matrix.cuda-version }}-
${{ runner.os }}-uv-
- name: Create virtual environment and install CUDA dependencies
env:
UV_HTTP_TIMEOUT: 300
UV_CONCURRENT_DOWNLOADS: 4
run: |
uv venv
if [ "${{ matrix.cuda-version }}" = "12.1" ]; then
uv pip install -e ".[test,dev,cuda121]"
elif [ "${{ matrix.cuda-version }}" = "12.4" ]; then
uv pip install -e ".[test,dev,cuda124]"
fi
- name: Run GPU-enabled tests
run: |
source .venv/bin/activate
pytest tests/ -v -m "not slow" --tb=short
test-mamba:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: ['3.11']
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Check for GPU
id: gpu-check
run: |
if command -v nvidia-smi &> /dev/null && nvidia-smi > /dev/null 2>&1; then
echo "has_gpu=true" >> $GITHUB_OUTPUT
echo "GPU detected, will run mamba tests"
else
echo "has_gpu=false" >> $GITHUB_OUTPUT
echo "No GPU detected, skipping mamba tests"
fi
- name: Set up Python ${{ matrix.python-version }}
if: steps.gpu-check.outputs.has_gpu == 'true'
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
- name: Install uv
if: steps.gpu-check.outputs.has_gpu == 'true'
run: curl -LsSf https://astral.sh/uv/install.sh | sh
- name: Create virtual environment and install mamba dependencies
if: steps.gpu-check.outputs.has_gpu == 'true'
run: |
uv venv
uv pip install -e ".[test,dev]"
uv pip install -e ".[mamba]" --no-cache-dir --no-build-isolation
- name: Run mamba-specific tests
if: steps.gpu-check.outputs.has_gpu == 'true'
continue-on-error: true
run: |
source .venv/bin/activate
pytest tests/ -v -m "not slow" --tb=short
- name: Upload mamba test logs on failure
if: steps.gpu-check.outputs.has_gpu == 'true' && failure()
uses: actions/upload-artifact@v4
with:
name: mamba-test-logs-${{ matrix.python-version }}
path: |
pytest.log
/tmp/mamba-build.log
deploy:
needs: [test, test-cuda, test-mamba]
runs-on: ubuntu-latest
if: github.ref == 'refs/heads/main' || github.ref == 'refs/heads/master'
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Configure Git credentials
run: |
git config user.name github-actions[bot]
git config user.email 41898282+github-actions[bot]@users.noreply.github.com
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: 3.11
- name: Cache mkdocs dependencies
uses: actions/cache@v3
with:
key: mkdocs-material-${{ github.run_number }}
path: .cache
restore-keys: |
mkdocs-material-
- name: Install uv
run: curl -LsSf https://astral.sh/uv/install.sh | sh
- name: Create virtual environment and install documentation dependencies
env:
UV_HTTP_TIMEOUT: 120
UV_CONCURRENT_DOWNLOADS: 1
run: |
uv venv
uv pip install -e ".[base,docs]"
- name: Deploy documentation to GitHub Pages
run: |
source .venv/bin/activate
mkdocs gh-deploy --force