@@ -29,6 +29,61 @@ concurrency:
2929 cancel-in-progress : true
3030
3131jobs :
32+ build-sdist :
33+ name : Build SDist
34+ if : |
35+ github.repository_owner == 'tile-ai' &&
36+ (github.event_name != 'pull_request' || !github.event.pull_request.draft)
37+ runs-on : macos-latest
38+ timeout-minutes : 30
39+ env :
40+ NO_VERSION_LABEL : ${{ github.event_name == 'release' && 'OFF' || 'ON' }}
41+
42+ steps :
43+ - name : Checkout repository
44+ uses : actions/checkout@v5
45+ with :
46+ fetch-depth : 1
47+ submodules : recursive
48+
49+ - name : Setup Python and uv with caching
50+ id : setup-uv
51+ uses : astral-sh/setup-uv@v7
52+ with :
53+ python-version : " 3.12"
54+ activate-environment : true
55+
56+ - name : Setup ccache (macOS only)
57+ if : runner.os == 'macOS'
58+ uses : hendrikmuhs/ccache-action@v1
59+ with :
60+ create-symlink : true
61+ key : ccache-${{ runner.os }}-${{ runner.arch }}
62+ evict-old-files : " 7d"
63+
64+ - name : Build SDist
65+ run : |
66+ uv run --no-project --with=build -m -- build --sdist --outdir=dist
67+
68+ - name : Test SDist buildable
69+ run : |
70+ TEMP_DIR="$(mktemp -d -t tilelang-sdist-test)"
71+ cp -r dist "${TEMP_DIR}/dist"
72+ uv run --no-project -m -- venv "${TEMP_DIR}/venv"
73+ source "${TEMP_DIR}/venv/bin/activate"
74+ cd "${TEMP_DIR}"
75+ python3 -m pip install --upgrade pip setuptools wheel
76+ python3 -m pip install -v dist/*.tar.gz
77+
78+ - name : Upload SDist
79+ # Not PR to save artifact storage, as wheels are only needed for releases.
80+ if : github.event_name != 'pull_request'
81+ uses : actions/upload-artifact@v4
82+ with :
83+ name : sdist
84+ path : dist/*.tar.gz
85+ if-no-files-found : error
86+
3287 build-wheels :
3388 name : Build wheels for Python ${{ matrix.python-version }} on ${{ matrix.target.runner }} with ${{ matrix.target.toolkit }}
3489 if : |
@@ -105,9 +160,17 @@ jobs:
105160 # Not PR to save artifact storage, as wheels are only needed for releases.
106161 if : github.event_name != 'pull_request'
107162 runs-on : ubuntu-latest
108- needs : [build-wheels]
163+ needs : [build-sdist, build- wheels]
109164 timeout-minutes : 15
110165 steps :
166+ - name : Download built SDist
167+ uses : actions/download-artifact@v5
168+ with :
169+ # unpacks default artifact into dist/
170+ # if `name: artifact` is omitted, the action will create extra parent dir
171+ name : sdist
172+ path : dist
173+
111174 - name : Download built wheels
112175 uses : actions/download-artifact@v5
113176 with :
0 commit comments