Skip to content

Commit 375f529

Browse files
committed
merge main cicd functionality
Signed-off-by: aviv ron <rona@il.ibm.com>
2 parents a643ecc + d30eb37 commit 375f529

50 files changed

Lines changed: 2458 additions & 362 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

‎.git-blame-ignore-revs‎

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
# Commits listed here are ignored by `git blame` so that bulk
2+
# reformatting commits don't obscure authorship of real changes.
3+
#
4+
# Enable locally with:
5+
# git config blame.ignoreRevsFile .git-blame-ignore-revs
6+
7+
# Apply ruff format and lint autofixes across the codebase (#102)
8+
c8d4a4ab79cc9e22cc0d5de264ec6d1a2b412d08

‎.github/CODEOWNERS‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
11
# This covers every file in the repo, owners are listed in alphabetical order
2-
* @antonpibm @aviv1ron1 @freunda @yairallouche
2+
* @antonpibm @aviv1ron1 @freunda @yairallouche

‎.github/workflows/ci.yaml‎

Lines changed: 77 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,77 @@
1+
# SPDX-License-Identifier: Apache-2.0
2+
3+
name: CI
4+
5+
on:
6+
pull_request:
7+
branches: [main]
8+
push:
9+
branches: [main]
10+
11+
jobs:
12+
pre-commit:
13+
name: Pre-commit
14+
runs-on: ubuntu-latest
15+
steps:
16+
- uses: actions/checkout@v4
17+
18+
- uses: actions/setup-python@v5
19+
with:
20+
python-version: "3.11"
21+
22+
# Run the exact same hooks as the local pre-commit stage (ruff, toml/yaml
23+
# validity, link/import validation, SPDX headers, whitespace/EOF, uv-lock,
24+
# nbstripout, ...) so CI and pre-commit can never drift. `uv` must be on
25+
# PATH for the uv-lock hook.
26+
- uses: astral-sh/setup-uv@v5
27+
with:
28+
enable-cache: true
29+
30+
- name: Cache pre-commit hook environments
31+
uses: actions/cache@v4
32+
with:
33+
path: ~/.cache/pre-commit
34+
key: pre-commit-${{ hashFiles('.pre-commit-config.yaml') }}
35+
36+
- name: Run pre-commit hooks
37+
run: uvx pre-commit run --all-files --show-diff-on-failure --color=always
38+
39+
test-cpu:
40+
name: CPU Tests (Python ${{ matrix.python-version }})
41+
needs: pre-commit
42+
runs-on: ubuntu-latest
43+
strategy:
44+
fail-fast: false
45+
matrix:
46+
python-version: ["3.11", "3.12"]
47+
steps:
48+
- uses: actions/checkout@v4
49+
50+
- uses: astral-sh/setup-uv@v5
51+
with:
52+
enable-cache: true
53+
python-version: ${{ matrix.python-version }}
54+
55+
- run: uv sync --frozen --group dev --extra hf --extra compose
56+
57+
- name: Run CPU tests
58+
run: |
59+
# CI runs only tests/unit/ — the fast, self-contained CPU set.
60+
# The marker filter still applies: tests that download/compose real
61+
# models (requires_model), need CUDA (gpu), hit the network / take
62+
# long (slow), or are the expensive code-theory suite (deep) are
63+
# excluded.
64+
# tests/composer/ and tests/hf/ are NOT run here: even filtered they
65+
# are heavy enough to exhaust the GitHub Actions CPU-minutes quota and
66+
# get killed mid-run. All of that coverage runs on the GPU cluster.
67+
uv run pytest tests/unit/ \
68+
-m "not requires_model and not gpu and not slow and not deep" \
69+
-v -s --tb=short -x \
70+
--cov=granite_switch --cov-report=xml
71+
72+
- name: Upload coverage
73+
uses: codecov/codecov-action@v4
74+
with:
75+
token: ${{ secrets.CODECOV_TOKEN }}
76+
files: coverage.xml
77+
fail_ci_if_error: false

‎.github/workflows/dco.yaml‎

Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
# SPDX-License-Identifier: Apache-2.0
2+
3+
name: DCO Check
4+
5+
on:
6+
pull_request:
7+
branches: [main]
8+
9+
jobs:
10+
dco:
11+
name: DCO Sign-off
12+
runs-on: ubuntu-latest
13+
steps:
14+
- uses: actions/checkout@v4
15+
with:
16+
fetch-depth: 0
17+
18+
- name: Check DCO sign-off
19+
shell: bash
20+
run: |
21+
COMMITS=$(git log origin/${{ github.base_ref }}..${{ github.sha }} --format="%H")
22+
MISSING_DCO=false
23+
24+
for commit in $COMMITS; do
25+
PARENTS=$(git rev-list --parents -n 1 $commit | wc -w)
26+
if [ "$PARENTS" -gt 2 ]; then
27+
echo "ℹ️ Skipping merge commit $commit"
28+
continue
29+
fi
30+
31+
MESSAGE=$(git log -1 --format=%B $commit)
32+
if ! echo "$MESSAGE" | grep -q "^Signed-off-by:"; then
33+
echo "❌ Commit $commit is missing DCO sign-off"
34+
echo " Commit message:"
35+
echo "$MESSAGE" | head -5
36+
echo ""
37+
MISSING_DCO=true
38+
fi
39+
done
40+
41+
if [ "$MISSING_DCO" = true ]; then
42+
echo ""
43+
echo "Error: One or more commits are missing DCO sign-off!"
44+
echo "Please sign your commits with: git commit -s"
45+
echo ""
46+
echo "To fix existing commits:"
47+
echo " git rebase --signoff origin/${{ github.base_ref }}"
48+
exit 1
49+
fi
50+
51+
echo "✅ All commits have DCO sign-off"

‎.github/workflows/gpu-tests.yaml‎

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
# SPDX-License-Identifier: Apache-2.0
2+
3+
name: GPU Tests
4+
5+
on:
6+
workflow_dispatch: # admin-only trigger (requires write access)
7+
8+
jobs:
9+
gpu-tests:
10+
name: GPU Tests
11+
runs-on: [self-hosted, gpu]
12+
steps:
13+
- uses: actions/checkout@v4
14+
15+
- uses: astral-sh/setup-uv@v5
16+
with:
17+
enable-cache: true
18+
19+
- run: uv sync --frozen --group dev --extra hf --extra vllm --extra compose
20+
21+
- name: Run GPU tests
22+
run: |
23+
uv run pytest tests/vllm/ tests/integration/ -v -s --tb=short -x

‎.github/workflows/publish.yaml‎

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
# SPDX-License-Identifier: Apache-2.0
2+
3+
name: Publish to PyPI
4+
5+
on:
6+
release:
7+
types: [published]
8+
9+
jobs:
10+
build-and-publish:
11+
name: Build and publish
12+
runs-on: ubuntu-latest
13+
environment: pypi
14+
permissions:
15+
id-token: write # required for PyPI Trusted Publisher (OIDC)
16+
steps:
17+
- uses: actions/checkout@v4
18+
19+
- uses: astral-sh/setup-uv@v5
20+
with:
21+
enable-cache: true
22+
23+
- name: Build wheel and sdist
24+
run: uv build
25+
26+
- name: Publish to PyPI
27+
run: uv publish

‎.gitignore‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,4 +54,4 @@ htmlcov/
5454
# Local design/planning doc (keep on disk, do not version)
5555
docs/KV_CACHE_OVERHEAD_REMOVAL.md
5656
docs/KV_CACHE_OVERHEAD_REMOVAL.html
57-
docs/KV_CACHE_OVERHEAD_REMOVAL*.html
57+
docs/KV_CACHE_OVERHEAD_REMOVAL*.html

‎.pre-commit-config.yaml‎

Lines changed: 85 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,85 @@
1+
fail_fast: true
2+
# Restrict hooks to the pre-commit stage by default so they don't also fire at
3+
# prepare-commit-msg / commit-msg (which are installed for the DCO hooks below).
4+
# The two DCO hooks override this with their own explicit `stages:`.
5+
default_stages: [pre-commit]
6+
repos:
7+
# Config-file validators run first: ruff loads its config from pyproject.toml,
8+
# so a malformed pyproject.toml makes ruff itself abort with a parser error
9+
# instead of the clean check-toml message. With fail_fast, running check-toml /
10+
# check-yaml before ruff means syntax errors are reported by the validator that
11+
# exists for that purpose, consistently between local commits and CI --all-files.
12+
- repo: https://github.com/pre-commit/pre-commit-hooks
13+
rev: v5.0.0
14+
hooks:
15+
- id: check-toml
16+
- id: check-yaml
17+
- id: check-merge-conflict
18+
# --assume-in-merge makes the hook scan even when no merge is in
19+
# progress. Without it the hook returns early unless .git/MERGE_HEAD
20+
# exists, so it would be a no-op in CI's `pre-commit run --all-files`
21+
# (a clean checkout is never mid-merge). This lets CI catch conflict
22+
# markers that were committed (e.g. via --no-verify).
23+
args: [--assume-in-merge]
24+
- id: check-added-large-files
25+
# --enforce-all checks every file, not just staged additions, so the
26+
# hook also runs in CI's `pre-commit run --all-files` (a clean checkout
27+
# has nothing staged, so without this it would be a no-op there).
28+
# uv.lock is intentionally large (~2.3 MB) and excluded.
29+
args: [--maxkb=500, --enforce-all]
30+
exclude: ^uv\.lock$
31+
- id: check-case-conflict
32+
- id: mixed-line-ending
33+
args: [--fix=lf]
34+
- id: end-of-file-fixer
35+
exclude: \.ipynb$
36+
- id: trailing-whitespace
37+
exclude: \.ipynb$
38+
39+
- repo: https://github.com/astral-sh/ruff-pre-commit
40+
rev: v0.9.0
41+
hooks:
42+
- id: ruff-format
43+
args: [--config=pyproject.toml]
44+
- id: ruff
45+
args: [--exit-non-zero-on-fix, --fix, --config=pyproject.toml]
46+
47+
- repo: local
48+
hooks:
49+
- id: check-headers
50+
name: Check SPDX headers
51+
entry: python ci/check_headers.py
52+
language: system
53+
args: [--fix]
54+
files: '^(src|tests)/.*\.py$'
55+
pass_filenames: true
56+
57+
- id: add-signoff
58+
name: Add DCO sign-off
59+
entry: python ci/add_signoff.py
60+
language: system
61+
stages: [prepare-commit-msg]
62+
63+
- id: check-dco
64+
name: Check DCO sign-off
65+
entry: python ci/check_dco.py
66+
language: system
67+
stages: [commit-msg]
68+
69+
- id: validate-links
70+
name: Validate links and first-party imports
71+
entry: python .pre-commit/validate_links.py
72+
language: system
73+
pass_filenames: false
74+
always_run: true
75+
files: \.(ipynb|md|py)$
76+
77+
- repo: https://github.com/kynan/nbstripout
78+
rev: 0.8.1
79+
hooks:
80+
- id: nbstripout
81+
82+
- repo: https://github.com/astral-sh/uv-pre-commit
83+
rev: 0.8.4
84+
hooks:
85+
- id: uv-lock

0 commit comments

Comments
 (0)