Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
83 changes: 83 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,83 @@
name: CI

on:
push:
branches: [master, main, rust-optimization]
pull_request:
branches: [master, main]

jobs:
test:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: ['3.9', '3.10', '3.11']

steps:
- uses: actions/checkout@v4

- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}

- name: Install Rust
uses: dtolnay/rust-action@stable

- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install maturin pytest pytest-cov
pip install numpy pandas polars scipy pysam pybedtools typer rich

- name: Build Rust extension
run: |
maturin develop --release -m rust/Cargo.toml

- name: Run tests with coverage
run: |
pytest tests/ --cov=src --cov-report=xml --cov-report=term-missing
env:
PYTHONPATH: ${{ github.workspace }}/src

- name: Upload coverage to Codecov
if: matrix.python-version == '3.10'
uses: codecov/codecov-action@v4
with:
files: ./coverage.xml
fail_ci_if_error: false

lint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4

- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: '3.10'

- name: Install linters
run: |
pip install black flake8

- name: Check formatting
run: black --check src/ tests/ || true

- name: Lint
run: flake8 src/ tests/ --max-line-length=120 --ignore=E501,W503 || true

rust-check:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4

- name: Install Rust
uses: dtolnay/rust-action@stable

- name: Check Rust
run: |
cd rust
cargo check
cargo clippy -- -D warnings || true
cargo fmt --check || true
52 changes: 52 additions & 0 deletions .github/workflows/docs.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
name: Build and Deploy Docs

on:
push:
branches: [master, main, rust-optimization]
workflow_dispatch:

permissions:
contents: read
pages: write
id-token: write

concurrency:
group: "pages"
cancel-in-progress: false

jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4

- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: '3.9'

- name: Install dependencies
run: |
pip install sphinx pydata-sphinx-theme sphinx-autodoc-typehints
pip install numpy pandas polars scipy typer rich

- name: Build docs
run: |
cd docs
make html

- name: Upload artifact
uses: actions/upload-pages-artifact@v3
with:
path: docs/build/html

deploy:
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
runs-on: ubuntu-latest
needs: build
steps:
- name: Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@v4
130 changes: 130 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,130 @@
name: WASP2 Tests

on:
push:
branches: [main, claude/**]
pull_request:
branches: [main]
workflow_dispatch:

jobs:
test:
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
python-version: ["3.10", "3.11"]

steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
fetch-depth: 0

- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}

- name: Install system dependencies
run: |
sudo apt-get update
sudo apt-get install -y \
bcftools \
bedtools \
samtools \
time

- name: Install Python dependencies
run: |
python -m pip install --upgrade pip
pip install pytest pytest-cov mypy
pip install numpy pandas polars scipy
pip install pysam pybedtools anndata scanpy
pip install typer rich
pip install sphinx sphinx-rtd-theme sphinx-autodoc-typehints
pip install build twine

- name: Verify installations
run: |
python --version
bcftools --version | head -1
bedtools --version
samtools --version | head -1
mypy --version
pytest --version

- name: Run mypy type checking
run: |
echo "Type checking counting module..."
mypy src/counting/ --ignore-missing-imports
echo "Type checking mapping module..."
mypy src/mapping/ --ignore-missing-imports
echo "Type checking analysis module..."
mypy src/analysis/ --ignore-missing-imports
echo "✅ All type checks passed!"

- name: Run regression tests
run: |
echo "Running WASP2 regression test suite..."
python -m pytest tests/regression/ -v --tb=short

- name: Run full pipeline validation
run: |
echo "Validating full WASP2 pipeline..."
bash scripts/run_full_pipeline_baseline.sh
echo "✅ Full pipeline validation complete!"

- name: Check test coverage
run: |
pytest tests/regression/ --cov=src --cov-report=term-missing --cov-report=xml

- name: Upload coverage to artifacts
uses: actions/upload-artifact@v4
with:
name: coverage-${{ matrix.python-version }}
path: coverage.xml
retention-days: 7

- name: Test package installation
run: |
echo "Testing pip installation..."
pip install -e .
wasp2-count --version
wasp2-map --version
wasp2-analyze --version
echo "✅ Package installation successful!"

- name: Build package
run: |
echo "Building distribution packages..."
python -m build
twine check dist/*
echo "✅ Package build successful!"

- name: Build documentation
run: |
echo "Building Sphinx documentation..."
cd docs
make clean html
echo "✅ Documentation build successful!"

- name: Check docs for warnings
run: |
echo "Checking documentation for warnings..."
cd docs
make clean html 2>&1 | tee build.log
# Count warnings (excluding network-related intersphinx warnings)
warning_count=$(grep -i "WARNING" build.log | grep -v "intersphinx" | wc -l)
error_count=$(grep -i "ERROR" build.log | wc -l)
if [ "$error_count" -gt 0 ]; then
echo "❌ Documentation has $error_count errors!"
exit 1
fi
if [ "$warning_count" -gt 0 ]; then
echo "⚠️ Documentation has $warning_count warnings (excluding intersphinx)"
echo "Warnings:"
grep -i "WARNING" build.log | grep -v "intersphinx"
else
echo "✅ Documentation has no warnings!"
fi
70 changes: 70 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.5.0
hooks:
- id: trailing-whitespace
name: Remove trailing whitespace
- id: end-of-file-fixer
name: Fix end of files
- id: check-yaml
name: Check YAML syntax
- id: check-added-large-files
name: Check for large files
args: ['--maxkb=5000']
- id: check-merge-conflict
name: Check for merge conflicts
- id: check-case-conflict
name: Check for case conflicts
- id: mixed-line-ending
name: Fix mixed line endings

- repo: https://github.com/psf/black
rev: 23.12.1
hooks:
- id: black
name: Format Python code with Black
language_version: python3.11
args: ['--line-length=100']

- repo: https://github.com/PyCQA/flake8
rev: 7.0.0
hooks:
- id: flake8
name: Lint Python code with Flake8
args: ['--max-line-length=100', '--ignore=E203,W503']

- repo: https://github.com/pre-commit/mirrors-mypy
rev: v1.8.0
hooks:
- id: mypy
name: Type check with mypy
additional_dependencies:
- types-all
- numpy
- pandas
args:
- --ignore-missing-imports
- --no-strict-optional
files: ^src/

- repo: local
hooks:
- id: pytest-quick
name: Run quick regression tests
entry: python -m pytest tests/regression/ -v -m "not slow" --tb=short
language: system
pass_filenames: false
always_run: true
stages: [commit]

ci:
autofix_commit_msg: |
[pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci
autofix_prs: true
autoupdate_branch: ''
autoupdate_commit_msg: '[pre-commit.ci] pre-commit autoupdate'
autoupdate_schedule: weekly
skip: []
submodules: false
Loading
Loading