Skip to content

added names for wheels #60

added names for wheels

added names for wheels #60

name: Build and Publish Python Wheels
on:
push:
branches: [ main ]
pull_request:
branches: [ main ]
release:
types: [published]
workflow_dispatch:
jobs:
build_wheels_macos:
name: Build wheels on macOS
runs-on: macos-latest
strategy:
matrix:
platform:
- runner: macos-latest
target: x86_64
steps:
- uses: actions/checkout@v3
- name: Install HDF5
run: |
brew install hdf5
- name: Build wheels
uses: PyO3/maturin-action@v1
with:
target: ${{ matrix.platform.target }}
args: --release --out dist --find-interpreter
- name: Upload wheels
uses: actions/upload-artifact@v4
with:
name: wheels-macos-${{ matrix.platform.target }}
path: dist/*.whl
- name: Install package from wheel (macos-latest)
run: |
python -m pip install --upgrade pip
python -m pip install pytest
# List directory contents to debug
echo "Contents of dist directory:"
find dist -type f -name "*.whl" | sort
python --version
pip install dist/hdf5_nuclear_data_reader-0.1.0-cp313-cp313-macosx_11_0_arm64.whl
- name: Verify import
run: |
python -c "import hdf5_nuclear_data_reader; print('Import successful')"
- name: Run tests
run: |
pytest -v
build_wheels_windows:
name: Build wheels on Windows
runs-on: ${{ matrix.platform.runner }}
strategy:
matrix:
platform:
- runner: windows-latest
target: x86_64
steps:
- uses: actions/checkout@v3
- name: Install h5py for HDF5 support
run: |
pip install h5py
- name: Build wheels
uses: PyO3/maturin-action@v1
with:
args: --release --out dist --find-interpreter
- name: Upload wheels
uses: actions/upload-artifact@v4
with:
name: wheels-windows-${{ matrix.platform.target }}
path: dist/*.whl
- name: Install package from wheel (windows-latest)
run: |
python -m pip install --upgrade pip
python -m pip install pytest
# List directory contents to debug
echo "Contents of dist directory:"
dir dist -Filter *.whl | Sort-Object Name
python --version
pip install dist/hdf5_nuclear_data_reader-0.1.0-cp39-cp39-win_amd64.whl
- name: Verify import
run: |
python -c "import hdf5_nuclear_data_reader; print('Import successful')"
- name: Run tests
run: |
pytest -v
build_wheels_manylinux:
name: Build manylinux wheels
runs-on: ${{ matrix.platform.runner }}
strategy:
matrix:
platform:
- runner: ubuntu-latest
target: x86_64
steps:
- uses: actions/checkout@v3
- name: Build manylinux wheels
uses: PyO3/maturin-action@v1
with:
target: x86_64-unknown-linux-gnu
manylinux: 2014
args: --release --out dist --find-interpreter
before-script-linux: |
# Install HDF5 development files
yum install -y hdf5-devel
# Set environment variables for HDF5
export HDF5_DIR=/usr
# Ensure the built-in tryrun results are used (from your build.rs)
export HDF5_DISABLE_VERSION_CHECK=1
- name: Upload manylinux wheels
uses: actions/upload-artifact@v4
with:
name: wheels-linux-${{ matrix.platform.target }}
path: dist/*.whl
- name: Install package from wheel (ubuntu-latest)
run: |
python -m pip install --upgrade pip
python -m pip install pytest
# List directory contents to debug
echo "Contents of dist directory:"
find dist -type f -name "*.whl" | sort
python --version
pip install dist/hdf5_nuclear_data_reader-0.1.0-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
- name: Verify import
run: |
python -c "import hdf5_nuclear_data_reader; print('Import successful')"
- name: Run tests
run: |
pytest -v
publish:
name: Publish package
needs: [build_wheels_manylinux, build_wheels_windows, build_wheels_macos]
runs-on: ubuntu-latest
permissions:
id-token: write
if: github.event_name == 'release' && github.event.action == 'published'
steps:
- uses: actions/download-artifact@v4
with:
path: dist
- name: Prepare distribution files
run: |
mkdir -p dist_combined
find dist -name "*.whl" -exec cp {} dist_combined \;
ls -la dist_combined/
- name: Publish to PyPI
uses: pypa/gh-action-pypi-publish@release/v1