Skip to content

Commit

Permalink
Merge branch 'mlc-ai:main' into main
Browse files Browse the repository at this point in the history
  • Loading branch information
zanderjiang authored Dec 6, 2024
2 parents 270ef77 + a8ef8cf commit 6d0d1e9
Show file tree
Hide file tree
Showing 32 changed files with 425 additions and 426 deletions.
44 changes: 22 additions & 22 deletions .github/workflows/documentation.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -14,29 +14,29 @@ jobs:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v2
with:
submodules: recursive
- uses: actions/checkout@v2
with:
submodules: recursive

- name: Configuring build Environment
run: |
sudo apt-get update
python -m pip install -U pip wheel
- name: Configuring build Environment
run: |
sudo apt-get update
python -m pip install -U pip wheel
- name: Setup Ruby
uses: ruby/setup-ruby@v1
with:
ruby-version: '3.0'
- name: Setup Ruby
uses: ruby/setup-ruby@v1
with:
ruby-version: '3.0'

- name: Installing dependencies
run: |
python -m pip install -r docs/requirements.txt
gem install jekyll jekyll-remote-theme
- name: Installing dependencies
run: |
python -m pip install -r docs/requirements.txt
gem install jekyll jekyll-remote-theme
- name: Deploying on GitHub Pages
if: github.ref == 'refs/heads/main'
run: |
git remote set-url origin https://x-access-token:${{ secrets.MLC_GITHUB_TOKEN }}@github.com/$GITHUB_REPOSITORY
git config --global user.email "mlc-gh-actions-bot@nomail"
git config --global user.name "mlc-gh-actions-bot"
./scripts/gh_deploy_site.sh
- name: Deploying on GitHub Pages
if: github.ref == 'refs/heads/main'
run: |
git remote set-url origin https://x-access-token:${{ secrets.MLC_GITHUB_TOKEN }}@github.com/$GITHUB_REPOSITORY
git config --global user.email "mlc-gh-actions-bot@nomail"
git config --global user.name "mlc-gh-actions-bot"
./scripts/gh_deploy_site.sh
216 changes: 108 additions & 108 deletions .github/workflows/wheel_mac.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ name: Wheel-Mac
on:
push:
tags:
- '*' # Push events to every tag not containing /
- '*' # Push events to every tag not containing /

jobs:
Build:
Expand All @@ -18,121 +18,121 @@ jobs:
shell: 'bash -l {0}'

steps:
- uses: actions/checkout@v3
with:
submodules: 'recursive'
- name: Checkout source
run: |
git clone https://github.com/mlc-ai/package package --recursive
- name: Setup script env
run: |
mv scripts/build-environment.yaml package/3rdparty/tlcpack/conda/build-environment.yaml
rm -rf conda
ln -s package/3rdparty/tlcpack/conda conda
- name: Sync XGrammar Package
run: |
python scripts/sync_package.py --package . --package-name xgrammar --version ${{ github.ref_name }}
# Build wheel for different python versions
- name: Setup@Py39
uses: conda-incubator/setup-miniconda@v3
with:
activate-environment: build-Py39
channel-priority: strict
environment-file: conda/build-environment.yaml
python-version: 3.9
auto-activate-base: false
- name: XGrammar-Build@Py39
run: >-
scripts/build_xgrammar_lib_osx.sh ${{ matrix.platform == 'macos-13' && '10.15' || '13.02' }}
- name: Wheel-Build@Py39
run: |
python --version
python -m pip install setuptools Cython wheel
cd python
python setup.py bdist_wheel
rm -rf xgrammar/*.so
- name: Setup@Py310
uses: conda-incubator/setup-miniconda@v3
with:
activate-environment: build-Py310
channel-priority: strict
environment-file: conda/build-environment.yaml
python-version: '3.10'
auto-activate-base: false
- name: XGrammar-Build@Py310
run: >-
scripts/build_xgrammar_lib_osx.sh ${{ matrix.platform == 'macos-13' && '10.15' || '13.02' }}
- name: Wheel-Build@Py310
run: |
python --version
python -m pip install setuptools Cython wheel
cd python
python setup.py bdist_wheel
rm -rf xgrammar/*.so
- name: Setup@Py311
uses: conda-incubator/setup-miniconda@v3
with:
activate-environment: build-Py311
channel-priority: strict
environment-file: conda/build-environment.yaml
python-version: '3.11'
auto-activate-base: false
- name: XGrammar-Build@Py311
run: >-
scripts/build_xgrammar_lib_osx.sh ${{ matrix.platform == 'macos-13' && '10.15' || '13.02' }}
- name: Wheel-Build@Py311
run: |
python --version
python -m pip install setuptools Cython wheel
cd python
python setup.py bdist_wheel
rm -rf xgrammar/*.so
- name: Setup@Py312
uses: conda-incubator/setup-miniconda@v3
with:
activate-environment: build-Py312
channel-priority: strict
environment-file: conda/build-environment.yaml
python-version: '3.12'
auto-activate-base: false
- name: XGrammar-Build@Py312
run: >-
scripts/build_xgrammar_lib_osx.sh ${{ matrix.platform == 'macos-13' && '10.15' || '13.02' }}
- name: Wheel-Build@Py312
run: |
python --version
python -m pip install setuptools Cython wheel
cd python
python setup.py bdist_wheel
rm -rf xgrammar/*.so
- uses: actions/upload-artifact@v4
with:
name: xgrammar-wheel-${{ github.ref_name }}-${{ matrix.platform }}
path: python/dist/
retention-days: 3
overwrite: true
- uses: actions/checkout@v3
with:
submodules: 'recursive'
- name: Checkout source
run: |
git clone https://github.com/mlc-ai/package package --recursive
- name: Setup script env
run: |
mv scripts/build-environment.yaml package/3rdparty/tlcpack/conda/build-environment.yaml
rm -rf conda
ln -s package/3rdparty/tlcpack/conda conda
- name: Sync XGrammar Package
run: |
python scripts/sync_package.py --package . --package-name xgrammar --version ${{ github.ref_name }}
# Build wheel for different python versions
- name: Setup@Py39
uses: conda-incubator/setup-miniconda@v3
with:
activate-environment: build-Py39
channel-priority: strict
environment-file: conda/build-environment.yaml
python-version: 3.9
auto-activate-base: false
- name: XGrammar-Build@Py39
run: >-
scripts/build_xgrammar_lib_osx.sh ${{ matrix.platform == 'macos-13' && '10.15' || '13.02' }}
- name: Wheel-Build@Py39
run: |
python --version
python -m pip install setuptools Cython wheel
cd python
python setup.py bdist_wheel
rm -rf xgrammar/*.so
- name: Setup@Py310
uses: conda-incubator/setup-miniconda@v3
with:
activate-environment: build-Py310
channel-priority: strict
environment-file: conda/build-environment.yaml
python-version: '3.10'
auto-activate-base: false
- name: XGrammar-Build@Py310
run: >-
scripts/build_xgrammar_lib_osx.sh ${{ matrix.platform == 'macos-13' && '10.15' || '13.02' }}
- name: Wheel-Build@Py310
run: |
python --version
python -m pip install setuptools Cython wheel
cd python
python setup.py bdist_wheel
rm -rf xgrammar/*.so
- name: Setup@Py311
uses: conda-incubator/setup-miniconda@v3
with:
activate-environment: build-Py311
channel-priority: strict
environment-file: conda/build-environment.yaml
python-version: '3.11'
auto-activate-base: false
- name: XGrammar-Build@Py311
run: >-
scripts/build_xgrammar_lib_osx.sh ${{ matrix.platform == 'macos-13' && '10.15' || '13.02' }}
- name: Wheel-Build@Py311
run: |
python --version
python -m pip install setuptools Cython wheel
cd python
python setup.py bdist_wheel
rm -rf xgrammar/*.so
- name: Setup@Py312
uses: conda-incubator/setup-miniconda@v3
with:
activate-environment: build-Py312
channel-priority: strict
environment-file: conda/build-environment.yaml
python-version: '3.12'
auto-activate-base: false
- name: XGrammar-Build@Py312
run: >-
scripts/build_xgrammar_lib_osx.sh ${{ matrix.platform == 'macos-13' && '10.15' || '13.02' }}
- name: Wheel-Build@Py312
run: |
python --version
python -m pip install setuptools Cython wheel
cd python
python setup.py bdist_wheel
rm -rf xgrammar/*.so
- uses: actions/upload-artifact@v4
with:
name: xgrammar-wheel-${{ github.ref_name }}-${{ matrix.platform }}
path: python/dist/
retention-days: 3
overwrite: true

Publish-to-PyPI:
needs:
- Build
- Build
runs-on: ubuntu-latest

environment:
name: pypi
url: https://pypi.org/p/xgrammar
permissions:
id-token: write # IMPORTANT: mandatory for trusted publishing
id-token: write # IMPORTANT: mandatory for trusted publishing

steps:
- name: Download all the wheels
uses: actions/download-artifact@v4
with:
pattern: xgrammar-wheel-${{ github.ref_name }}-macos-*
path: python/dist/
merge-multiple: true
- name: Publish package distributions to PyPI
uses: pypa/gh-action-pypi-publish@release/v1
with:
packages_dir: python/dist
skip_existing: true
verbose: true
- name: Download all the wheels
uses: actions/download-artifact@v4
with:
pattern: xgrammar-wheel-${{ github.ref_name }}-macos-*
path: python/dist/
merge-multiple: true
- name: Publish package distributions to PyPI
uses: pypa/gh-action-pypi-publish@release/v1
with:
packages_dir: python/dist
skip_existing: true
verbose: true
59 changes: 29 additions & 30 deletions .github/workflows/wheel_manylinux.yaml
Original file line number Diff line number Diff line change
@@ -1,11 +1,10 @@
# GH actions.
name: Wheel-Manylinux


on:
push:
tags:
- '*' # Push events to every tag not containing /
- '*' # Push events to every tag not containing /

jobs:
Build:
Expand All @@ -19,33 +18,33 @@ jobs:
name: pypi
url: https://pypi.org/p/xgrammar
permissions:
id-token: write # IMPORTANT: mandatory for trusted publishing
id-token: write # IMPORTANT: mandatory for trusted publishing

steps:
- name: Reclaim disk space
run: |
df -h
sudo rm -rf /usr/local/lib/android
sudo rm -rf /opt/hostedtoolcache/CodeQL
sudo rm -rf /usr/local/.ghcup
df -h
- uses: actions/checkout@v3
with:
submodules: 'recursive'
- name: Checkout source
run: |
git clone https://github.com/mlc-ai/package package --recursive
- name: Sync XGrammar Package
run: |
python scripts/sync_package.py --package . --package-name xgrammar --version ${{ github.ref_name }}
- name: Build XGrammar
env:
IMAGE: ${{ matrix.config.image }}
run: |
scripts/docker/bash.sh --no-gpu $IMAGE ./scripts/build_xgrammar_wheel_manylinux.sh
- name: Publish package distributions to PyPI
uses: pypa/gh-action-pypi-publish@release/v1
with:
packages_dir: python/repaired_wheels
skip_existing: true
verbose: true
- name: Reclaim disk space
run: |
df -h
sudo rm -rf /usr/local/lib/android
sudo rm -rf /opt/hostedtoolcache/CodeQL
sudo rm -rf /usr/local/.ghcup
df -h
- uses: actions/checkout@v3
with:
submodules: 'recursive'
- name: Checkout source
run: |
git clone https://github.com/mlc-ai/package package --recursive
- name: Sync XGrammar Package
run: |
python scripts/sync_package.py --package . --package-name xgrammar --version ${{ github.ref_name }}
- name: Build XGrammar
env:
IMAGE: ${{ matrix.config.image }}
run: |
scripts/docker/bash.sh --no-gpu $IMAGE ./scripts/build_xgrammar_wheel_manylinux.sh
- name: Publish package distributions to PyPI
uses: pypa/gh-action-pypi-publish@release/v1
with:
packages_dir: python/repaired_wheels
skip_existing: true
verbose: true
Loading

0 comments on commit 6d0d1e9

Please sign in to comment.