cl action #19
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: Python publish | |
on: | |
push: | |
# branches: [ main ] | |
# tags: [ 'v*' ] | |
pull_request: | |
branches: [ main ] | |
workflow_dispatch: | |
jobs: | |
build_wheels_linux: | |
name: Build wheels on Linux | |
runs-on: ubuntu-latest | |
strategy: | |
fail-fast: false | |
matrix: | |
python-version: ["3.8", "3.9", "3.10", "3.11", "3.12"] | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Set up Python | |
uses: actions/setup-python@v4 | |
with: | |
python-version: ${{ matrix.python-version }} | |
- name: Install dependencies | |
run: | | |
python -m pip install --upgrade pip | |
pip install maturin | |
- name: Install HDF5 | |
run: | | |
sudo apt-get update | |
sudo apt-get install -y libhdf5-dev | |
- name: Build wheels | |
uses: PyO3/maturin-action@v1 | |
with: | |
args: --release --out dist --find-interpreter | |
singlefile: true | |
- name: Upload wheels | |
uses: actions/upload-artifact@v3 | |
with: | |
name: wheels-linux-${{ matrix.python-version }} | |
path: dist/*.whl | |
build_wheels_macos: | |
name: Build wheels on macOS | |
runs-on: macos-latest | |
strategy: | |
fail-fast: false | |
matrix: | |
python-version: ["3.8", "3.9", "3.10", "3.11", "3.12"] | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Set up Python | |
uses: actions/setup-python@v4 | |
with: | |
python-version: ${{ matrix.python-version }} | |
- name: Install dependencies | |
run: | | |
python -m pip install --upgrade pip | |
pip install maturin | |
- name: Install HDF5 | |
run: | | |
brew install hdf5 | |
- name: Build wheels | |
uses: PyO3/maturin-action@v1 | |
with: | |
args: --release --out dist --find-interpreter | |
singlefile: true | |
- name: Upload wheels | |
uses: actions/upload-artifact@v3 | |
with: | |
name: wheels-macos-${{ matrix.python-version }} | |
path: dist/*.whl | |
build_wheels_windows: | |
name: Build wheels on Windows | |
runs-on: windows-latest | |
strategy: | |
fail-fast: false | |
matrix: | |
python-version: ["3.8", "3.9", "3.10", "3.11", "3.12"] | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Set up Python | |
uses: actions/setup-python@v4 | |
with: | |
python-version: ${{ matrix.python-version }} | |
- name: Install dependencies | |
run: | | |
python -m pip install --upgrade pip | |
pip install maturin h5py | |
- name: Build wheels | |
uses: PyO3/maturin-action@v1 | |
with: | |
args: --release --out dist --find-interpreter | |
singlefile: true | |
- name: Upload wheels | |
uses: actions/upload-artifact@v3 | |
with: | |
name: wheels-windows-${{ matrix.python-version }} | |
path: dist/*.whl | |
build_manylinux: | |
name: Build manylinux wheels | |
runs-on: ubuntu-latest | |
strategy: | |
fail-fast: false | |
matrix: | |
python-version: ["3.8", "3.9", "3.10", "3.11", "3.12"] | |
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 --interpreter ${{ matrix.python-version }} | |
singlefile: false | |
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@v3 | |
with: | |
name: wheels-manylinux-${{ matrix.python-version }} | |
path: dist/*.whl | |
# publish: | |
# name: Publish package | |
# needs: [build_wheels_linux, build_wheels_macos, build_wheels_windows, build_manylinux] | |
# runs-on: ubuntu-latest | |
# if: startsWith(github.ref, 'refs/tags/v') | |
# steps: | |
# - uses: actions/download-artifact@v3 | |
# 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 | |
# with: | |
# user: __token__ | |
# password: ${{ secrets.PYPI_API_TOKEN }} | |
# packages-dir: dist_combined/ | |
# skip-existing: true |