chore: import upstream snapshot with attribution
CI / test (3.11) (push) Has been cancelled
CI / test (3.12) (push) Has been cancelled
CI / test (3.13) (push) Has been cancelled

This commit is contained in:
wehub-resource-sync
2026-07-13 13:29:51 +08:00
commit e9a2f726c9
821 changed files with 476007 additions and 0 deletions
+97
View File
@@ -0,0 +1,97 @@
name: Build wheels
# Builds pip wheels WITH the native custom kernels precompiled, so pip users
# get the accelerated GLM-5.2 / MiniMax M3 / Qwen3.5 paths without needing
# the Metal toolchain locally (source installs without it silently fall back
# to much slower generic kernels; see #2137 / #2208).
on:
release:
types: [published]
workflow_dispatch:
permissions:
contents: read
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:
build-wheels:
# macos-15: the native kernels target MACOSX_DEPLOYMENT_TARGET=15.0, so
# the post-build import smoke test needs a Sequoia host.
runs-on: macos-15
strategy:
fail-fast: false
matrix:
python-version: ["3.11", "3.12", "3.13"]
steps:
- uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@ece7cb06caefa5fff74198d8649806c4678c61a1 # v6.3.0
with:
python-version: ${{ matrix.python-version }}
cache: pip
- name: Build wheel with native custom kernels
env:
OMLX_WITH_CUSTOM_KERNEL: "1"
# --no-isolation with preinstalled build deps: CMake's Python discovery
# does not reliably resolve pip's isolated build env on the hosted
# runners (it found the system framework Python without nanobind), so
# we build against the job's Python and pin it for CMake explicitly.
run: |
python -m pip install --upgrade pip
python -m pip install build setuptools wheel "cmake>=3.27" "nanobind==2.13.0" "mlx==0.32.0"
export CMAKE_ARGS="-DPython_EXECUTABLE=$(python -c 'import sys; print(sys.executable)')"
python -m build --wheel --no-isolation
- name: Smoke-test wheel (native kernels must import and report available)
run: |
echo "--- native artifacts in the wheel:"
unzip -l dist/*.whl | grep -E "_ext|dylib|metallib" || { echo "no native artifacts in wheel"; exit 1; }
python -m venv /tmp/wheel-smoke
/tmp/wheel-smoke/bin/pip install --quiet dist/*.whl
# run from outside the checkout so `import omlx` resolves to the
# installed wheel, not the source tree in cwd
cd /tmp
/tmp/wheel-smoke/bin/python - <<'PY'
import importlib
failed = []
for pkg in ("glm_moe_dsa", "minimax_m3", "qwen35_prefill"):
fast = importlib.import_module(f"omlx.custom_kernels.{pkg}.fast")
ok = bool(fast.is_native_available())
print(f"{pkg}: native_available={ok} import_error={fast.import_error()}")
if not ok:
failed.append(pkg)
raise SystemExit(f"native kernels missing from wheel: {failed}" if failed else 0)
PY
- name: Upload wheel artifact
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
with:
name: wheels-py${{ matrix.python-version }}
path: dist/*.whl
if-no-files-found: error
attach-to-release:
if: github.event_name == 'release'
needs: build-wheels
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1
with:
path: dist
merge-multiple: true
- name: Attach wheels to the release
env:
GH_TOKEN: ${{ github.token }}
run: |
gh release upload "${{ github.event.release.tag_name }}" dist/*.whl \
--repo "${{ github.repository }}" --clobber
+40
View File
@@ -0,0 +1,40 @@
name: CI
on:
push:
branches: [main]
pull_request:
branches: [main]
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
permissions:
contents: read
jobs:
test:
runs-on: macos-14
strategy:
fail-fast: false
matrix:
python-version: ["3.11", "3.12", "3.13"]
steps:
- uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@ece7cb06caefa5fff74198d8649806c4678c61a1 # v6.3.0
with:
python-version: ${{ matrix.python-version }}
cache: pip
- name: Install dependencies
run: |
python -m pip install --upgrade pip
python -m pip install -e ".[mcp]"
python -m pip install pytest pytest-asyncio
- name: Run unit tests
run: python -m pytest tests/ -m "not slow and not integration"
+43
View File
@@ -0,0 +1,43 @@
name: Update Homebrew formula
on:
release:
types: [published]
permissions:
contents: write
jobs:
update-formula:
if: ${{ !contains(github.ref_name, 'dev') && (!github.event.release.prerelease || contains(github.ref_name, 'rc')) }}
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0
with:
ref: main
- name: Extract version from tag
id: version
run: echo "version=${GITHUB_REF_NAME#v}" >> "$GITHUB_OUTPUT"
- name: Calculate sha256
id: sha
run: |
sha=$(curl -sL "https://github.com/${{ github.repository }}/archive/refs/tags/${GITHUB_REF_NAME}.tar.gz" | shasum -a 256 | cut -d' ' -f1)
echo "sha256=$sha" >> "$GITHUB_OUTPUT"
- name: Update formula
run: |
# Only update the formula's top-level source fields. Resource fields
# use deeper indentation and must keep their own checksums.
sed -i 's|^ url "https://github.com/.*/archive/refs/tags/v.*\.tar\.gz"$| url "https://github.com/${{ github.repository }}/archive/refs/tags/${{ github.ref_name }}.tar.gz"|' Formula/omlx.rb
sed -i 's|^ sha256 ".*"$| sha256 "${{ steps.sha.outputs.sha256 }}"|' Formula/omlx.rb
- name: Commit and push
run: |
git config user.name "github-actions[bot]"
git config user.email "github-actions[bot]@users.noreply.github.com"
git add Formula/omlx.rb
git diff --cached --quiet && echo "no changes" && exit 0
git commit -m "formula: bump to ${{ steps.version.outputs.version }}"
git push