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
8 changes: 8 additions & 0 deletions .git-blame-ignore-revs
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
# Commits listed here are ignored by `git blame` so that bulk
# reformatting commits don't obscure authorship of real changes.
#
# Enable locally with:
# git config blame.ignoreRevsFile .git-blame-ignore-revs

# Apply ruff format and lint autofixes across the codebase (#102)
c8d4a4ab79cc9e22cc0d5de264ec6d1a2b412d08
2 changes: 1 addition & 1 deletion .github/CODEOWNERS
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
# This covers every file in the repo
* @antonpibm @freunda @yairallouche
* @antonpibm @freunda @yairallouche
23 changes: 23 additions & 0 deletions .github/workflows/check-headers.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
# SPDX-License-Identifier: Apache-2.0

name: Check SPDX Headers

on:
pull_request:
branches: [main]

jobs:
headers:
name: SPDX Headers
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4

- uses: actions/setup-python@v5
with:
python-version: "3.11"

- name: Check SPDX headers
run: |
PYTHON_FILES=$(find src tests -name "*.py" 2>/dev/null)
python ci/check_headers.py $PYTHON_FILES
59 changes: 59 additions & 0 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
# SPDX-License-Identifier: Apache-2.0

name: CI

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

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

- uses: astral-sh/setup-uv@v5
with:
enable-cache: true

# ruff isn't a project dependency; fetch the pinned version standalone
# (matches the pre-commit hook). No project sync needed just to lint.
- name: Check formatting
run: uvx ruff@0.9.0 format --check .

- name: Check linting
run: uvx ruff@0.9.0 check .

test-cpu:
name: CPU Tests (Python ${{ matrix.python-version }})
needs: lint
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
python-version: ["3.11", "3.12"]
steps:
- uses: actions/checkout@v4

- uses: astral-sh/setup-uv@v5
with:
enable-cache: true
python-version: ${{ matrix.python-version }}

- run: uv sync --frozen --group dev --extra hf --extra compose

- name: Run CPU tests
run: |
uv run pytest tests/unit/ tests/composer/ tests/hf/ \
-v -s --tb=short -x \
--cov=granite_switch --cov-report=xml

- name: Upload coverage
uses: codecov/codecov-action@v4
with:
token: ${{ secrets.CODECOV_TOKEN }}
files: coverage.xml
fail_ci_if_error: false
51 changes: 51 additions & 0 deletions .github/workflows/dco.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
# SPDX-License-Identifier: Apache-2.0

name: DCO Check

on:
pull_request:
branches: [main]

jobs:
dco:
name: DCO Sign-off
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0

- name: Check DCO sign-off
shell: bash
run: |
COMMITS=$(git log origin/${{ github.base_ref }}..${{ github.sha }} --format="%H")
MISSING_DCO=false

for commit in $COMMITS; do
PARENTS=$(git rev-list --parents -n 1 $commit | wc -w)
if [ "$PARENTS" -gt 2 ]; then
echo "ℹ️ Skipping merge commit $commit"
continue
fi

MESSAGE=$(git log -1 --format=%B $commit)
if ! echo "$MESSAGE" | grep -q "^Signed-off-by:"; then
echo "❌ Commit $commit is missing DCO sign-off"
echo " Commit message:"
echo "$MESSAGE" | head -5
echo ""
MISSING_DCO=true
fi
done

if [ "$MISSING_DCO" = true ]; then
echo ""
echo "Error: One or more commits are missing DCO sign-off!"
echo "Please sign your commits with: git commit -s"
echo ""
echo "To fix existing commits:"
echo " git rebase --signoff origin/${{ github.base_ref }}"
exit 1
fi

echo "✅ All commits have DCO sign-off"
23 changes: 23 additions & 0 deletions .github/workflows/gpu-tests.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
# SPDX-License-Identifier: Apache-2.0

name: GPU Tests

on:
workflow_dispatch: # admin-only trigger (requires write access)

jobs:
gpu-tests:
name: GPU Tests
runs-on: [self-hosted, gpu]
steps:
- uses: actions/checkout@v4

- uses: astral-sh/setup-uv@v5
with:
enable-cache: true

- run: uv sync --frozen --group dev --extra hf --extra vllm --extra compose

- name: Run GPU tests
run: |
uv run pytest tests/vllm/ tests/integration/ -v -s --tb=short -x
27 changes: 27 additions & 0 deletions .github/workflows/publish.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
# SPDX-License-Identifier: Apache-2.0

name: Publish to PyPI

on:
release:
types: [published]

jobs:
build-and-publish:
name: Build and publish
runs-on: ubuntu-latest
environment: pypi
permissions:
id-token: write # required for PyPI Trusted Publisher (OIDC)
steps:
- uses: actions/checkout@v4

- uses: astral-sh/setup-uv@v5
with:
enable-cache: true

- name: Build wheel and sdist
run: uv build

- name: Publish to PyPI
run: uv publish
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -54,4 +54,4 @@ htmlcov/
# Local design/planning doc (keep on disk, do not version)
docs/KV_CACHE_OVERHEAD_REMOVAL.md
docs/KV_CACHE_OVERHEAD_REMOVAL.html
docs/KV_CACHE_OVERHEAD_REMOVAL*.html
docs/KV_CACHE_OVERHEAD_REMOVAL*.html
59 changes: 59 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
fail_fast: true
repos:
- repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.9.0
hooks:
- id: ruff-format
args: [--config=pyproject.toml]
- id: ruff
args: [--exit-non-zero-on-fix, --fix, --config=pyproject.toml]

- repo: local
hooks:
- id: check-headers
name: Check SPDX headers
entry: python ci/check_headers.py
language: system
args: [--fix]
files: '^(src|tests)/.*\.py$'
pass_filenames: true

- id: check-dco
name: Check DCO sign-off
entry: python ci/check_dco.py
language: system
stages: [commit-msg]

- id: validate-links
name: Validate links and first-party imports
entry: python .pre-commit/validate_links.py
language: system
pass_filenames: false
always_run: true
files: \.(ipynb|md|py)$

- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v5.0.0
hooks:
- id: check-toml
- id: check-yaml
- id: check-merge-conflict
- id: check-added-large-files
args: [--maxkb=500]
- id: check-case-conflict
- id: mixed-line-ending
args: [--fix=lf]
- id: end-of-file-fixer
exclude: \.ipynb$
- id: trailing-whitespace
exclude: \.ipynb$

- repo: https://github.com/kynan/nbstripout
rev: 0.8.1
hooks:
- id: nbstripout

- repo: https://github.com/astral-sh/uv-pre-commit
rev: 0.8.4
hooks:
- id: uv-lock
Loading
Loading