Skip to content

Complete 12-iteration documentation pass #1

Complete 12-iteration documentation pass

Complete 12-iteration documentation pass #1

Workflow file for this run

name: CI
on:
push:
branches: [main, develop]
pull_request:
branches: [main]
workflow_dispatch:
env:
CARGO_TERM_COLOR: always
RUST_BACKTRACE: 1
jobs:
# =============================================================================
# Rust Tests
# =============================================================================
rust-test:
name: Rust Tests
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Install Rust
uses: dtolnay/rust-toolchain@stable
with:
components: rustfmt, clippy
- name: Cache Cargo
uses: actions/cache@v4
with:
path: |
~/.cargo/registry
~/.cargo/git
target
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}
restore-keys: |
${{ runner.os }}-cargo-
- name: Check formatting
run: cargo fmt -- --check
- name: Clippy
run: cargo clippy -- -D warnings
- name: Run tests
run: cargo test --verbose
# =============================================================================
# Python Tests - Matrix
# =============================================================================
python-test:
name: Python ${{ matrix.python-version }} on ${{ matrix.os }}
runs-on: ${{ matrix.os }}
needs: rust-test
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, macos-latest, windows-latest]
python-version: ['3.8', '3.9', '3.10', '3.11', '3.12']
exclude:
# Skip Python 3.8 on macOS ARM (not supported)
- os: macos-latest
python-version: '3.8'
steps:
- uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
- name: Install Rust
uses: dtolnay/rust-toolchain@stable
- name: Cache Cargo
uses: actions/cache@v4
with:
path: |
~/.cargo/registry
~/.cargo/git
target
key: ${{ runner.os }}-py${{ matrix.python-version }}-cargo-${{ hashFiles('**/Cargo.lock') }}
restore-keys: |
${{ runner.os }}-py${{ matrix.python-version }}-cargo-
${{ runner.os }}-cargo-
- name: Install maturin
run: pip install maturin
- name: Build extension
run: maturin develop --release
- name: Install test dependencies
run: pip install pytest pytest-cov numpy
- name: Run tests
run: pytest tests/ -v --tb=short --cov=constraint_theory
- name: Upload coverage
if: matrix.os == 'ubuntu-latest' && matrix.python-version == '3.11'
uses: codecov/codecov-action@v4
with:
files: ./coverage.xml
fail_ci_if_error: false
# =============================================================================
# Linting
# =============================================================================
lint:
name: Python Linting
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: '3.11'
- name: Install linters
run: pip install black isort mypy ruff
- name: Check formatting with black
run: black --check constraint_theory/ tests/ examples/
- name: Check imports with isort
run: isort --check-only constraint_theory/ tests/ examples/
- name: Lint with ruff
run: ruff check constraint_theory/ tests/ examples/
- name: Type check with mypy
run: mypy constraint_theory/ --ignore-missing-imports
# =============================================================================
# Build Wheels
# =============================================================================
build-wheels:
name: Build wheels on ${{ matrix.os }}
runs-on: ${{ matrix.os }}
needs: [rust-test, python-test]
strategy:
matrix:
os: [ubuntu-latest, macos-latest, windows-latest]
steps:
- uses: actions/checkout@v4
- name: Build wheels
uses: PyO3/maturin-action@v1
with:
command: build
args: --release --out dist
manylinux: auto
- name: Upload wheels
uses: actions/upload-artifact@v4
with:
name: wheels-${{ matrix.os }}
path: dist/
retention-days: 7
# =============================================================================
# Build Source Distribution
# =============================================================================
build-sdist:
name: Build source distribution
runs-on: ubuntu-latest
needs: [rust-test, python-test]
steps:
- uses: actions/checkout@v4
- name: Install maturin
run: pip install maturin
- name: Build sdist
run: maturin sdist --out dist
- name: Upload sdist
uses: actions/upload-artifact@v4
with:
name: sdist
path: dist/
retention-days: 7
# =============================================================================
# Test Built Wheels
# =============================================================================
test-wheels:
name: Test wheel on ${{ matrix.os }}
runs-on: ${{ matrix.os }}
needs: build-wheels
strategy:
matrix:
os: [ubuntu-latest, macos-latest, windows-latest]
steps:
- uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: '3.11'
- name: Download wheels
uses: actions/download-artifact@v4
with:
name: wheels-${{ matrix.os }}
path: dist/
- name: Install wheel
run: pip install dist/*.whl
- name: Test import
run: |
python -c "from constraint_theory import PythagoreanManifold, snap, generate_triples; print('Import successful')"
python -c "from constraint_theory import __version__; print(f'Version: {__version__}')"
- name: Run basic tests
run: |
pip install pytest numpy
pytest tests/ -v --tb=short -k "not compatibility"
# =============================================================================
# Documentation Build
# =============================================================================
docs:
name: Build Documentation
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Check documentation
run: |
# Check that all referenced docs exist
test -f README.md
test -f docs/API.md
test -f docs/PRODUCTION.md
test -f docs/INTEGRATION.md
- name: Check links in docs
run: |
# Basic link check
grep -r "https://" docs/ README.md | head -20 || true
echo "Link check complete"