From beb9a9837004a117ba6c27fde46760db4a13f520 Mon Sep 17 00:00:00 2001 From: purepani Date: Wed, 2 Apr 2025 03:58:52 -0500 Subject: [PATCH 1/6] dev From 47af0cba866f25a426486cc36dfc095f18f0b512 Mon Sep 17 00:00:00 2001 From: purepani Date: Tue, 25 Mar 2025 20:43:55 -0500 Subject: [PATCH 2/6] Adds release.yml file to release to PyPI Adapted from https://github.com/astral-sh/trusted-publishing-examples --- .github/workflows/release.yml | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) create mode 100644 .github/workflows/release.yml diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml new file mode 100644 index 00000000..a8f49ca7 --- /dev/null +++ b/.github/workflows/release.yml @@ -0,0 +1,29 @@ +name: Release + +on: + push: + tags: + # Publish on any tag starting with a `v`, e.g. v1.2.3 + - v* + +jobs: + pypi: + name: Publish to PyPI + runs-on: ubuntu-latest + container: nvidia/cuda:12.8.1-devel-ubuntu24.04 + # Environment and permissions trusted publishing. + environment: + # Create this environment in the GitHub repository under Settings -> Environments + name: release + permissions: + id-token: write + steps: + - uses: actions/checkout@v4 + - uses: astral-sh/setup-uv@v3 + with: + version: 0.6.9 + enable-cache: true + - name: Build wheel + run: uv build + - name: Publish wheel + run: uv publish --trusted-publishing always From d3e5755dfb566ce0c836a08480f29ada6d9a8b77 Mon Sep 17 00:00:00 2001 From: purepani Date: Wed, 26 Mar 2025 21:21:37 -0500 Subject: [PATCH 3/6] Adds check for version --- .github/workflows/release.yml | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index a8f49ca7..da1e4bd3 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -23,6 +23,16 @@ jobs: with: version: 0.6.9 enable-cache: true + - name: Get Pyproject Version + run: | + export PYPROJECT_VERSION=v$(uvx --from=toml-cli toml get --toml-path=pyproject.toml project.version) + echo "PYPROJECT_VERSION=$PYPROJECT_VERSION" >> "$GITHUB_ENV" + - name: Validate version with tag + if: ${{ github.ref_name != env.PYPROJECT_VERSION }} + uses: actions/github-script@v3 + with: + script: | + core.setFailed('Tag version ${{ github.ref_name }} does not match pyproject version ${{ env.PYPROJECT_VERSION }}') - name: Build wheel run: uv build - name: Publish wheel From 0cc8e1d6aa527af40981462d2f367051b6d8a02a Mon Sep 17 00:00:00 2001 From: purepani Date: Wed, 2 Apr 2025 19:52:25 -0500 Subject: [PATCH 4/6] Adds cibuildwheels --- .github/workflows/build.yml | 31 +++++++++++++++ .github/workflows/release.yml | 72 +++++++++++++++++------------------ pyproject.toml | 18 +++++++++ 3 files changed, 85 insertions(+), 36 deletions(-) create mode 100644 .github/workflows/build.yml diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml new file mode 100644 index 00000000..6b81760e --- /dev/null +++ b/.github/workflows/build.yml @@ -0,0 +1,31 @@ +name: Build + +on: [push, pull_request] + +jobs: + build_wheels: + name: Build wheels on ${{ matrix.os }} + runs-on: ${{ matrix.os }} + strategy: + matrix: + # macos-13 is an intel runner, macos-14 is apple silicon + #os: [ubuntu-latest, ubuntu-24.04-arm, windows-latest, macos-13, macos-14] + os: [ubuntu-latest] + + steps: + - uses: actions/checkout@v4 + + - name: Build wheels + uses: pypa/cibuildwheel@v2.23.2 + # env: + # CIBW_SOME_OPTION: value + # ... + # with: + # package-dir: . + # output-dir: wheelhouse + # config-file: "{package}/pyproject.toml" + + - uses: actions/upload-artifact@v4 + with: + name: cibw-wheels-${{ matrix.os }}-${{ strategy.job-index }} + path: ./wheelhouse/*.whl diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index da1e4bd3..f0c2cffb 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -1,39 +1,39 @@ -name: Release - -on: - push: - tags: - # Publish on any tag starting with a `v`, e.g. v1.2.3 - - v* - -jobs: - pypi: - name: Publish to PyPI - runs-on: ubuntu-latest - container: nvidia/cuda:12.8.1-devel-ubuntu24.04 - # Environment and permissions trusted publishing. - environment: - # Create this environment in the GitHub repository under Settings -> Environments - name: release - permissions: - id-token: write - steps: - - uses: actions/checkout@v4 - - uses: astral-sh/setup-uv@v3 - with: - version: 0.6.9 - enable-cache: true - - name: Get Pyproject Version - run: | + name: Release + + on: + push: + tags: + # Publish on any tag starting with a `v`, e.g. v1.2.3 + - v* + + jobs: + pypi: + name: Publish to PyPI + runs-on: ubuntu-latest + container: nvidia/cuda:12.8.1-devel-ubuntu24.04 + # Environment and permissions trusted publishing. + environment: + # Create this environment in the GitHub repository under Settings -> Environments + name: release + permissions: + id-token: write + steps: + - uses: actions/checkout@v4 + - uses: astral-sh/setup-uv@v3 + with: + version: 0.6.9 + enable-cache: true + - name: Get Pyproject Version + run: | export PYPROJECT_VERSION=v$(uvx --from=toml-cli toml get --toml-path=pyproject.toml project.version) echo "PYPROJECT_VERSION=$PYPROJECT_VERSION" >> "$GITHUB_ENV" - - name: Validate version with tag - if: ${{ github.ref_name != env.PYPROJECT_VERSION }} - uses: actions/github-script@v3 - with: - script: | + - name: Validate version with tag + if: ${{ github.ref_name != env.PYPROJECT_VERSION }} + uses: actions/github-script@v3 + with: + script: | core.setFailed('Tag version ${{ github.ref_name }} does not match pyproject version ${{ env.PYPROJECT_VERSION }}') - - name: Build wheel - run: uv build - - name: Publish wheel - run: uv publish --trusted-publishing always + - name: Build wheel + run: uv build + - name: Publish wheel + run: uv publish --trusted-publishing always diff --git a/pyproject.toml b/pyproject.toml index 7376a9b1..e422f26a 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -46,3 +46,21 @@ where = ["Python"] [tool.setuptools.package-data] "tigre.utilities.cuda_interface" = ["*.pyx", "*.pxd", "*.cpp"] +[tool.cibuildwheel] +build-frontend = "build[uv]" +skip = "pp* *musl*" +archs = ["native"] + +[tool.cibuildwheel.linux] +#CUDA Installation +before-all = """ +rpm --import https://developer.download.nvidia.com/compute/cuda/repos/rhel7/x86_64/7fa2af80.pub && +yum-config-manager --add-repo https://developer.download.nvidia.com/compute/cuda/repos/rhel7/x86_64/cuda-rhel7.repo && +yum clean all && +yum -y install cuda-nvcc-12-4 cuda-cudart-devel-12-4 libcurand-devel-12-4 && +ls -al /usr/local && +export PATH=$PATH:/usr/local/cuda/bin && +export CUDA_PATH=/usr/local/cuda && +nvcc --version && +export BUILD_WITH_CUDA=1 +""" From 73dc81ac9356cbeca642bcaaed29f1cbc650c160 Mon Sep 17 00:00:00 2001 From: purepani Date: Thu, 10 Apr 2025 08:19:52 -0500 Subject: [PATCH 5/6] Add upload --- .github/workflows/release.yml | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index f0c2cffb..9641a5a5 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -9,8 +9,8 @@ jobs: pypi: name: Publish to PyPI + needs: [build_wheels] runs-on: ubuntu-latest - container: nvidia/cuda:12.8.1-devel-ubuntu24.04 # Environment and permissions trusted publishing. environment: # Create this environment in the GitHub repository under Settings -> Environments @@ -33,7 +33,10 @@ with: script: | core.setFailed('Tag version ${{ github.ref_name }} does not match pyproject version ${{ env.PYPROJECT_VERSION }}') - - name: Build wheel - run: uv build + - uses: actions/download-artifact@v4 + with: + pattern: cibw-* + path: dist + merge-multiple: true - name: Publish wheel run: uv publish --trusted-publishing always From d9612fa31bbcb867ccf2c577d597fd7456b68a43 Mon Sep 17 00:00:00 2001 From: purepani Date: Thu, 10 Apr 2025 08:19:52 -0500 Subject: [PATCH 6/6] Add sdist --- .github/workflows/build.yml | 16 ++++++++++++ .github/workflows/release.yml | 46 +++++++++++++++++++++++++++++++++-- 2 files changed, 60 insertions(+), 2 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 6b81760e..60b32646 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -29,3 +29,19 @@ jobs: with: name: cibw-wheels-${{ matrix.os }}-${{ strategy.job-index }} path: ./wheelhouse/*.whl + make_sdist: + name: Make SDist + runs-on: ubuntu-latest + container: nvidia/cuda:12.8.1-devel-ubuntu24.04 + steps: + - uses: actions/checkout@v4 + - uses: astral-sh/setup-uv@v3 + with: + version: 0.6.9 + enable-cache: true + - name: Build SDist + run: uv build --sdist + - uses: actions/upload-artifact@v4 + with: + name: cibw-sdist + path: dist/*.tar.gz diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 9641a5a5..8bbb0235 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -7,9 +7,51 @@ - v* jobs: + build_wheels: + name: Build wheels on ${{ matrix.os }} + runs-on: ${{ matrix.os }} + strategy: + matrix: + # macos-13 is an intel runner, macos-14 is apple silicon + #os: [ubuntu-latest, ubuntu-24.04-arm, windows-latest, macos-13, macos-14] + os: [ubuntu-latest] + + steps: + - uses: actions/checkout@v4 + + - name: Build wheels + uses: pypa/cibuildwheel@v2.23.2 + # env: + # CIBW_SOME_OPTION: value + # ... + # with: + # package-dir: . + # output-dir: wheelhouse + # config-file: "{package}/pyproject.toml" + + - uses: actions/upload-artifact@v4 + with: + name: cibw-wheels-${{ matrix.os }}-${{ strategy.job-index }} + path: ./wheelhouse/*.whl + make_sdist: + name: Make SDist + runs-on: ubuntu-latest + container: nvidia/cuda:12.8.1-devel-ubuntu24.04 + steps: + - uses: actions/checkout@v4 + - uses: astral-sh/setup-uv@v3 + with: + version: 0.6.9 + enable-cache: true + - name: Build SDist + run: uv build --sdist + - uses: actions/upload-artifact@v4 + with: + name: cibw-sdist + path: dist/*.tar.gz pypi: name: Publish to PyPI - needs: [build_wheels] + needs: [build_wheels, make_sdist] runs-on: ubuntu-latest # Environment and permissions trusted publishing. environment: @@ -32,7 +74,7 @@ uses: actions/github-script@v3 with: script: | - core.setFailed('Tag version ${{ github.ref_name }} does not match pyproject version ${{ env.PYPROJECT_VERSION }}') + core.setFailed('Tag version ${{ github.ref_name }} does not match pyproject version ${{ env.PYPROJECT_VERSION }}') - uses: actions/download-artifact@v4 with: pattern: cibw-*