feat: initial release of arbitrium-core v0.1.0 #9
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: CI | |
| "on": | |
| push: | |
| branches: [main] | |
| pull_request: | |
| branches: ['**'] | |
| permissions: | |
| contents: read | |
| security-events: write | |
| jobs: | |
| # ============================================================================ | |
| # LAYER 1: Fast feedback (runs first) | |
| # ============================================================================ | |
| pre-commit: | |
| name: Pre-commit hooks | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v6 | |
| - name: Set up Python | |
| uses: actions/setup-python@v6 | |
| with: | |
| python-version: "3.12" | |
| - name: Cache pre-commit | |
| uses: actions/cache@v5 | |
| with: | |
| path: ~/.cache/pre-commit | |
| key: pre-commit-${{ hashFiles('.pre-commit-config.yaml') }} | |
| - name: Install pre-commit | |
| run: | | |
| python -m pip install --upgrade pip | |
| pip install pre-commit | |
| - name: Run pre-commit | |
| run: pre-commit run --all-files | |
| lint-type-check: | |
| name: Lint & Type Check | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v6 | |
| - name: Set up Python | |
| uses: actions/setup-python@v6 | |
| with: | |
| python-version: "3.12" | |
| - name: Cache pip | |
| uses: actions/cache@v5 | |
| with: | |
| path: ~/.cache/pip | |
| key: ${{ runner.os }}-lint-pip-${{ hashFiles('**/pyproject.toml') }} | |
| restore-keys: | | |
| ${{ runner.os }}-lint-pip- | |
| - name: Install dependencies | |
| run: | | |
| python -m pip install --upgrade pip | |
| pip install -e .[dev] | |
| - name: Run ruff | |
| run: ruff check src tests | |
| - name: Run black | |
| run: black --check src tests | |
| - name: Run mypy | |
| run: mypy src | |
| # ============================================================================ | |
| # LAYER 2: Tests (depends on Layer 1) | |
| # ============================================================================ | |
| test: | |
| name: Test (Python ${{ matrix.python-version }} / ${{ matrix.os }}) | |
| needs: [pre-commit, lint-type-check] | |
| runs-on: ${{ matrix.os }} | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| os: [ubuntu-latest, macos-latest, windows-latest] | |
| python-version: ['3.10', '3.11', '3.12', '3.13'] | |
| steps: | |
| - uses: actions/checkout@v6 | |
| - name: Set up Python ${{ matrix.python-version }} | |
| uses: actions/setup-python@v6 | |
| with: | |
| python-version: ${{ matrix.python-version }} | |
| - name: Cache pip | |
| uses: actions/cache@v5 | |
| with: | |
| path: ~/.cache/pip | |
| key: ${{ runner.os }}-pip-${{ matrix.python-version }}-${{ hashFiles('**/pyproject.toml') }} | |
| restore-keys: | | |
| ${{ runner.os }}-pip-${{ matrix.python-version }}- | |
| ${{ runner.os }}-pip- | |
| - name: Install dependencies | |
| run: | | |
| python -m pip install --upgrade pip | |
| pip install -e .[dev] | |
| - name: Run tests with coverage | |
| run: | | |
| pytest tests/ -v \ | |
| --cov=src/arbitrium \ | |
| --cov-report=xml \ | |
| --cov-report=term-missing \ | |
| --cov-branch \ | |
| --junitxml=test-results.xml | |
| - name: Enforce coverage threshold | |
| if: runner.os == 'Linux' && matrix.python-version == '3.12' | |
| run: coverage report --fail-under=40 | |
| - name: Upload coverage report | |
| if: runner.os == 'Linux' && matrix.python-version == '3.12' | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: coverage-report | |
| path: | | |
| coverage.xml | |
| test-results.xml | |
| retention-days: 1 | |
| # ============================================================================ | |
| # LAYER 3: Quality analysis (parallel, non-blocking on main) | |
| # ============================================================================ | |
| mutation-testing: | |
| name: Mutation Testing | |
| if: github.event_name == 'push' && github.ref == 'refs/heads/main' | |
| runs-on: ubuntu-latest | |
| continue-on-error: true | |
| steps: | |
| - uses: actions/checkout@v6 | |
| - name: Set up Python | |
| uses: actions/setup-python@v6 | |
| with: | |
| python-version: "3.12" | |
| - name: Install dependencies | |
| run: | | |
| python -m pip install --upgrade pip | |
| pip install -e .[dev] | |
| - name: Run mutation testing | |
| run: | | |
| mutmut run . || true | |
| mutmut results || true | |
| complexity-checks: | |
| name: Complexity Analysis | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v6 | |
| - name: Set up Python | |
| uses: actions/setup-python@v6 | |
| with: | |
| python-version: "3.12" | |
| - name: Install radon | |
| run: pip install radon | |
| - name: Check cyclomatic complexity | |
| run: | | |
| echo "=== Cyclomatic Complexity ===" | |
| radon cc src/arbitrium/ --min B --total-average | |
| radon cc src/arbitrium/ --min C --total-average || \ | |
| (echo "::warning::High complexity detected (grade C or worse)" && exit 0) | |
| - name: Check maintainability index | |
| run: | | |
| echo "=== Maintainability Index ===" | |
| radon mi src/arbitrium/ --min B | |
| architecture-checks: | |
| name: Architecture Validation | |
| runs-on: ubuntu-latest | |
| continue-on-error: true | |
| steps: | |
| - uses: actions/checkout@v6 | |
| - name: Set up Python | |
| uses: actions/setup-python@v6 | |
| with: | |
| python-version: "3.12" | |
| - name: Install import-linter | |
| run: pip install import-linter | |
| - name: Create import contracts | |
| run: | | |
| cat > .importlinter <<EOF | |
| [importlinter] | |
| root_package = arbitrium | |
| [importlinter:contract:1] | |
| name = CLI should not import core internals directly | |
| type = forbidden | |
| source_modules = arbitrium.cli | |
| forbidden_modules = arbitrium.core.tournament | |
| [importlinter:contract:2] | |
| name = Models should not import CLI | |
| type = forbidden | |
| source_modules = arbitrium.models | |
| forbidden_modules = arbitrium.cli | |
| [importlinter:contract:3] | |
| name = Utils should be independent | |
| type = independence | |
| modules = | |
| arbitrium.utils | |
| EOF | |
| - name: Install package | |
| run: pip install -e . | |
| - name: Validate architecture | |
| run: lint-imports || echo "::warning::Architecture violations detected" |