Skip to content

Commit bc4f828

Browse files
committed
Update GitHub workflows
1 parent 2bcf6f3 commit bc4f828

File tree

1 file changed

+16
-16
lines changed

1 file changed

+16
-16
lines changed

.github/workflows/pypi.yaml

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,3 @@
1-
# This workflow builds and publishes Python distributions to PyPI.
2-
# It uses a self-hosted runner and a PyTorch container image
3-
# to ensure the correct CUDA environment is available for the build.
4-
# It relies on Trusted Publishing for secure authentication with PyPI.
5-
61
name: Build and Publish Python 🐍 distributions
72

83
on:
@@ -15,7 +10,6 @@ jobs:
1510
name: Build wheel for Python ${{ matrix.variant.python-version }} on self-hosted
1611
runs-on: self-hosted
1712

18-
# The PyTorch container provides the necessary CUDA environment
1913
container:
2014
image: pytorch/pytorch:2.3.1-cuda12.1-cudnn8-devel
2115

@@ -25,31 +19,31 @@ jobs:
2519
variant:
2620
- {
2721
name: "cuda",
28-
python-version: "3.9", # Added Python 3.9
22+
python-version: "3.9",
2923
cuda-version: "12.1",
3024
compute-caps: "80",
3125
}
3226
- {
3327
name: "cuda",
34-
python-version: "3.10", # Existing Python 3.10
28+
python-version: "3.10",
3529
cuda-version: "12.1",
3630
compute-caps: "80",
3731
}
3832
- {
3933
name: "cuda",
40-
python-version: "3.11", # Added Python 3.11
34+
python-version: "3.11",
4135
cuda-version: "12.1",
4236
compute-caps: "80",
4337
}
4438
- {
4539
name: "cuda",
46-
python-version: "3.12", # Added Python 3.12
40+
python-version: "3.12",
4741
cuda-version: "12.1",
4842
compute-caps: "80",
4943
}
5044
- {
5145
name: "cuda",
52-
python-version: "3.13", # Added Python 3.13
46+
python-version: "3.13",
5347
cuda-version: "12.1",
5448
compute-caps: "80",
5549
}
@@ -63,6 +57,13 @@ jobs:
6357
with:
6458
python-version: ${{ matrix.variant.python-version }}
6559

60+
- name: Get Python Library Path and Set LD_LIBRARY_PATH
61+
run: |
62+
PYTHON_LIB_DIR=$(python -c "import sysconfig; print(sysconfig.get_config_var('LIBDIR'))")
63+
echo "Found Python library directory: $PYTHON_LIB_DIR"
64+
echo "LD_LIBRARY_PATH=$PYTHON_LIB_DIR:${LD_LIBRARY_PATH}" >> $GITHUB_ENV
65+
shell: bash
66+
6667
- name: Install build dependencies
6768
run: |
6869
apt-get update
@@ -95,7 +96,7 @@ jobs:
9596

9697
- name: Build wheel
9798
env:
98-
LD_LIBRARY_PATH: ${{ env.CUDA_LIB_DIR }}:${LD_LIBRARY_PATH}
99+
LD_LIBRARY_PATH: ${{ env.CUDA_LIB_DIR }}:${LD_LIBRARY_PATH} # This will now include Python's lib dir
99100
CUDA_COMPUTE_CAP: ${{ matrix.variant.compute-caps }}
100101
run: maturin build --release --out dist
101102
shell: bash
@@ -143,7 +144,6 @@ jobs:
143144
- name: Upload wheel artifact
144145
uses: actions/upload-artifact@v4
145146
with:
146-
# Updated artifact name to include the Python version
147147
name: wheels-${{ matrix.variant.name }}-cuda${{ matrix.variant.cuda-version }}-py${{ matrix.variant.python-version }}
148148
path: dist/
149149

@@ -152,15 +152,15 @@ jobs:
152152
needs: build-wheels
153153
runs-on: ubuntu-latest
154154
permissions:
155-
id-token: write # Required for Trusted Publishing
155+
id-token: write
156156

157157
steps:
158158
- name: Download all wheels
159159
uses: actions/download-artifact@v4
160160
with:
161-
pattern: wheels-* # This pattern will download all artifacts matching 'wheels-*'
161+
pattern: wheels-*
162162
path: dist
163-
merge-multiple: true # Merge all downloaded artifacts into a single 'dist' directory
163+
merge-multiple: true
164164

165165
- name: Publish to PyPI
166166
uses: pypa/gh-action-pypi-publish@v1.12.4

0 commit comments

Comments
 (0)