Update pyproject #28
This file contains hidden or 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: Build and Publish Wheels | |
on: | |
push: | |
branches: [ master ] | |
pull_request: | |
branches: [ master ] | |
jobs: | |
build_wheels: | |
strategy: | |
matrix: | |
os: [ubuntu-latest, macos-latest, windows-latest] | |
python-version: ["3.9", "3.10", "3.11", "3.12"] | |
runs-on: ${{ matrix.os }} | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Set up Python | |
uses: actions/setup-python@v4 | |
with: | |
python-version: ${{ matrix.python-version }} | |
- name: Install dependencies (Linux) | |
if: runner.os == 'Linux' | |
run: | | |
sudo apt-get update | |
sudo apt-get install -y build-essential cmake | |
- name: Install dependencies (Windows) | |
if: runner.os == 'Windows' | |
run: | | |
choco install cmake | |
- name: Install cibuildwheel | |
run: pip install cibuildwheel | |
- name: Build Wheels | |
env: | |
CXXFLAGS: "-std=c++11" | |
CIBW_SKIP: "pypy*" | |
CIBW_BUILD: "cp*" | |
run: cibuildwheel --output-dir wheelhouse . | |
- name: Upload Wheels Artifact | |
uses: actions/upload-artifact@v4 | |
with: | |
name: wheels-${{ matrix.os }}-${{ matrix.python-version }}-${{ github.run_number }} | |
path: wheelhouse/*.whl | |
publish_wheels: | |
needs: build_wheels | |
runs-on: ubuntu-latest | |
if: github.event_name == 'push' | |
steps: | |
- uses: actions/checkout@v3 | |
# Download all artifacts (wheels) from the build job | |
- name: Download Wheels Artifacts | |
uses: actions/download-artifact@v4 | |
with: | |
path: wheelhouse | |
# List files to verify they were downloaded correctly | |
- name: List files in wheelhouse | |
run: ls -la wheelhouse | |
- name: Install Twine | |
run: pip install twine | |
- name: Publish to PyPI | |
env: | |
TWINE_USERNAME: "__token__" | |
TWINE_PASSWORD: ${{ secrets.PYPI_API_TOKEN }} | |
run: twine upload $(find wheelhouse -type f -name '*.whl') |