@@ -2,60 +2,125 @@ name: Dist
22on :
33 schedule :
44 # gemini said this is 6:00 china time
5- - cron : ' 0 22 * * *'
5+ - cron : " 0 22 * * *"
6+ pull_request :
7+ types :
8+ - opened
9+ - synchronize
10+ - reopened
11+ - ready_for_review
12+ paths :
13+ - setup.py
14+ - setup.cfg
15+ - pyproject.toml
16+ - MANIFEST.in
17+ - CMakeLists.txt
18+ - version_provider.py
19+ - .github/workflows/dist.yml
620 release :
7- types : [ published ]
21+ types :
22+ - published
823
9- env :
10- PYTHON_VERSION : ' 3.12 '
24+ permissions :
25+ contents : read
1126
1227concurrency :
13- group : ${{ github.workflow }}-${{ github.ref }}
28+ group : " ${{ github.workflow }}-${{ github.ref }}"
1429 cancel-in-progress : true
1530
1631jobs :
1732 build-wheels :
33+ name : Build wheels for Python ${{ matrix.python-version }} on ${{ matrix.target.runner }} with ${{ matrix.target.toolkit }}
34+ if : |
35+ github.repository_owner == 'tile-ai' &&
36+ (github.event_name != 'pull_request' || !github.event.pull_request.draft)
1837 strategy :
1938 matrix :
20- os : [ubuntu-22.04, ubuntu-22.04-arm, macos-16]
21- include :
22- - os : ubuntu-22.04
23- cuda_version : " 12.1"
24- - os : ubuntu-22.04-arm
25- cuda_version : " 12.8"
26- fail-fast : true
27- runs-on : ${{ matrix.os }}
39+ target :
40+ - { runner: ubuntu-latest, toolkit: "CUDA-12.1" }
41+ - { runner: ubuntu-24.04-arm, toolkit: "CUDA-12.8" }
42+ - { runner: macos-latest, toolkit: "Metal" }
43+ python-version :
44+ - " 3.8"
45+ # TVM is built with Python 3.8 Limited API, it should work with all Python >= 3.8.
46+ # - "3.9"
47+ # - "3.10"
48+ # - "3.11"
49+ # - "3.12"
50+ # - "3.13"
51+ # - "3.14"
52+ fail-fast : false
53+ timeout-minutes : 120
54+ runs-on : ${{ matrix.target.runner }}
2855 env :
29- CUDA_VERSION : ${{ matrix.cuda_version }}
30- NO_VERSION_LABEL : ${{ github.event_name != 'release' }}
56+ NO_VERSION_LABEL : ${{ github.event_name == 'release' && 'OFF' || 'ON' }}
3157
3258 steps :
33- - name : Checkout repository
34- uses : actions/checkout@v4
35- with :
36- fetch-depth : 1
37- submodules : recursive
38-
39- - name : ccache
40- uses :
hendrikmuhs/[email protected] 41- if : startsWith(matrix.os, 'macos')
42- with :
43- create-symlink : true
44- key : ${{ github.job }}-${{ matrix.os }}
45-
46- - name : Build wheels
47- 48- with :
49- output-dir : wheelhouse
50- config-file : " {package}/pyproject.toml"
51-
52- # just for now to list all files
53- - name : List wheels
54- id : ls-whl
55- run : echo "whl_name=$(ls wheelhouse | head -n1)" >> $GITHUB_OUTPUT
56-
57- - uses : actions/upload-artifact@v4
58- with :
59- name : ${{ steps.ls-whl.outputs.whl_name }}.zip
60- path : wheelhouse/${{ steps.ls-whl.outputs.whl_name }}
61- compression-level : 0
59+ - name : Checkout repository
60+ uses : actions/checkout@v4
61+ with :
62+ fetch-depth : 1
63+ submodules : recursive
64+
65+ # NB: CIBW builds wheels in containers on Linux
66+ - name : Setup ccache (macOS only)
67+ if : runner.os == 'macOS'
68+ uses : hendrikmuhs/ccache-action@v1
69+ with :
70+ create-symlink : true
71+ key : ccache-${{ runner.os }}-${{ runner.arch }}-${{ matrix.python-version }}-${{ matrix.target.toolkit }}
72+ evict-old-files : " 7d"
73+
74+ - name : Set CIBW_BUILD
75+ run : |
76+ PYTHON_VERSION="${{ matrix.python-version }}"
77+ PYTHON_VERSION_MAJMIN="$(echo "${PYTHON_VERSION}" | cut -d '.' -f-2)"
78+ PYTHON_VERSION_MAJMIN_NODOT="${PYTHON_VERSION_MAJMIN//./}"
79+ echo "CIBW_BUILD=cp${PYTHON_VERSION_MAJMIN_NODOT}-*" | tee -a "${GITHUB_ENV}"
80+
81+ if [[ "${{ matrix.target.toolkit }}" == *"CUDA"* ]]; then
82+ CUDA_VERSION="${{ matrix.target.toolkit }}"
83+ CUDA_VERSION="${CUDA_VERSION#CUDA-}"
84+ echo "CUDA_VERSION=${CUDA_VERSION}" | tee -a "${GITHUB_ENV}"
85+ fi
86+
87+ - name : Build wheels
88+ 89+ with :
90+ package-dir : .
91+ output-dir : wheelhouse
92+ config-file : " {package}/pyproject.toml"
93+
94+ - name : Upload wheels
95+ # Not PR to save artifact storage, as wheels are only needed for releases.
96+ if : github.event_name != 'pull_request'
97+ uses : actions/upload-artifact@v4
98+ with :
99+ name : wheels-${{ matrix.python-version }}-${{ runner.os }}-${{ runner.arch }}-${{ matrix.target.toolkit }}
100+ path : wheelhouse/*.whl
101+ if-no-files-found : error
102+
103+ list-artifacts :
104+ name : List artifacts
105+ # Not PR to save artifact storage, as wheels are only needed for releases.
106+ if : github.event_name != 'pull_request'
107+ runs-on : ubuntu-latest
108+ needs : [build-wheels]
109+ timeout-minutes : 15
110+ steps :
111+ - name : Download built wheels
112+ uses : actions/download-artifact@v5
113+ with :
114+ pattern : wheels-*
115+ path : dist
116+ merge-multiple : true
117+
118+ - name : List distributions
119+ run : ls -lh dist/*
120+
121+ - name : Upload artifacts
122+ uses : actions/upload-artifact@v4
123+ with :
124+ name : artifacts
125+ path : dist/*
126+ if-no-files-found : error
0 commit comments