From db3c1cf03cd5d192b7b36ad95b9b9a5b81ef27b2 Mon Sep 17 00:00:00 2001 From: Yuki Kishimoto Date: Thu, 6 Jun 2024 10:29:29 -0400 Subject: [PATCH] ci: build python wheels for `manylinux2014` (x86_64) Partially revert commit 43a74407251cd8eb10452b6d87b76917f86941a2 Signed-off-by: Yuki Kishimoto --- .github/workflows/publish-python.yaml | 22 +++++++----- .github/workflows/publish-sdk-python.yaml | 34 +++++++++++-------- .../scripts/generate-linux-x86_64.sh | 4 +-- 3 files changed, 34 insertions(+), 26 deletions(-) diff --git a/.github/workflows/publish-python.yaml b/.github/workflows/publish-python.yaml index d303ace66..4b132b3a8 100644 --- a/.github/workflows/publish-python.yaml +++ b/.github/workflows/publish-python.yaml @@ -4,14 +4,23 @@ on: [workflow_dispatch] jobs: build-linux-x86_64: - name: "Build manylinux_2_31 x86_64 wheel" + name: "Build manylinux 2014 x86_64 wheel" runs-on: ubuntu-20.04 strategy: matrix: - python: ["3.9", "3.10", "3.11", "3.12"] + python: + - cp39-cp39 + - cp310-cp310 + - cp311-cp311 + - cp312-cp312 defaults: run: working-directory: bindings/nostr-ffi/bindings-python + container: + image: quay.io/pypa/manylinux2014_x86_64 + env: + PLAT: manylinux2014_x86_64 + PYBIN: "/opt/python/${{ matrix.python }}/bin" steps: - name: "Checkout" uses: actions/checkout@v3 @@ -20,20 +29,15 @@ jobs: with: toolchain: stable - - name: "Setup Python" - uses: actions/setup-python@v4 - with: - python-version: ${{ matrix.python }} - - name: "Generate nostr.py and binaries" run: bash ./scripts/generate-linux-x86_64.sh - name: "Build wheel" - run: python3 setup.py bdist_wheel --plat-name manylinux_2_31_x86_64 --verbose + run: ${PYBIN}/python setup.py bdist_wheel --plat-name manylinux2014_x86_64 --verbose - uses: actions/upload-artifact@v3 with: - name: nostr_sdk-manylinux_2_31_x86_64-${{ matrix.python }} + name: nostr_sdk-manylinux2014_x86_64-${{ matrix.python }} path: /home/runner/work/nostr/nostr/bindings/nostr-ffi/bindings-python/dist/*.whl build-linux-aarch64: diff --git a/.github/workflows/publish-sdk-python.yaml b/.github/workflows/publish-sdk-python.yaml index 62b5b297c..c56cd70d7 100644 --- a/.github/workflows/publish-sdk-python.yaml +++ b/.github/workflows/publish-sdk-python.yaml @@ -4,14 +4,23 @@ on: [workflow_dispatch] jobs: build-linux-x86_64: - name: "Build manylinux_2_31 x86_64 wheel" + name: "Build manylinux 2014 x86_64 wheel" runs-on: ubuntu-20.04 strategy: matrix: - python: ["3.9", "3.10", "3.11", "3.12"] + python: + - cp39-cp39 + - cp310-cp310 + - cp311-cp311 + - cp312-cp312 defaults: run: working-directory: bindings/nostr-sdk-ffi/bindings-python + container: + image: quay.io/pypa/manylinux2014_x86_64 + env: + PLAT: manylinux2014_x86_64 + PYBIN: "/opt/python/${{ matrix.python }}/bin" steps: - name: "Checkout" uses: actions/checkout@v3 @@ -20,20 +29,15 @@ jobs: with: toolchain: stable - - name: "Setup Python" - uses: actions/setup-python@v4 - with: - python-version: ${{ matrix.python }} - - name: "Generate nostr_sdk.py and binaries" run: bash ./scripts/generate-linux-x86_64.sh - name: "Build wheel" - run: python3 setup.py bdist_wheel --plat-name manylinux_2_31_x86_64 --verbose + run: ${PYBIN}/python setup.py bdist_wheel --plat-name manylinux2014_x86_64 --verbose - uses: actions/upload-artifact@v3 with: - name: nostr_sdk-manylinux_2_31_x86_64-${{ matrix.python }} + name: nostr_sdk-manylinux2014_x86_64-${{ matrix.python }} path: /home/runner/work/nostr/nostr/bindings/nostr-sdk-ffi/bindings-python/dist/*.whl build-linux-aarch64: @@ -187,9 +191,9 @@ jobs: with: path: dist/ - - name: "Publish on PyPI" - uses: pypa/gh-action-pypi-publish@release/v1 - with: - user: __token__ - password: ${{ secrets.PYPI_API_TOKEN }} - packages-dir: dist/*/ +# - name: "Publish on PyPI" +# uses: pypa/gh-action-pypi-publish@release/v1 +# with: +# user: __token__ +# password: ${{ secrets.PYPI_API_TOKEN }} +# packages-dir: dist/*/ diff --git a/bindings/nostr-sdk-ffi/bindings-python/scripts/generate-linux-x86_64.sh b/bindings/nostr-sdk-ffi/bindings-python/scripts/generate-linux-x86_64.sh index f152771fa..23e6e083b 100644 --- a/bindings/nostr-sdk-ffi/bindings-python/scripts/generate-linux-x86_64.sh +++ b/bindings/nostr-sdk-ffi/bindings-python/scripts/generate-linux-x86_64.sh @@ -1,8 +1,8 @@ #!/usr/bin/env bash set -euo pipefail -python --version -pip install -r requirements.txt +${PYBIN}/python --version +${PYBIN}/pip install -r requirements.txt echo "Generating native binaries..." cargo build --release