forked from tile-ai/tilelang
-
Notifications
You must be signed in to change notification settings - Fork 0
225 lines (199 loc) · 7.16 KB
/
dist-paddle.yml
File metadata and controls
225 lines (199 loc) · 7.16 KB
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
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
name: Dist Paddle
on:
push:
branches: [paddle]
tags: ["v*"]
pull_request:
merge_group:
workflow_dispatch:
permissions:
contents: read
concurrency:
group: "${{ github.workflow }}-${{ github.ref }}"
cancel-in-progress: true
env:
PYTHONDEVMODE: "1"
PYTHONUNBUFFERED: "1"
COLUMNS: "100"
FORCE_COLOR: "1"
CLICOLOR_FORCE: "1"
jobs:
build-sdist:
name: Build SDist
runs-on: macos-latest
timeout-minutes: 30
env:
# `NO_VERSION_LABEL=ON` disables embedding the toolchain / git commit hash in version metadata.
# Otherwise, the version of the SDist has a git hash suffix (e.g., 0.1.0+gitabcdef12),
# but the package built from the SDist has no way to get the git hash (it is not a git repo),
# leading to inconsistent versions between SDist and built packages (+gitabcdef12 vs. +gitunknown).
NO_VERSION_LABEL: "ON"
steps:
- name: Checkout repository
uses: actions/checkout@v5
with:
fetch-depth: 1
submodules: recursive
- name: Setup Python and uv with caching
id: setup-uv
uses: astral-sh/setup-uv@v7
with:
python-version: "3.12"
activate-environment: true
- name: Build SDist
run: |
uv run --no-project --with=build -m -- build --sdist --outdir=dist
- name: Setup ccache
uses: hendrikmuhs/ccache-action@v1
with:
create-symlink: true
evict-old-files: "7d"
append-timestamp: false
key: sdist-${{ runner.os }}-${{ runner.arch }}-${{ hashFiles('**/*.cc') }}
restore-keys: |
sdist-${{ runner.os }}-${{ runner.arch }}-${{ hashFiles('**/*.cc') }}
sdist-${{ runner.os }}-${{ runner.arch }}
${{ runner.os }}-${{ runner.arch }}
- name: Test SDist buildable
run: |
TEMP_DIR="$(mktemp -d -t tilelang-sdist-test)"
cp -r dist "${TEMP_DIR}/dist"
cd "${TEMP_DIR}"
uv pip install -v dist/*.tar.gz
# python3 -c "import tilelang; print(tilelang.__version__)"
- name: Upload SDist
# Not PR to save artifact storage, as SDist is only needed for releases.
uses: actions/upload-artifact@v5
with:
name: sdist
path: dist/*.tar.gz
if-no-files-found: error
build-wheels:
name: Build wheels for Python ${{ matrix.python-version }} on ${{ matrix.target.runner }} with ${{ matrix.target.toolkit }}
strategy:
matrix:
target:
- { runner: ubuntu-latest, toolkit: "CUDA-12.1" }
- { runner: ubuntu-24.04-arm, toolkit: "CUDA-12.8" }
- { runner: macos-latest, toolkit: "Metal" }
python-version:
# Wheels are built with Python 3.8 Limited API, they should work with all Python >= 3.8.
# Only build wheels against Python 3.8 Limited API to save CI resources.
- "3.9"
fail-fast: false
timeout-minutes: 120
runs-on: ${{ matrix.target.runner }}
env:
NO_VERSION_LABEL: ${{ github.event_name == 'release' && 'OFF' || 'ON' }}
steps:
- name: Checkout repository
uses: actions/checkout@v5
with:
fetch-depth: 1
submodules: recursive
- name: Setup ccache
uses: hendrikmuhs/ccache-action@v1
with:
create-symlink: true
evict-old-files: "7d"
append-timestamp: false
key: wheel-${{ runner.os }}-${{ runner.arch }}-${{ matrix.target.toolkit }}-${{ hashFiles('**/*.cc') }}
restore-keys: |
wheel-${{ runner.os }}-${{ runner.arch }}-${{ matrix.target.toolkit }}-${{ hashFiles('**/*.cc') }}
wheel-${{ runner.os }}-${{ runner.arch }}-${{ matrix.target.toolkit }}
wheel-${{ runner.os }}-${{ runner.arch }}
${{ runner.os }}-${{ runner.arch }}-${{ matrix.target.toolkit }}
${{ runner.os }}-${{ runner.arch }}
- name: Set CIBW_BUILD
run: |
PYTHON_VERSION="${{ matrix.python-version }}"
PYTHON_VERSION_MAJMIN="$(echo "${PYTHON_VERSION}" | cut -d '.' -f-2)"
PYTHON_VERSION_MAJMIN_NODOT="${PYTHON_VERSION_MAJMIN//./}"
echo "CIBW_BUILD=cp${PYTHON_VERSION_MAJMIN_NODOT}-*" | tee -a "${GITHUB_ENV}"
if [[ "${{ matrix.target.toolkit }}" == *"CUDA"* ]]; then
CUDA_VERSION="${{ matrix.target.toolkit }}"
CUDA_VERSION="${CUDA_VERSION#CUDA-}"
echo "CUDA_VERSION=${CUDA_VERSION}" | tee -a "${GITHUB_ENV}"
fi
if [[ "${{ runner.os }}" == "Linux" ]]; then
HOST_CCACHE_DIR="$(ccache --get-config cache_dir)"
echo "CIBW_BEFORE_BUILD_LINUX=yum install -y ccache && ccache -o cache_dir=/host${HOST_CCACHE_DIR}" | tee -a "${GITHUB_ENV}"
fi
- name: Build wheels
uses: pypa/cibuildwheel@v3.2
with:
package-dir: .
output-dir: wheelhouse
config-file: "{package}/pyproject.toml"
- name: Upload wheels
# Not PR to save artifact storage, as wheels are only needed for releases.
uses: actions/upload-artifact@v5
with:
name: wheels-${{ matrix.python-version }}-${{ runner.os }}-${{ runner.arch }}-${{ matrix.target.toolkit }}
path: wheelhouse/*.whl
if-no-files-found: error
list-artifacts:
name: List artifacts
# Not PR to save artifact storage, as artifacts are only needed for releases.
runs-on: ubuntu-latest
needs: [build-sdist, build-wheels]
timeout-minutes: 15
steps:
- name: Download built SDist
uses: actions/download-artifact@v6
with:
# unpacks default artifact into dist/
# if `name: artifact` is omitted, the action will create extra parent dir
name: sdist
path: dist
- name: Download built wheels
uses: actions/download-artifact@v6
with:
pattern: wheels-*
path: dist
merge-multiple: true
- name: List distributions
run: ls -lh dist/*
- name: Upload artifacts
uses: actions/upload-artifact@v5
with:
name: artifacts
path: dist/*
if-no-files-found: error
publish-pypi:
runs-on: ubuntu-latest
name: Publish to PyPI
if: "startsWith(github.ref, 'refs/tags/')"
needs:
- list-artifacts
permissions:
id-token: write
steps:
- name: Retrieve release distributions
uses: actions/download-artifact@v6
with:
name: artifacts
path: dist/
- name: Publish release distributions to PyPI
uses: pypa/gh-action-pypi-publish@release/v1
publish-release:
runs-on: ubuntu-latest
name: Publish to GitHub
if: "startsWith(github.ref, 'refs/tags/')"
needs:
- list-artifacts
permissions:
contents: write
steps:
- uses: actions/download-artifact@v6
with:
name: artifacts
path: dist/
- name: Get tag name
run: echo "RELEASE_VERSION=${GITHUB_REF#refs/*/}" >> $GITHUB_ENV
- name: Publish to GitHub
uses: softprops/action-gh-release@v2
with:
draft: true
files: dist/*
tag_name: ${{ env.RELEASE_VERSION }}