feat(gemma4): refactor to support only Gemma 4 (#14) #147
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: Tests And Linting | |
| on: | |
| pull_request: | |
| push: | |
| branches: | |
| - main | |
| workflow_dispatch: | |
| jobs: | |
| lint: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v5 | |
| - name: Install uv | |
| uses: astral-sh/setup-uv@v7 | |
| - name: Set up Python | |
| run: uv python install 3.12 | |
| - name: Install dependencies | |
| run: uv sync --all-extras --dev | |
| - name: Ruff check | |
| run: uv run ruff check src/py | |
| - name: Ruff format check | |
| run: uv run ruff format --check src/py | |
| - name: Mojo format check | |
| run: uv run mojo format --line-length 120 src/mo && git diff --exit-code | |
| mypy: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v5 | |
| - name: Install uv | |
| uses: astral-sh/setup-uv@v7 | |
| - name: Set up Python | |
| run: uv python install 3.12 | |
| - name: Install dependencies | |
| run: uv sync --all-extras --dev | |
| - name: Run mypy | |
| run: uv run mypy | |
| pyright: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v5 | |
| - name: Install uv | |
| uses: astral-sh/setup-uv@v7 | |
| - name: Set up Python | |
| run: uv python install 3.12 | |
| - name: Install dependencies | |
| run: uv sync --all-extras --dev | |
| - name: Run pyright | |
| run: uv run pyright | |
| test-linux: | |
| runs-on: ubuntu-latest | |
| strategy: | |
| fail-fast: true | |
| matrix: | |
| python-version: ["3.10", "3.11", "3.12", "3.13", "3.14"] | |
| timeout-minutes: 15 | |
| steps: | |
| - uses: actions/checkout@v5 | |
| - name: Install uv | |
| uses: astral-sh/setup-uv@v7 | |
| - name: Set up Python | |
| run: uv python install ${{ matrix.python-version }} | |
| - name: Install dependencies | |
| run: uv sync --all-extras --dev | |
| - name: Build extension | |
| run: make build | |
| - name: Test | |
| run: uv run pytest src/py/tests | |
| build-wheels: | |
| name: Build wheels (${{ matrix.os }}) | |
| needs: [lint, test-linux] | |
| runs-on: ${{ matrix.os }} | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| os: [ubuntu-latest, macos-latest] | |
| steps: | |
| - uses: actions/checkout@v5 | |
| - name: Install uv | |
| uses: astral-sh/setup-uv@v7 | |
| - name: Set up QEMU | |
| if: runner.os == 'Linux' | |
| uses: docker/setup-qemu-action@v4 | |
| with: | |
| platforms: arm64 | |
| - name: Build wheels | |
| uses: pypa/cibuildwheel@v2.22.0 | |
| env: | |
| CIBW_ARCHS_LINUX: x86_64 aarch64 | |
| CIBW_ARCHS_MACOS: x86_64 arm64 | |
| - name: Upload wheel artifacts | |
| uses: actions/upload-artifact@v7 | |
| with: | |
| name: wheels-${{ matrix.os }} | |
| path: ./wheelhouse/*.whl | |
| build-source: | |
| name: Build source distribution | |
| needs: [lint, test-linux] | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v5 | |
| - name: Install uv | |
| uses: astral-sh/setup-uv@v7 | |
| - name: Set up Python | |
| run: uv python install 3.12 | |
| - name: Install dependencies | |
| run: uv sync --all-extras --dev | |
| - name: Build source distribution | |
| run: uv build --sdist | |
| - name: Upload source artifacts | |
| uses: actions/upload-artifact@v7 | |
| with: | |
| name: source-dist | |
| path: dist/*.tar.gz | |
| check-release: | |
| name: Release quality gate | |
| needs: [build-wheels, build-source] | |
| runs-on: ubuntu-latest | |
| if: github.event_name == 'workflow_dispatch' | |
| steps: | |
| - uses: actions/checkout@v5 | |
| - name: Install uv | |
| uses: astral-sh/setup-uv@v7 | |
| - name: Set up Python | |
| run: uv python install 3.12 | |
| - name: Install dependencies | |
| run: uv sync --all-extras --dev | |
| - name: Ruff lint check | |
| run: uv run ruff check src/py | |
| - name: Ruff format check | |
| run: uv run ruff format --check src/py | |
| - name: Mojo format check | |
| run: uv run mojo format --line-length 120 src/mo && git diff --exit-code | |
| - name: Run mypy | |
| run: uv run mypy | |
| - name: Run pyright | |
| run: uv run pyright | |
| - name: Run tests | |
| run: uv run pytest src/py/tests | |
| - name: Run parity gates | |
| run: uv run python tools/run_parity_gates.py --model gemma3n-e2b-it | |
| - name: Upload parity artifacts | |
| uses: actions/upload-artifact@v7 | |
| with: | |
| name: parity-artifact | |
| path: parity_artifact.json | |
| - name: Run CPU benchmark harness (Generation) | |
| run: uv run python tools/benchmark.py --mode generation --rounds 20 --max-new-tokens 64 > benchmark_cpu_generation.json | |
| - name: Run CPU benchmark harness (Embedding) | |
| run: uv run python tools/benchmark.py --mode embedding --rounds 20 > benchmark_cpu_embedding.json | |
| - name: Upload CPU benchmark artifacts | |
| uses: actions/upload-artifact@v7 | |
| with: | |
| name: benchmark-artifacts-cpu | |
| path: benchmark_cpu_*.json |