From 0c6a12012e716b3aa49c747e3d2f0ad58fb40937 Mon Sep 17 00:00:00 2001 From: Mike Jarvis Date: Sun, 24 Nov 2024 13:27:17 -0500 Subject: [PATCH] Update wheels.yml to compiling version --- .github/workflows/wheels.yml | 124 +++++++++++++++++++++++++++---- .github/workflows/wheels_old.yml | 75 ------------------- 2 files changed, 109 insertions(+), 90 deletions(-) delete mode 100644 .github/workflows/wheels_old.yml diff --git a/.github/workflows/wheels.yml b/.github/workflows/wheels.yml index 7e2c1e0a..829953af 100644 --- a/.github/workflows/wheels.yml +++ b/.github/workflows/wheels.yml @@ -7,45 +7,139 @@ on: - published jobs: + + build_linux_wheels: + name: Build wheels on standard linux + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + + - uses: actions/setup-python@v5 + + - name: Build wheels + uses: pypa/cibuildwheel@v2.16.5 + env: + CIBW_BUILD: "*manylinux*" + CIBW_ARCHS: auto64 + CIBW_SKIP: cp36* cp37* pp* + + - name: Upload manylinux wheels + uses: actions/upload-artifact@v4 + with: + path: ./wheelhouse/*.whl + name: whl-manylinux + + build_musl_wheels: + name: Build wheels on musl linux + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + + - name: Build wheels + uses: pypa/cibuildwheel@v2.16.5 + env: + CIBW_BUILD: "*musllinux*" + CIBW_ARCHS: auto64 + CIBW_SKIP: cp36* cp37* pp* + + - name: Upload musllinux wheels + uses: actions/upload-artifact@v4 + with: + path: ./wheelhouse/*.whl + name: whl-musllinux + + build_macosx_intel_wheels: + name: Build wheels on MacOS Intel + runs-on: macos-13 + steps: + - uses: actions/checkout@v4 + + - name: Build wheels + uses: pypa/cibuildwheel@v2.16.5 + env: + CIBW_BUILD: "*macosx*" + CIBW_ARCHS: auto64 + CIBW_SKIP: cp36* cp37* pp* + + - name: Upload macosx wheels + uses: actions/upload-artifact@v4 + with: + path: ./wheelhouse/*.whl + name: whl-macosx + + build_macosx_arm_wheels: + name: Build wheels on MacOS ARM + runs-on: macos-latest + steps: + - uses: actions/checkout@v4 + + - uses: actions/setup-python@v5 + + - name: Build wheels + uses: pypa/cibuildwheel@v2.16.5 + env: + CIBW_BUILD: "*macosx*" + CIBW_ARCHS: arm64 + CIBW_SKIP: cp36* cp37* pp* + CIBW_BEFORE_ALL: brew install llvm libomp eigen + CIBW_ENVIRONMENT: >- + CC=/opt/homebrew/opt/llvm/bin/clang + CXX=/opt/homebrew/opt/llvm/bin/clang++ + LDFLAGS="-L/opt/homebrew/opt/llvm/lib -Wl,-rpath,/opt/homebrew/opt/llvm/lib" + CPPFLAGS="-I/opt/homebrew/opt/llvm/include" + PATH="/opt/homebrew/opt/llvm/bin:$PATH" + + - uses: actions/upload-artifact@v4 + with: + name: whl-arm + path: ./wheelhouse/*.whl + build_sdist: - name: Build platform-independent wheel and sdist and upload to PyPI + name: Build sdist and upload to PyPI + needs: [build_linux_wheels, build_musl_wheels, build_macosx_intel_wheels, build_macosx_arm_wheels] + # Just need to build sdist on a single machine runs-on: ubuntu-latest environment: name: pypi - url: https://pypi.org/project/Piff/ + url: https://pypi.org/p/Piff permissions: id-token: write # IMPORTANT: this permission is mandatory for trusted publishing steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v4 - - uses: actions/setup-python@v2 + - uses: actions/setup-python@v5 with: - python-version: 3.8 + python-version: "3.10" - name: Install dependencies run: | python -m pip install -U pip - - sudo -H apt-get -qq update - sudo -H apt-get install -y libfftw3-dev libeigen3-dev - - pip install -U numpy setuptools wheel + pip install -U numpy setuptools pip install -U -r requirements.txt - - name: Build wheel - run: | - pip wheel -w wheels . - ls -l wheels + - name: Download wheels + uses: actions/download-artifact@v4 + with: + path: ./wheels + pattern: whl-* + merge-multiple: true - name: Build sdist run: | python setup.py sdist - cp wheels/Piff* dist ls -l dist tar tvfz dist/*.tar.gz + - name: Copy wheels + run: | + echo ls -l wheels + ls -l wheels + cp wheels/*.whl dist + echo ls -l dist + ls -l dist + - name: Publish to PyPI uses: pypa/gh-action-pypi-publish@release/v1 with: diff --git a/.github/workflows/wheels_old.yml b/.github/workflows/wheels_old.yml deleted file mode 100644 index 008aa6d0..00000000 --- a/.github/workflows/wheels_old.yml +++ /dev/null @@ -1,75 +0,0 @@ -# This is just here in case we start needing to build platform-specific wheels. -# Currently Piff is pure python, so this is not required. - -name: Build wheels and sdist and upload to PyPI - -on: - workflow_dispatch: - -jobs: - build_wheels: - name: Build wheels on ${{ matrix.os }} - runs-on: ${{ matrix.os }} - strategy: - matrix: - os: [ubuntu-20.04, macos-10.15] - - steps: - - uses: actions/checkout@v2 - - - name: Build wheels - uses: pypa/cibuildwheel@v1.12.0 - env: - CIBW_BEFORE_ALL_LINUX: yum install -y libffi-devel - CIBW_BEFORE_ALL_MACOS: brew install libffi - - - uses: actions/upload-artifact@v2 - with: - path: ./wheelhouse/*.whl - - build_sdist: - name: Build sdist and upload to PyPI - needs: build_wheels - # Just need to build sdist on a single machine - runs-on: ubuntu-latest - - steps: - - uses: actions/checkout@v2 - - - uses: actions/setup-python@v2 - with: - python-version: 3.8 - - - name: Install dependencies - run: | - python -m pip install -U pip - pip install -U numpy setuptools - pip install -U -r requirements.txt - - - name: Download wheels - uses: actions/download-artifact@v2 - with: - path: ./wheels - - - name: Build sdist - run: | - python setup.py sdist - ls -l dist - tar tvfz dist/Piff-*.tar.gz - - - name: Copy wheels - run: | - echo ls -l wheels - ls -l wheels - echo ls -l wheels/artifact - ls -l wheels/artifact - cp wheels/artifact/*.whl dist - echo ls -l dist - ls -l dist - - - name: Publish to PyPI - uses: pypa/gh-action-pypi-publish@release/v1 - with: - user: rmjarvis - password: ${{ secrets.PYPI_PASSWORD }} - verbose: true