66 - main
77 - master
88 - dev
9- - flake8
109 pull_request :
11- branches : [ main, master, dev, flake8 ]
10+ branches : [ main, master, dev ]
1211
1312permissions :
1413 contents : write
1514
1615jobs :
1716 test :
17+ name : test (py${{ matrix.python-version }}, numpy${{ matrix.numpy-version }})
1818 runs-on : ubuntu-latest
1919 strategy :
2020 matrix :
2121 python-version : ['3.10', '3.11', '3.12', '3.13']
22+ numpy-version : ['1.26.4', '2.2.0']
2223 steps :
2324 - name : Checkout code
2425 uses : actions/checkout@v4
5556 run : |
5657 uv venv
5758 uv pip install -e ".[test,dev]"
58-
59+
60+ - name : Install specific numpy version
61+ run : |
62+ source .venv/bin/activate
63+ uv pip install "numpy==${{ matrix.numpy-version }}"
64+
5965 - name : Run linting and code quality checks with Ruff
6066 run : |
6167 source .venv/bin/activate
@@ -64,31 +70,27 @@ jobs:
6470 # Check linting
6571 ruff check . --statistics
6672
67- - name : Run flake8 checks for MCP module
73+ - name : Run fast tests
6874 run : |
6975 source .venv/bin/activate
70- # Install flake8 for MCP module compatibility check
71- uv pip install flake8>=7.1.2
72- # Run flake8 on MCP module
73- flake8 dnallm/mcp/ --max-line-length=79 --extend-ignore=E203,W503,C901,E402
74- # Run flake8 on other modules excluding metrics
75- flake8 dnallm/ --max-line-length=79 --extend-ignore=E203,W503,C901,E402 --exclude=dnallm/tasks/metrics/
76-
76+ pytest tests/ -v -m "not slow" --cov=dnallm --cov-report=xml --cov-report=term-missing --tb=short
77+
78+ - name : Upload coverage to Codecov
79+ uses : codecov/codecov-action@v3
80+ with :
81+ file : ./coverage.xml
82+ fail_ci_if_error : false
83+
84+ - name : Run slow tests
85+ continue-on-error : true
86+ run : |
87+ source .venv/bin/activate
88+ pytest tests/ -v -m "slow" --cov=dnallm --cov-report=xml --cov-report=term-missing --tb=short --cov-append
89+
7790 - name : Run type checking
7891 run : |
7992 source .venv/bin/activate
80- 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/
81-
82- # - name: Run tests with coverage
83- # run: |
84- # source .venv/bin/activate
85- # pytest tests/ -v --cov=dnallm --cov-report=xml --cov-report=term-missing --tb=short
86-
87- # - name: Upload coverage to Codecov
88- # uses: codecov/codecov-action@v3
89- # with:
90- # file: ./coverage.xml
91- # fail_ci_if_error: false
93+ mypy dnallm/ --show-error-codes --pretty --exclude=dnallm/tasks/metrics/ || true
9294
9395 test-cuda :
9496 runs-on : ubuntu-latest
@@ -143,41 +145,66 @@ jobs:
143145 uv pip install -e ".[test,dev,cuda124]"
144146 fi
145147
146- # - name: Run GPU-enabled tests
147- # run: |
148- # source .venv/bin/activate
149- # pytest tests/ -v -m "not slow" --tb=short
150-
151- # test-mamba:
152- # runs-on: ubuntu-latest
153- # strategy:
154- # matrix:
155- # python-version: ['3.11']
156- # steps:
157- # - name: Checkout code
158- # uses: actions/checkout@v4
159-
160- # - name: Set up Python ${{ matrix.python-version }}
161- # uses: actions/setup-python@v4
162- # with:
163- # python-version: ${{ matrix.python-version }}
164-
165- # - name: Install uv
166- # run: curl -LsSf https://astral.sh/uv/install.sh | sh
167-
168- # - name: Create virtual environment and install mamba dependencies
169- # run: |
170- # uv venv
171- # uv pip install -e ".[test,dev]"
172- # uv pip install -e ".[mamba]" --no-cache-dir --no-build-isolation
148+ - name : Run GPU-enabled tests
149+ run : |
150+ source .venv/bin/activate
151+ pytest tests/ -v -m "not slow" --tb=short
173152
174- # - name: Run mamba-specific tests
175- # run: |
176- # source .venv/bin/activate
177- # pytest tests/ -v -m "not slow" --tb=short
153+ test-mamba :
154+ runs-on : ubuntu-latest
155+ strategy :
156+ matrix :
157+ python-version : ['3.11']
158+ steps :
159+ - name : Checkout code
160+ uses : actions/checkout@v4
161+
162+ - name : Check for GPU
163+ id : gpu-check
164+ run : |
165+ if command -v nvidia-smi &> /dev/null && nvidia-smi > /dev/null 2>&1; then
166+ echo "has_gpu=true" >> $GITHUB_OUTPUT
167+ echo "GPU detected, will run mamba tests"
168+ else
169+ echo "has_gpu=false" >> $GITHUB_OUTPUT
170+ echo "No GPU detected, skipping mamba tests"
171+ fi
172+
173+ - name : Set up Python ${{ matrix.python-version }}
174+ if : steps.gpu-check.outputs.has_gpu == 'true'
175+ uses : actions/setup-python@v4
176+ with :
177+ python-version : ${{ matrix.python-version }}
178+
179+ - name : Install uv
180+ if : steps.gpu-check.outputs.has_gpu == 'true'
181+ run : curl -LsSf https://astral.sh/uv/install.sh | sh
182+
183+ - name : Create virtual environment and install mamba dependencies
184+ if : steps.gpu-check.outputs.has_gpu == 'true'
185+ run : |
186+ uv venv
187+ uv pip install -e ".[test,dev]"
188+ uv pip install -e ".[mamba]" --no-cache-dir --no-build-isolation
189+
190+ - name : Run mamba-specific tests
191+ if : steps.gpu-check.outputs.has_gpu == 'true'
192+ continue-on-error : true
193+ run : |
194+ source .venv/bin/activate
195+ pytest tests/ -v -m "not slow" --tb=short
196+
197+ - name : Upload mamba test logs on failure
198+ if : steps.gpu-check.outputs.has_gpu == 'true' && failure()
199+ uses : actions/upload-artifact@v4
200+ with :
201+ name : mamba-test-logs-${{ matrix.python-version }}
202+ path : |
203+ pytest.log
204+ /tmp/mamba-build.log
178205
179206 deploy :
180- needs : [test, test-cuda]
207+ needs : [test, test-cuda, test-mamba ]
181208 runs-on : ubuntu-latest
182209 if : github.ref == 'refs/heads/main' || github.ref == 'refs/heads/master'
183210 steps :
0 commit comments