1- # Relevant GHA docs links:
2- # https://docs.github.com/en/actions/using-jobs/running-jobs-in-a-container
3- # https://docs.github.com/en/packages/managing-github-packages-using-github-actions-workflows/publishing-and-installing-a-package-with-github-actions#upgrading-a-workflow-that-accesses-ghcrio
4-
51name : Build PyPI package
62
73on :
128
139env :
1410 # TODO: detect this from repo somehow: https://github.com/halide/Halide/issues/8406
15- LLVM_VERSION : 21.1.1
11+ LLVM_VERSION : 21.1.8
1612 FLATBUFFERS_VERSION : 23.5.26
1713 WABT_VERSION : 1.0.36
1814
@@ -22,7 +18,6 @@ concurrency:
2218
2319permissions :
2420 contents : read # to fetch code (actions/checkout)
25- packages : read # to fetch packages (docker)
2621
2722jobs :
2823 build-wheels :
4641 MACOSX_DEPLOYMENT_TARGET : 11
4742
4843 steps :
49- - name : Login to GitHub Container Registry
50- if : matrix.os == 'ubuntu-latest'
51- uses : docker/login-action@v3
52- with :
53- registry : ghcr.io
54- username : ${{ github.actor }}
55- password : ${{ secrets.GITHUB_TOKEN }}
56-
5744 - uses : actions/checkout@v4
5845 with :
5946 fetch-depth : 0
@@ -62,135 +49,17 @@ jobs:
6249 - uses : ilammy/msvc-dev-cmd@v1
6350 - uses : lukka/get-cmake@v3.28.4
6451
65- # #######################################################################
66- # flatbuffers
67- # #######################################################################
68-
69- - name : Cache flatbuffers build folder
70- if : matrix.os != 'ubuntu-latest'
71- id : cache-flatbuffers
72- uses : actions/cache@v4
73- with :
74- path : opt/flatbuffers
75- key : flatbuffers-${{ env.FLATBUFFERS_VERSION }}-${{ matrix.platform_tag }}
76-
77- - uses : actions/checkout@v4
78- if : matrix.os != 'ubuntu-latest' && steps.cache-flatbuffers.outputs.cache-hit != 'true'
79- with :
80- path : flatbuffers-src
81- repository : google/flatbuffers
82- ref : v${{ env.FLATBUFFERS_VERSION }}
83-
84- - name : Configure flatbuffers
85- if : matrix.os != 'ubuntu-latest' && steps.cache-flatbuffers.outputs.cache-hit != 'true'
86- run : >
87- cmake -G Ninja -S flatbuffers-src -B flatbuffers-build
88- "-DCMAKE_BUILD_TYPE=Release"
89- "-DCMAKE_INSTALL_PREFIX=${{ github.workspace }}/opt/flatbuffers"
90- "-DFLATBUFFERS_BUILD_TESTS=NO"
91-
92- - name : Install flatbuffers
93- if : matrix.os != 'ubuntu-latest' && steps.cache-flatbuffers.outputs.cache-hit != 'true'
94- run : |
95- cmake --build flatbuffers-build --target install
96- cmake -E rm -rf flatbuffers-src flatbuffers-build
97-
98- # #######################################################################
99- # wabt
100- # #######################################################################
101-
102- - name : Cache wabt build folder
103- if : matrix.os != 'ubuntu-latest' && matrix.os != 'windows-latest'
104- id : cache-wabt
105- uses : actions/cache@v4
106- with :
107- path : opt/wabt
108- key : wabt-${{ env.WABT_VERSION }}-${{ matrix.platform_tag }}
109-
110- - uses : actions/checkout@v4
111- if : >
112- matrix.os != 'ubuntu-latest' && matrix.os != 'windows-latest'
113- && steps.cache-wabt.outputs.cache-hit != 'true'
114- with :
115- submodules : ' true'
116- path : wabt-src
117- repository : WebAssembly/wabt
118- ref : ${{ env.WABT_VERSION }}
119-
120- - name : Configure wabt
121- if : >
122- matrix.os != 'ubuntu-latest' && matrix.os != 'windows-latest'
123- && steps.cache-wabt.outputs.cache-hit != 'true'
124- run : >
125- cmake -G Ninja -S wabt-src -B wabt-build
126- "-DCMAKE_BUILD_TYPE=Release"
127- "-DCMAKE_INSTALL_PREFIX=${{ github.workspace }}/opt/wabt"
128- "-DWITH_EXCEPTIONS=ON"
129- "-DBUILD_TESTS=OFF"
130- "-DBUILD_TOOLS=OFF"
131- "-DBUILD_LIBWASM=OFF"
132- "-DUSE_INTERNAL_SHA256=ON"
133-
134- - name : Install wabt
135- if : >
136- matrix.os != 'ubuntu-latest' && matrix.os != 'windows-latest'
137- && steps.cache-wabt.outputs.cache-hit != 'true'
138- run : |
139- cmake --build wabt-build --target install
140- cmake -E rm -rf wabt-src wabt-build
141-
14252 # #######################################################################
14353 # LLVM
14454 # #######################################################################
14555
146- - name : Cache LLVM build folder
147- if : matrix.os != 'ubuntu-latest'
148- id : cache-llvm
149- uses : actions/cache@v4
150- with :
151- path : opt/llvm
152- key : llvm-${{ env.LLVM_VERSION }}-${{ matrix.platform_tag }}
153-
154- - uses : actions/checkout@v4
155- if : matrix.os != 'ubuntu-latest' && steps.cache-llvm.outputs.cache-hit != 'true'
156- with :
157- path : llvm-src
158- repository : llvm/llvm-project
159- ref : llvmorg-${{ env.LLVM_VERSION }}
160-
161- - name : Configure LLVM
162- if : matrix.os != 'ubuntu-latest' && steps.cache-llvm.outputs.cache-hit != 'true'
163- run : >
164- cmake -G Ninja -S llvm-src/llvm -B llvm-build
165- "-DCMAKE_BUILD_TYPE=Release"
166- "-DCMAKE_INSTALL_PREFIX=${{ github.workspace }}/opt/llvm"
167- "-DLLVM_ENABLE_ASSERTIONS=ON"
168- "-DLLVM_ENABLE_BINDINGS=OFF"
169- "-DLLVM_ENABLE_CURL=OFF"
170- "-DLLVM_ENABLE_DIA_SDK=OFF"
171- "-DLLVM_ENABLE_EH=ON"
172- "-DLLVM_ENABLE_HTTPLIB=OFF"
173- "-DLLVM_ENABLE_IDE=OFF"
174- "-DLLVM_ENABLE_LIBEDIT=OFF"
175- "-DLLVM_ENABLE_LIBXML2=OFF"
176- "-DLLVM_ENABLE_OCAMLDOC=OFF"
177- "-DLLVM_ENABLE_PROJECTS=clang;lld"
178- "-DLLVM_ENABLE_RTTI=ON"
179- "-DLLVM_ENABLE_RUNTIMES=compiler-rt"
180- "-DLLVM_ENABLE_TERMINFO=OFF"
181- "-DLLVM_ENABLE_WARNINGS=OFF"
182- "-DLLVM_ENABLE_ZLIB=OFF"
183- "-DLLVM_ENABLE_ZSTD=OFF"
184- "-DLLVM_INCLUDE_BENCHMARKS=OFF"
185- "-DLLVM_INCLUDE_EXAMPLES=OFF"
186- "-DLLVM_INCLUDE_TESTS=OFF"
187- "-DLLVM_TARGETS_TO_BUILD=WebAssembly;X86;AArch64;ARM;Hexagon;NVPTX;PowerPC;RISCV"
188-
18956 - name : Install LLVM
190- if : matrix.os != 'ubuntu-latest' && steps.cache-llvm.outputs.cache-hit != 'true'
57+ if : matrix.os != 'ubuntu-latest'
58+ shell : bash
19159 run : |
192- cmake --build llvm-build --target install
193- cmake -E rm -rf llvm-src llvm-build
60+ pip install "halide-llvm==${{ env.LLVM_VERSION }}" \
61+ --extra-index-url https://pypi.halide-lang.org/simple/
62+ echo "Halide_LLVM_ROOT=$(halide-llvm --prefix)" >> "$GITHUB_ENV"
19463
19564 # #######################################################################
19665 # Wheels
@@ -199,12 +68,66 @@ jobs:
19968 # - uses: mxschmitt/action-tmate@v3
20069
20170 - name : Build wheels
202- uses : pypa/cibuildwheel@v2.20.0
71+ uses : pypa/cibuildwheel@v3.3.1
20372 env :
20473 CIBW_BUILD : " cp3*-${{ matrix.platform_tag }}"
205- CIBW_SKIP : " cp3{5,6,7,8,9}*"
206- # Suppress the git version tag (necessary for TestPyPI)
207- CIBW_ENVIRONMENT : >
74+ CIBW_SKIP : " cp3{5,6,7,8,9}* cp314t-*"
75+ CIBW_BEFORE_ALL_LINUX : >
76+ /opt/python/cp312-cp312/bin/pip install cmake ninja
77+ "halide-llvm==${{ env.LLVM_VERSION }}"
78+ --extra-index-url https://pypi.halide-lang.org/simple/ &&
79+ export PATH="/opt/python/cp312-cp312/bin:$PATH" &&
80+ mkdir -p {project}/opt &&
81+ ln -s $(halide-llvm --prefix) {project}/opt/llvm &&
82+ git clone --depth=1 -b v${{ env.FLATBUFFERS_VERSION }}
83+ https://github.com/google/flatbuffers /tmp/fb-src &&
84+ cmake -G Ninja -S /tmp/fb-src -B /tmp/fb-build
85+ -DCMAKE_BUILD_TYPE=Release
86+ -DCMAKE_INSTALL_PREFIX={project}/opt/flatbuffers
87+ -DFLATBUFFERS_BUILD_TESTS=NO &&
88+ cmake --build /tmp/fb-build --target install &&
89+ git clone --depth=1 --recurse-submodules -b ${{ env.WABT_VERSION }}
90+ https://github.com/WebAssembly/wabt /tmp/wabt-src &&
91+ cmake -G Ninja -S /tmp/wabt-src -B /tmp/wabt-build
92+ -DCMAKE_BUILD_TYPE=Release
93+ -DCMAKE_POSITION_INDEPENDENT_CODE=ON
94+ -DCMAKE_INSTALL_PREFIX={project}/opt/wabt
95+ -DWITH_EXCEPTIONS=ON
96+ -DBUILD_TESTS=OFF
97+ -DBUILD_TOOLS=OFF
98+ -DBUILD_LIBWASM=OFF
99+ -DUSE_INTERNAL_SHA256=ON &&
100+ cmake --build /tmp/wabt-build --target install
101+ CIBW_BEFORE_ALL_MACOS : >
102+ git clone --depth=1 -b v${{ env.FLATBUFFERS_VERSION }}
103+ https://github.com/google/flatbuffers /tmp/fb-src &&
104+ cmake -G Ninja -S /tmp/fb-src -B /tmp/fb-build
105+ -DCMAKE_BUILD_TYPE=Release
106+ -DCMAKE_INSTALL_PREFIX={project}/opt/flatbuffers
107+ -DFLATBUFFERS_BUILD_TESTS=NO &&
108+ cmake --build /tmp/fb-build --target install &&
109+ git clone --depth=1 --recurse-submodules -b ${{ env.WABT_VERSION }}
110+ https://github.com/WebAssembly/wabt /tmp/wabt-src &&
111+ cmake -G Ninja -S /tmp/wabt-src -B /tmp/wabt-build
112+ -DCMAKE_BUILD_TYPE=Release
113+ -DCMAKE_INSTALL_PREFIX={project}/opt/wabt
114+ -DWITH_EXCEPTIONS=ON
115+ -DBUILD_TESTS=OFF
116+ -DBUILD_TOOLS=OFF
117+ -DBUILD_LIBWASM=OFF
118+ -DUSE_INTERNAL_SHA256=ON &&
119+ cmake --build /tmp/wabt-build --target install
120+ CIBW_BEFORE_ALL_WINDOWS : >
121+ git clone --depth=1 -b v${{ env.FLATBUFFERS_VERSION }}
122+ https://github.com/google/flatbuffers %TEMP%\fb-src &&
123+ cmake -G Ninja -S %TEMP%\fb-src -B %TEMP%\fb-build
124+ -DCMAKE_BUILD_TYPE=Release
125+ -DCMAKE_INSTALL_PREFIX={project}/opt/flatbuffers
126+ -DFLATBUFFERS_BUILD_TESTS=NO &&
127+ cmake --build %TEMP%\fb-build --target install
128+ CIBW_ENVIRONMENT_LINUX : >
129+ Halide_LLVM_ROOT=/project/opt/llvm
130+ CMAKE_PREFIX_PATH=/project/opt
208131 SETUPTOOLS_SCM_OVERRIDES_FOR_HALIDE='{local_scheme="no-local-version"}'
209132 CIBW_ENVIRONMENT_MACOS : >
210133 CMAKE_PREFIX_PATH='${{ github.workspace }}/opt'
@@ -214,7 +137,7 @@ jobs:
214137 CMAKE_GENERATOR=Ninja
215138 CMAKE_PREFIX_PATH='${{ github.workspace }}\opt'
216139 SETUPTOOLS_SCM_OVERRIDES_FOR_HALIDE='{local_scheme="no-local-version"}'
217- CIBW_MANYLINUX_X86_64_IMAGE : " ghcr.io/halide/manylinux_2_28_x86_64-llvm:${{ env.LLVM_VERSION }} "
140+ CIBW_BEFORE_TEST_LINUX : pip install cmake ninja
218141 CIBW_TEST_COMMAND : >
219142 cmake -G Ninja -S {project}/python_bindings/apps -B build -DCMAKE_BUILD_TYPE=Release &&
220143 cmake --build build &&
@@ -248,7 +171,7 @@ jobs:
248171 with :
249172 user : upload
250173 password : ${{ secrets.HALIDE_PYPI_PASSWORD }}
251- repository-url : https://pypi.halide-lang.org/legacy/
174+ repository-url : https://pypi.halide-lang.org/
252175
253176 - uses : pypa/gh-action-pypi-publish@release/v1
254177 if : github.event_name == 'release' && github.event.action == 'published'
0 commit comments