-
Notifications
You must be signed in to change notification settings - Fork 5
219 lines (186 loc) · 7.05 KB
/
ci.yml
File metadata and controls
219 lines (186 loc) · 7.05 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
name: CI
on:
push:
branches:
- main
- master
- dev
- flake8
pull_request:
branches: [ main, master, dev, flake8 ]
permissions:
contents: write
jobs:
test:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: ['3.10', '3.11', '3.12', '3.13']
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: 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 flake8 checks for MCP module
run: |
source .venv/bin/activate
# Install flake8 for MCP module compatibility check
uv pip install flake8>=7.1.2
# Run flake8 on MCP module
flake8 dnallm/mcp/ --max-line-length=79 --extend-ignore=E203,W503,C901,E402
# Run flake8 on other modules excluding metrics
flake8 dnallm/ --max-line-length=79 --extend-ignore=E203,W503,C901,E402 --exclude=dnallm/tasks/metrics/
- name: Run type checking
run: |
source .venv/bin/activate
mypy dnallm/ --ignore-missing-imports --no-strict-optional --disable-error-code=var-annotated --disable-error-code=assignment --disable-error-code=return-value --disable-error-code=arg-type --disable-error-code=index --disable-error-code=attr-defined --disable-error-code=operator --disable-error-code=call-overload --disable-error-code=valid-type --disable-error-code=no-redef --disable-error-code=dict-item --disable-error-code=return --disable-error-code=unreachable --disable-error-code=misc --disable-error-code=import-untyped --exclude=dnallm/tasks/metrics/
# - name: Run tests with coverage
# run: |
# source .venv/bin/activate
# pytest tests/ -v --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
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: Set up Python ${{ matrix.python-version }}
# uses: actions/setup-python@v4
# with:
# python-version: ${{ matrix.python-version }}
# - name: Install uv
# run: curl -LsSf https://astral.sh/uv/install.sh | sh
# - name: Create virtual environment and install mamba dependencies
# 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
# run: |
# source .venv/bin/activate
# pytest tests/ -v -m "not slow" --tb=short
deploy:
needs: [test, test-cuda]
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