Skip to content

Commit 9bd8756

Browse files
authored
[Build][CI] Build and test SDist in release CI (tile-ai#1098)
1 parent 6ac309c commit 9bd8756

File tree

4 files changed

+153
-20
lines changed

4 files changed

+153
-20
lines changed

.github/workflows/ci.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ env:
2222
PYTHONDEVMODE: "1"
2323
PYTHONUNBUFFERED: "1"
2424
PYTHONPATH: "" # explicit cleanup
25+
COLUMNS: "100"
2526
FORCE_COLOR: "1"
2627
CLICOLOR_FORCE: "1"
2728
UV_INDEX_STRATEGY: "unsafe-best-match"

.github/workflows/dist.yml

Lines changed: 77 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,74 @@ concurrency:
2828
group: "${{ github.workflow }}-${{ github.ref }}"
2929
cancel-in-progress: true
3030

31+
env:
32+
PYTHONDEVMODE: "1"
33+
PYTHONUNBUFFERED: "1"
34+
COLUMNS: "100"
35+
FORCE_COLOR: "1"
36+
CLICOLOR_FORCE: "1"
37+
3138
jobs:
39+
build-sdist:
40+
name: Build SDist
41+
if: |
42+
github.repository_owner == 'tile-ai' &&
43+
(github.event_name != 'pull_request' || !github.event.pull_request.draft)
44+
runs-on: macos-latest
45+
timeout-minutes: 30
46+
env:
47+
NO_VERSION_LABEL: ${{ github.event_name == 'release' && 'OFF' || 'ON' }}
48+
# NO_GIT_VERSION disables embedding the git commit hash in version metadata.
49+
# Otherwise, the version of the SDist has a git hash suffix (e.g., 0.1.0+gitabcdef12),
50+
# but the package built from the SDist has no way to get the git hash (it is not a git repo),
51+
# leading to inconsistent versions between SDist and built packages (+gitabcdef12 vs. +gitunknown).
52+
NO_GIT_VERSION: "ON"
53+
54+
steps:
55+
- name: Checkout repository
56+
uses: actions/checkout@v5
57+
with:
58+
fetch-depth: 1
59+
submodules: recursive
60+
61+
- name: Setup Python and uv with caching
62+
id: setup-uv
63+
uses: astral-sh/setup-uv@v7
64+
with:
65+
python-version: "3.12"
66+
activate-environment: true
67+
68+
- name: Build SDist
69+
run: |
70+
uv run --no-project --with=build -m -- build --sdist --outdir=dist
71+
72+
- name: Setup ccache
73+
uses: hendrikmuhs/ccache-action@v1
74+
with:
75+
create-symlink: true
76+
key: ccache-${{ runner.os }}-${{ runner.arch }}
77+
evict-old-files: "7d"
78+
79+
- name: Test SDist buildable
80+
run: |
81+
TEMP_DIR="$(mktemp -d -t tilelang-sdist-test)"
82+
cp -r dist "${TEMP_DIR}/dist"
83+
uv venv --seed "${TEMP_DIR}/venv"
84+
source "${TEMP_DIR}/venv/bin/activate"
85+
cd "${TEMP_DIR}"
86+
python3 -m pip install --upgrade pip setuptools wheel
87+
python3 -m pip install -v dist/*.tar.gz
88+
python3 -c "import tilelang; print(tilelang.__version__)"
89+
90+
- name: Upload SDist
91+
# Not PR to save artifact storage, as SDist is only needed for releases.
92+
if: github.event_name != 'pull_request'
93+
uses: actions/upload-artifact@v4
94+
with:
95+
name: sdist
96+
path: dist/*.tar.gz
97+
if-no-files-found: error
98+
3299
build-wheels:
33100
name: Build wheels for Python ${{ matrix.python-version }} on ${{ matrix.target.runner }} with ${{ matrix.target.toolkit }}
34101
if: |
@@ -102,12 +169,20 @@ jobs:
102169

103170
list-artifacts:
104171
name: List artifacts
105-
# Not PR to save artifact storage, as wheels are only needed for releases.
172+
# Not PR to save artifact storage, as artifacts are only needed for releases.
106173
if: github.event_name != 'pull_request'
107174
runs-on: ubuntu-latest
108-
needs: [build-wheels]
175+
needs: [build-sdist, build-wheels]
109176
timeout-minutes: 15
110177
steps:
178+
- name: Download built SDist
179+
uses: actions/download-artifact@v5
180+
with:
181+
# unpacks default artifact into dist/
182+
# if `name: artifact` is omitted, the action will create extra parent dir
183+
name: sdist
184+
path: dist
185+
111186
- name: Download built wheels
112187
uses: actions/download-artifact@v6
113188
with:

MANIFEST.in

Lines changed: 33 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,35 @@
1+
# Reference: https://setuptools.pypa.io/en/latest/userguide/miscellaneous.html
2+
3+
# Include licenses
14
include VERSION
2-
include CMakeLists.txt
3-
include requirements.txt
4-
include requirements-test.txt
5-
include requirements-dev.txt
5+
include LICENSE
6+
include THIRDPARTYNOTICES.txt
7+
8+
# Version and dependency files
9+
include version_provider.py
10+
include requirements*.txt
611
include tilelang/jit/adapter/cython/cython_wrapper.pyx
7-
recursive-include src *
8-
recursive-include 3rdparty *
9-
recursive-exclude 3rdparty/clang* *
10-
recursive-exclude 3rdparty/llvm* *
12+
13+
# Include source files in SDist
14+
include CMakeLists.txt
15+
graft src
16+
graft cmake
17+
graft 3rdparty
18+
19+
# Include test suites in SDist
20+
graft testing
21+
graft examples
22+
global-exclude .coverage .coverage.* coverage.xml coverage-*.xml coverage.*.xml
23+
global-exclude .junit .junit.* junit.xml junit-*.xml junit.*.xml
24+
25+
# Exclude unneeded files and directories
26+
prune .git
27+
prune .github
28+
prune */.git
29+
prune */.github
30+
prune 3rdparty/clang*
31+
prune 3rdparty/llvm*
32+
33+
# Prune compiled files
34+
prune */__pycache__
35+
global-exclude *~ *.py[cod] *.so *.a *.dylib *.pxd *.dll *.lib *.o *.obj

pyproject.toml

Lines changed: 42 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,8 @@ name = "tilelang"
33
description = "A tile level programming language to generate high performance code."
44
readme = "README.md"
55
requires-python = ">=3.8"
6-
authors = [{name = "TileLang Contributors"}, {name = "Tile-AI"}]
7-
maintainers = [{name = "Lei Wang", email = "leiwang1999@outlook.com"}]
6+
authors = [{ name = "TileLang Contributors" }, { name = "Tile-AI" }]
7+
maintainers = [{ name = "Lei Wang", email = "leiwang1999@outlook.com" }]
88
license = "MIT"
99
keywords = ["BLAS", "CUDA", "HIP", "Code Generation", "TVM"]
1010
classifiers = [
@@ -58,16 +58,39 @@ metadata.version.provider = "version_provider"
5858
metadata.version.provider-path = "."
5959
experimental = true
6060

61+
[tool.scikit-build.sdist]
62+
# See MANIFEST.in for details
63+
include = [
64+
"VERSION",
65+
"LICENSE",
66+
"THIRDPARTYNOTICES.txt",
67+
"version_provider.py",
68+
"requirements*.txt",
69+
"tilelang/jit/adapter/cython/cython_wrapper.pyx",
70+
"CMakeLists.txt",
71+
"src/**",
72+
"cmake/**",
73+
"3rdparty/**",
74+
"testing/**",
75+
"examples/**",
76+
]
77+
exclude = [
78+
".git",
79+
".github",
80+
"**/.git",
81+
"**/.github",
82+
"3rdparty/clang**",
83+
"3rdparty/llvm**",
84+
"build",
85+
]
86+
6187
[tool.scikit-build.wheel.packages]
6288
tilelang = "tilelang"
6389
"tilelang/src" = "src"
90+
# NOTE: The mapping below places the contents of '3rdparty' inside 'tilelang/3rdparty' in the wheel.
91+
# This is necessary to find TVM shared libraries at runtime.
6492
"tilelang/3rdparty" = "3rdparty"
6593

66-
# TODO: we might want to not include these in wheel?
67-
"tilelang/benchmark" = "benchmark"
68-
"tilelang/examples" = "examples"
69-
"tilelang/testing" = "testing"
70-
7194
[tool.yapf]
7295
based_on_style = "yapf"
7396
column_limit = 100
@@ -142,18 +165,27 @@ filterwarnings = ["always"]
142165

143166
[tool.cibuildwheel]
144167
archs = ["auto64"]
168+
skip = "*musllinux*"
169+
build-frontend = "build"
170+
environment = { PYTHONDEVMODE = "1", PYTHONUNBUFFERED = "1" }
171+
environment-pass = [
172+
"CUDA_VERSION",
173+
"COLUMNS",
174+
"FORCE_COLOR",
175+
"CLICOLOR_FORCE",
176+
]
177+
before-build = "env -0 | sort -z | tr '\\0' '\\n'"
178+
windows.before-build = "set"
145179
# Pin to glibc 2.17 for x86 and 2.28 for aarch64 for now
146180
manylinux-x86_64-image = "manylinux2014"
147181
manylinux-aarch64-image = "manylinux_2_28"
148-
skip = "*musllinux*"
149-
environment-pass = ["CUDA_VERSION"]
150182

151183
[tool.cibuildwheel.linux]
184+
environment = { PYTHONDEVMODE = "1", PYTHONUNBUFFERED = "1", PATH = "/usr/local/cuda/bin:$PATH" }
152185
repair-wheel-command = [
153186
"auditwheel repair --exclude libcuda.so.1 --exclude '/usr/local/cuda*' -w {dest_dir} {wheel}",
154187
"pipx run abi3audit --strict --report {wheel}",
155188
]
156-
environment.PATH = "/usr/local/cuda/bin:$PATH"
157189
# Install CUDA runtime and stub driver library
158190
# manylinux_2_28 uses gcc 14, which needs CUDA 12.8
159191
before-all = """

0 commit comments

Comments
 (0)