Skip to content
Merged
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
70 changes: 70 additions & 0 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
name: Tests

on:
push:
branches: [ main, develop ]
pull_request:
branches: [ main, develop ]

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

steps:
- uses: actions/checkout@v3

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

- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install pytest pytest-cov pyyaml numpy matplotlib
# Install CPU-only PyTorch for CI (no GPU required for basic tests)
pip install torch torchvision --index-url https://download.pytorch.org/whl/cpu

- name: Run config tests
run: |
pytest tests/test_config.py -v

- name: Run mask tests (CPU only)
run: |
pytest tests/test_masks.py -v
Copy link

Copilot AI Jan 24, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The workflow will run pytest tests/test_masks.py which will fail due to undefined functions generate_mask and validate_24_sparsity (as noted in the test file issues). This needs to be fixed before the CI can pass.

Suggested change
pytest tests/test_masks.py -v
echo "Skipping tests/test_masks.py: generate_mask and validate_24_sparsity not yet implemented."

Copilot uses AI. Check for mistakes.

- name: Test imports
run: |
python -c "from src import config, distributed, logging_utils, metrics, workloads"
python -c "from src.sparsity import masks, semistructured"
python -c "from src.methods import dense_single, dense_tp, block_shock, masked_split_dense"

- name: Test main --help
run: |
python -m src.main --help

lint:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v3

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

- name: Install linting tools
run: |
python -m pip install --upgrade pip
pip install flake8

- name: Lint with flake8
run: |
# Stop the build if there are Python syntax errors or undefined names
flake8 src/ --count --select=E9,F63,F7,F82 --show-source --statistics
# Exit-zero treats all errors as warnings. Line length set to 100
flake8 src/ --count --exit-zero --max-complexity=10 --max-line-length=100 --statistics
76 changes: 74 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,78 @@ results/raw/
results/tables/
results/plots/

# Python bytecode
# Python bytecode and cache
__pycache__/
*.pyc
*.py[cod]
*$py.class
*.so

# Distribution / packaging
.Python
build/
develop-eggs/
dist/
downloads/
eggs/
.eggs/
lib/
lib64/
parts/
sdist/
var/
wheels/
pip-wheel-metadata/
share/python-wheels/
*.egg-info/
.installed.cfg
*.egg
MANIFEST

# PyInstaller
*.manifest
*.spec

# Unit test / coverage reports
htmlcov/
.tox/
.nox/
.coverage
.coverage.*
.cache
nosetests.xml
coverage.xml
*.cover
*.py,cover
.hypothesis/
.pytest_cache/

# Virtual environments
venv/
ENV/
env/
.venv

# IDEs
.vscode/
.idea/
*.swp
*.swo
*~
.DS_Store

# Jupyter Notebook
.ipynb_checkpoints

# Environment variables
.env
.env.local

# PyTorch
*.pth
*.pt

# Temporary files
*.log
*.tmp
tmp/
temp/
Loading
Loading