-
Notifications
You must be signed in to change notification settings - Fork 26
136 lines (130 loc) · 4.12 KB
/
wheel_windows.yaml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
# GH actions.
name: Wheel-Windows
on:
push:
tags:
- '*' # Push events to every tag not containing /
jobs:
Build:
runs-on: windows-latest
defaults:
run:
shell: 'cmd /C call {0}'
steps:
- name: Git config
run: >-
git config --system core.longpaths 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_win.bat
- name: Wheel-Build@Py39
run: |
python --version
python -m pip install setuptools Cython wheel
cd python
python setup.py bdist_wheel
del /f xgrammar\*.pyd
- 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_win.bat
- name: Wheel-Build@Py310
run: |
python --version
python -m pip install setuptools Cython wheel
cd python
python setup.py bdist_wheel
del /f xgrammar\*.pyd
- 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_win.bat
- name: Wheel-Build@Py311
run: |
python --version
python -m pip install setuptools Cython wheel
cd python
python setup.py bdist_wheel
del /f xgrammar\*.pyd
- 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_win.bat
- name: Wheel-Build@Py312
run: |
python --version
python -m pip install setuptools Cython wheel
cd python
python setup.py bdist_wheel
del /f xgrammar\*.pyd
- uses: actions/upload-artifact@v4
with:
name: xgrammar-wheel-${{ github.ref_name }}-windows
path: python/dist/
retention-days: 3
overwrite: true
Publish-to-PyPI:
needs:
- Build
runs-on: ubuntu-latest
environment:
name: pypi
url: https://pypi.org/p/xgrammar
permissions:
id-token: write # IMPORTANT: mandatory for trusted publishing
steps:
- name: Download all the wheels
uses: actions/download-artifact@v4
with:
name: xgrammar-wheel-${{ github.ref_name }}-windows
path: python/dist/
- name: Publish package distributions to PyPI
uses: pypa/gh-action-pypi-publish@release/v1
with:
packages_dir: python/dist
skip_existing: true
verbose: true