Skip to content

Commit 897063e

Browse files
committed
Adds cibuildwheels
1 parent 2ea2f13 commit 897063e

File tree

3 files changed

+82
-36
lines changed

3 files changed

+82
-36
lines changed

.github/workflows/build.yml

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
name: Build
2+
3+
on: [push, pull_request]
4+
5+
jobs:
6+
build_wheels:
7+
name: Build wheels on ${{ matrix.os }}
8+
runs-on: ${{ matrix.os }}
9+
strategy:
10+
matrix:
11+
# macos-13 is an intel runner, macos-14 is apple silicon
12+
#os: [ubuntu-latest, ubuntu-24.04-arm, windows-latest, macos-13, macos-14]
13+
os: [ubuntu-latest]
14+
15+
steps:
16+
- uses: actions/checkout@v4
17+
18+
- name: Build wheels
19+
uses: pypa/[email protected]
20+
# env:
21+
# CIBW_SOME_OPTION: value
22+
# ...
23+
# with:
24+
# package-dir: .
25+
# output-dir: wheelhouse
26+
# config-file: "{package}/pyproject.toml"
27+
28+
- uses: actions/upload-artifact@v4
29+
with:
30+
name: cibw-wheels-${{ matrix.os }}-${{ strategy.job-index }}
31+
path: ./wheelhouse/*.whl

.github/workflows/release.yml

Lines changed: 36 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -1,39 +1,39 @@
1-
name: Release
2-
3-
on:
4-
push:
5-
tags:
6-
# Publish on any tag starting with a `v`, e.g. v1.2.3
7-
- v*
8-
9-
jobs:
10-
pypi:
11-
name: Publish to PyPI
12-
runs-on: ubuntu-latest
13-
container: nvidia/cuda:12.8.1-devel-ubuntu24.04
14-
# Environment and permissions trusted publishing.
15-
environment:
16-
# Create this environment in the GitHub repository under Settings -> Environments
17-
name: release
18-
permissions:
19-
id-token: write
20-
steps:
21-
- uses: actions/checkout@v4
22-
- uses: astral-sh/setup-uv@v3
23-
with:
24-
version: 0.6.9
25-
enable-cache: true
26-
- name: Get Pyproject Version
27-
run: |
1+
name: Release
2+
3+
on:
4+
push:
5+
tags:
6+
# Publish on any tag starting with a `v`, e.g. v1.2.3
7+
- v*
8+
9+
jobs:
10+
pypi:
11+
name: Publish to PyPI
12+
runs-on: ubuntu-latest
13+
container: nvidia/cuda:12.8.1-devel-ubuntu24.04
14+
# Environment and permissions trusted publishing.
15+
environment:
16+
# Create this environment in the GitHub repository under Settings -> Environments
17+
name: release
18+
permissions:
19+
id-token: write
20+
steps:
21+
- uses: actions/checkout@v4
22+
- uses: astral-sh/setup-uv@v3
23+
with:
24+
version: 0.6.9
25+
enable-cache: true
26+
- name: Get Pyproject Version
27+
run: |
2828
export PYPROJECT_VERSION=v$(uvx --from=toml-cli toml get --toml-path=pyproject.toml project.version)
2929
echo "PYPROJECT_VERSION=$PYPROJECT_VERSION" >> "$GITHUB_ENV"
30-
- name: Validate version with tag
31-
if: ${{ github.ref_name != env.PYPROJECT_VERSION }}
32-
uses: actions/github-script@v3
33-
with:
34-
script: |
30+
- name: Validate version with tag
31+
if: ${{ github.ref_name != env.PYPROJECT_VERSION }}
32+
uses: actions/github-script@v3
33+
with:
34+
script: |
3535
core.setFailed('Tag version ${{ github.ref_name }} does not match pyproject version ${{ env.PYPROJECT_VERSION }}')
36-
- name: Build wheel
37-
run: uv build
38-
- name: Publish wheel
39-
run: uv publish --trusted-publishing always
36+
- name: Build wheel
37+
run: uv build
38+
- name: Publish wheel
39+
run: uv publish --trusted-publishing always

pyproject.toml

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,3 +46,18 @@ where = ["Python"]
4646
[tool.setuptools.package-data]
4747
"tigre.utilities.cuda_interface" = ["*.pyx", "*.pxd", "*.cpp"]
4848

49+
[tool.cibuildwheel]
50+
build-frontend = "build[uv]"
51+
52+
[tool.cibuildwheel.linux]
53+
#CUDA Installation
54+
before-all = """
55+
rpm --import https://developer.download.nvidia.com/compute/cuda/repos/rhel7/x86_64/7fa2af80.pub &&
56+
yum-config-manager --add-repo https://developer.download.nvidia.com/compute/cuda/repos/rhel7/x86_64/cuda-rhel7.repo &&
57+
yum clean all &&
58+
yum -y install cuda-toolkit &&
59+
ls -al /usr/local &&
60+
export PATH=$PATH:/usr/local/cuda/bin &&
61+
nvcc --version &&
62+
export BUILD_WITH_CUDA=1
63+
"""

0 commit comments

Comments
 (0)