Revert setup.py and enhance GitHub Actions for CUDA path handling #23
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Publish Python Package | |
on: | |
push: | |
branches: | |
- main | |
pull_request: | |
branches: | |
- main | |
jobs: | |
publish: | |
name: Publish | |
runs-on: ${{ matrix.os }} | |
strategy: | |
matrix: | |
os: [ubuntu-latest, windows-latest, macos-latest] | |
steps: | |
- name: Check out repository | |
uses: actions/checkout@v2 | |
- name: Set up Python | |
uses: actions/setup-python@v2 | |
with: | |
python-version: 3.11.7 | |
- name: Install dependencies | |
run: | | |
python -m pip install --upgrade pip | |
pip install setuptools wheel build | |
- name: Set CUDA_PATH environment variable for Linux | |
if: runner.os == 'Linux' | |
run: | | |
if [ -d "/usr/local/cuda" ]; then | |
echo "CUDA_PATH=/usr/local/cuda" >> $GITHUB_ENV | |
else | |
echo "CUDA not found at /usr/local/cuda. Please set the CUDA_PATH environment variable correctly." | |
exit 1 | |
fi | |
- name: Set CUDA_PATH environment variable for Windows | |
if: runner.os == 'Windows' | |
run: | | |
if [ -d "C:\\Program Files\\NVIDIA GPU Computing Toolkit\\CUDA" ]; then | |
echo "CUDA_PATH=C:\\Program Files\\NVIDIA GPU Computing Toolkit\\CUDA" >> $GITHUB_ENV | |
else | |
echo "CUDA not found at C:\\Program Files\\NVIDIA GPU Computing Toolkit\\CUDA. Please set the CUDA_PATH environment variable correctly." | |
exit 1 | |
fi | |
- name: Set CUDA_PATH environment variable for macOS | |
if: runner.os == 'macOS' | |
run: | | |
if [ -d "/usr/local/cuda" ]; then | |
echo "CUDA_PATH=/usr/local/cuda" >> $GITHUB_ENV | |
else | |
echo "CUDA not found at /usr/local/cuda. Please set the CUDA_PATH environment variable correctly." | |
exit 1 | |
fi | |
- name: Build package | |
run: python -m build | |
- name: Publish package | |
uses: pypa/gh-action-pypi-publish@release/v1 | |
with: | |
password: ${{ secrets.PYPI_API_TOKEN }} | |
env: | |
TWINE_USERNAME: __token__ |