@@ -4,7 +4,7 @@ name: Wheel-Mac
4
4
on :
5
5
push :
6
6
tags :
7
- - ' *' # Push events to every tag not containing /
7
+ - ' *' # Push events to every tag not containing /
8
8
9
9
jobs :
10
10
Build :
@@ -18,121 +18,121 @@ jobs:
18
18
shell : ' bash -l {0}'
19
19
20
20
steps :
21
- - uses : actions/checkout@v3
22
- with :
23
- submodules : ' recursive'
24
- - name : Checkout source
25
- run : |
26
- git clone https://github.com/mlc-ai/package package --recursive
27
- - name : Setup script env
28
- run : |
29
- mv scripts/build-environment.yaml package/3rdparty/tlcpack/conda/build-environment.yaml
30
- rm -rf conda
31
- ln -s package/3rdparty/tlcpack/conda conda
32
- - name : Sync XGrammar Package
33
- run : |
34
- python scripts/sync_package.py --package . --package-name xgrammar --version ${{ github.ref_name }}
35
- # Build wheel for different python versions
36
- - name : Setup@Py39
37
- uses : conda-incubator/setup-miniconda@v3
38
- with :
39
- activate-environment : build-Py39
40
- channel-priority : strict
41
- environment-file : conda/build-environment.yaml
42
- python-version : 3.9
43
- auto-activate-base : false
44
- - name : XGrammar-Build@Py39
45
- run : >-
46
- scripts/build_xgrammar_lib_osx.sh ${{ matrix.platform == 'macos-13' && '10.15' || '13.02' }}
47
- - name : Wheel-Build@Py39
48
- run : |
49
- python --version
50
- python -m pip install setuptools Cython wheel
51
- cd python
52
- python setup.py bdist_wheel
53
- rm -rf xgrammar/*.so
54
- - name : Setup@Py310
55
- uses : conda-incubator/setup-miniconda@v3
56
- with :
57
- activate-environment : build-Py310
58
- channel-priority : strict
59
- environment-file : conda/build-environment.yaml
60
- python-version : ' 3.10'
61
- auto-activate-base : false
62
- - name : XGrammar-Build@Py310
63
- run : >-
64
- scripts/build_xgrammar_lib_osx.sh ${{ matrix.platform == 'macos-13' && '10.15' || '13.02' }}
65
- - name : Wheel-Build@Py310
66
- run : |
67
- python --version
68
- python -m pip install setuptools Cython wheel
69
- cd python
70
- python setup.py bdist_wheel
71
- rm -rf xgrammar/*.so
72
- - name : Setup@Py311
73
- uses : conda-incubator/setup-miniconda@v3
74
- with :
75
- activate-environment : build-Py311
76
- channel-priority : strict
77
- environment-file : conda/build-environment.yaml
78
- python-version : ' 3.11'
79
- auto-activate-base : false
80
- - name : XGrammar-Build@Py311
81
- run : >-
82
- scripts/build_xgrammar_lib_osx.sh ${{ matrix.platform == 'macos-13' && '10.15' || '13.02' }}
83
- - name : Wheel-Build@Py311
84
- run : |
85
- python --version
86
- python -m pip install setuptools Cython wheel
87
- cd python
88
- python setup.py bdist_wheel
89
- rm -rf xgrammar/*.so
90
- - name : Setup@Py312
91
- uses : conda-incubator/setup-miniconda@v3
92
- with :
93
- activate-environment : build-Py312
94
- channel-priority : strict
95
- environment-file : conda/build-environment.yaml
96
- python-version : ' 3.12'
97
- auto-activate-base : false
98
- - name : XGrammar-Build@Py312
99
- run : >-
100
- scripts/build_xgrammar_lib_osx.sh ${{ matrix.platform == 'macos-13' && '10.15' || '13.02' }}
101
- - name : Wheel-Build@Py312
102
- run : |
103
- python --version
104
- python -m pip install setuptools Cython wheel
105
- cd python
106
- python setup.py bdist_wheel
107
- rm -rf xgrammar/*.so
108
- - uses : actions/upload-artifact@v4
109
- with :
110
- name : xgrammar-wheel-${{ github.ref_name }}-${{ matrix.platform }}
111
- path : python/dist/
112
- retention-days : 3
113
- overwrite : true
21
+ - uses : actions/checkout@v3
22
+ with :
23
+ submodules : ' recursive'
24
+ - name : Checkout source
25
+ run : |
26
+ git clone https://github.com/mlc-ai/package package --recursive
27
+ - name : Setup script env
28
+ run : |
29
+ mv scripts/build-environment.yaml package/3rdparty/tlcpack/conda/build-environment.yaml
30
+ rm -rf conda
31
+ ln -s package/3rdparty/tlcpack/conda conda
32
+ - name : Sync XGrammar Package
33
+ run : |
34
+ python scripts/sync_package.py --package . --package-name xgrammar --version ${{ github.ref_name }}
35
+ # Build wheel for different python versions
36
+ - name : Setup@Py39
37
+ uses : conda-incubator/setup-miniconda@v3
38
+ with :
39
+ activate-environment : build-Py39
40
+ channel-priority : strict
41
+ environment-file : conda/build-environment.yaml
42
+ python-version : 3.9
43
+ auto-activate-base : false
44
+ - name : XGrammar-Build@Py39
45
+ run : >-
46
+ scripts/build_xgrammar_lib_osx.sh ${{ matrix.platform == 'macos-13' && '10.15' || '13.02' }}
47
+ - name : Wheel-Build@Py39
48
+ run : |
49
+ python --version
50
+ python -m pip install setuptools Cython wheel
51
+ cd python
52
+ python setup.py bdist_wheel
53
+ rm -rf xgrammar/*.so
54
+ - name : Setup@Py310
55
+ uses : conda-incubator/setup-miniconda@v3
56
+ with :
57
+ activate-environment : build-Py310
58
+ channel-priority : strict
59
+ environment-file : conda/build-environment.yaml
60
+ python-version : ' 3.10'
61
+ auto-activate-base : false
62
+ - name : XGrammar-Build@Py310
63
+ run : >-
64
+ scripts/build_xgrammar_lib_osx.sh ${{ matrix.platform == 'macos-13' && '10.15' || '13.02' }}
65
+ - name : Wheel-Build@Py310
66
+ run : |
67
+ python --version
68
+ python -m pip install setuptools Cython wheel
69
+ cd python
70
+ python setup.py bdist_wheel
71
+ rm -rf xgrammar/*.so
72
+ - name : Setup@Py311
73
+ uses : conda-incubator/setup-miniconda@v3
74
+ with :
75
+ activate-environment : build-Py311
76
+ channel-priority : strict
77
+ environment-file : conda/build-environment.yaml
78
+ python-version : ' 3.11'
79
+ auto-activate-base : false
80
+ - name : XGrammar-Build@Py311
81
+ run : >-
82
+ scripts/build_xgrammar_lib_osx.sh ${{ matrix.platform == 'macos-13' && '10.15' || '13.02' }}
83
+ - name : Wheel-Build@Py311
84
+ run : |
85
+ python --version
86
+ python -m pip install setuptools Cython wheel
87
+ cd python
88
+ python setup.py bdist_wheel
89
+ rm -rf xgrammar/*.so
90
+ - name : Setup@Py312
91
+ uses : conda-incubator/setup-miniconda@v3
92
+ with :
93
+ activate-environment : build-Py312
94
+ channel-priority : strict
95
+ environment-file : conda/build-environment.yaml
96
+ python-version : ' 3.12'
97
+ auto-activate-base : false
98
+ - name : XGrammar-Build@Py312
99
+ run : >-
100
+ scripts/build_xgrammar_lib_osx.sh ${{ matrix.platform == 'macos-13' && '10.15' || '13.02' }}
101
+ - name : Wheel-Build@Py312
102
+ run : |
103
+ python --version
104
+ python -m pip install setuptools Cython wheel
105
+ cd python
106
+ python setup.py bdist_wheel
107
+ rm -rf xgrammar/*.so
108
+ - uses : actions/upload-artifact@v4
109
+ with :
110
+ name : xgrammar-wheel-${{ github.ref_name }}-${{ matrix.platform }}
111
+ path : python/dist/
112
+ retention-days : 3
113
+ overwrite : true
114
114
115
115
Publish-to-PyPI :
116
116
needs :
117
- - Build
117
+ - Build
118
118
runs-on : ubuntu-latest
119
119
120
120
environment :
121
121
name : pypi
122
122
url : https://pypi.org/p/xgrammar
123
123
permissions :
124
- id-token : write # IMPORTANT: mandatory for trusted publishing
124
+ id-token : write # IMPORTANT: mandatory for trusted publishing
125
125
126
126
steps :
127
- - name : Download all the wheels
128
- uses : actions/download-artifact@v4
129
- with :
130
- pattern : xgrammar-wheel-${{ github.ref_name }}-macos-*
131
- path : python/dist/
132
- merge-multiple : true
133
- - name : Publish package distributions to PyPI
134
- uses : pypa/gh-action-pypi-publish@release/v1
135
- with :
136
- packages_dir : python/dist
137
- skip_existing : true
138
- verbose : true
127
+ - name : Download all the wheels
128
+ uses : actions/download-artifact@v4
129
+ with :
130
+ pattern : xgrammar-wheel-${{ github.ref_name }}-macos-*
131
+ path : python/dist/
132
+ merge-multiple : true
133
+ - name : Publish package distributions to PyPI
134
+ uses : pypa/gh-action-pypi-publish@release/v1
135
+ with :
136
+ packages_dir : python/dist
137
+ skip_existing : true
138
+ verbose : true
0 commit comments