Update publish Python CI workflow

This commit is contained in:
thunderbiscuit 2023-03-01 13:43:24 -05:00
parent 9c6069e389
commit c1243f9e1c
No known key found for this signature in database
GPG Key ID: 88253696EB836462
2 changed files with 62 additions and 51 deletions

View File

@ -8,8 +8,8 @@ on: [workflow_dispatch]
jobs: jobs:
build-manylinux2014-x86_64-wheel: build-manylinux2014-x86_64-wheel:
name: 'Build Manylinux 2014 x86_64 wheel' name: "Build Manylinux 2014 x86_64 wheel"
runs-on: ubuntu-latest runs-on: ubuntu-22.04
defaults: defaults:
run: run:
working-directory: bdk-python working-directory: bdk-python
@ -17,7 +17,7 @@ jobs:
image: quay.io/pypa/manylinux2014_x86_64 image: quay.io/pypa/manylinux2014_x86_64
env: env:
PLAT: manylinux2014_x86_64 PLAT: manylinux2014_x86_64
PYBIN: '/opt/python/${{ matrix.python }}/bin' PYBIN: "/opt/python/${{ matrix.python }}/bin"
strategy: strategy:
matrix: matrix:
python: # Update this list whenever the docker image is updated (check /opt/python/) python: # Update this list whenever the docker image is updated (check /opt/python/)
@ -29,29 +29,31 @@ jobs:
- pp37-pypy37_pp73 - pp37-pypy37_pp73
- pp38-pypy38_pp73 - pp38-pypy38_pp73
steps: steps:
- name: checkout - name: "Checkout"
uses: actions/checkout@v2 uses: actions/checkout@v2
with: with:
submodules: true submodules: true
- uses: actions-rs/toolchain@v1 - uses: actions-rs/toolchain@v1
with: with:
toolchain: stable toolchain: stable
- name: install requirements
- name: "Install requirements"
run: ${PYBIN}/pip install -r requirements.txt run: ${PYBIN}/pip install -r requirements.txt
- name: generate bindings
- name: "Generate bdk.py"
run: bash generate.sh run: bash generate.sh
- name: build wheel
run: ${PYBIN}/pip wheel . --no-deps -w /tmp/wheelhouse - name: "Build wheel"
- name: repair wheel run: ${PYBIN}/python setup.py bdist_wheel --verbose
run: auditwheel repair /tmp/wheelhouse/* --plat "$PLAT" -w /tmp/wheelhouse-repaired
- uses: actions/upload-artifact@v2 - uses: actions/upload-artifact@v2
with: with:
name: bdkpython-manylinux2014-x86_64-${{ matrix.python }} name: bdkpython-manylinux2014-x86_64-${{ matrix.python }}
path: /tmp/wheelhouse-repaired/*.whl path: /home/runner/work/bdk-ffi/bdk-ffi/bdk-python/dist/*.whl
build-macos-universal-wheel: build-macos-universal-wheel:
name: 'Build macOS universal wheel' name: "Build macOS universal wheel"
runs-on: macos-latest runs-on: macos-12
defaults: defaults:
run: run:
working-directory: bdk-python working-directory: bdk-python
@ -63,30 +65,34 @@ jobs:
- '3.9' - '3.9'
- '3.10' - '3.10'
steps: steps:
- name: checkout - name: "Checkout"
uses: actions/checkout@v2 uses: actions/checkout@v2
with: with:
submodules: true submodules: true
- uses: actions/setup-python@v2 - uses: actions/setup-python@v2
with: with:
python-version: ${{ matrix.python }} python-version: ${{ matrix.python }}
- run: python3 --version
- run: rustup target add aarch64-apple-darwin - name: "Generate bdk.py"
- run: pip3 install --user -r requirements.txt run: |
- run: pip3 install --user wheel python3 --version
- run: bash generate.sh rustup target add aarch64-apple-darwin
- name: build wheel pip3 install --user -r requirements.txt
bash generate.sh
- name: "Build wheel"
env: env:
ARCHFLAGS: "-arch x86_64 -arch arm64" ARCHFLAGS: "-arch x86_64 -arch arm64"
run: python3 setup.py -v bdist_wheel run: python3 setup.py bdist_wheel --verbose
- uses: actions/upload-artifact@v2 - uses: actions/upload-artifact@v2
with: with:
name: bdkpython-macos-${{ matrix.python }} name: bdkpython-macos-${{ matrix.python }}
path: /Users/runner/work/bdk-ffi/bdk-ffi/bdk-python/dist/*.whl path: /Users/runner/work/bdk-ffi/bdk-ffi/bdk-python/dist/*.whl
build-windows-wheel: build-windows-wheel:
name: 'Build windows wheel' name: "Build windows wheel"
runs-on: windows-latest runs-on: windows-2022
defaults: defaults:
run: run:
working-directory: bdk-python working-directory: bdk-python
@ -98,45 +104,44 @@ jobs:
- '3.9' - '3.9'
- '3.10' - '3.10'
steps: steps:
- name: checkout - name: "Checkout"
uses: actions/checkout@v2 uses: actions/checkout@v2
with: with:
submodules: true submodules: true
- uses: actions/setup-python@v2 - uses: actions/setup-python@v2
with: with:
python-version: ${{ matrix.python }} python-version: ${{ matrix.python }}
- run: python --version
- run: pip install --user -r requirements.txt - name: "Generate bdk.py"
- run: bash generate.sh run: |
shell: bash python --version
- run: pip install --user wheel pip install --user -r requirements.txt
- name: build wheel bash generate.sh
run: python setup.py -v bdist_wheel
- name: "Build wheel"
run: python setup.py bdist_wheel --verbose
- uses: actions/upload-artifact@v2 - uses: actions/upload-artifact@v2
with: with:
name: bdkpython-win-${{ matrix.python }} name: bdkpython-win-${{ matrix.python }}
path: D:\a\bdk-ffi\bdk-ffi\bdk-python\dist\*.whl path: D:\a\bdk-ffi\bdk-ffi\bdk-python\dist\*.whl
publish-pypi: publish-pypi:
name: 'Publish on PyPI' name: "Publish on PyPI"
runs-on: ubuntu-latest runs-on: ubuntu-22.04
defaults: defaults:
run: run:
working-directory: bdk-python working-directory: bdk-python
needs: [build-manylinux2014-x86_64-wheel, build-macos-universal-wheel, build-windows-wheel] needs: [build-manylinux2014-x86_64-wheel, build-macos-universal-wheel, build-windows-wheel]
# needs: [build-macos-universal-wheel]
steps: steps:
- name: Checkout - name: "Checkout"
uses: actions/checkout@v2 uses: actions/checkout@v2
- name: 'Download artifacts in dist/ directory' - name: "Download artifacts in dist/ directory"
uses: actions/download-artifact@v2 uses: actions/download-artifact@v2
with: with:
path: dist/ path: dist/
# - name: Display structure of downloaded files
# run: ls -R
# - name: 'Publish on test PyPI' # - name: 'Publish on test PyPI'
# uses: pypa/gh-action-pypi-publish@release/v1 # uses: pypa/gh-action-pypi-publish@release/v1
# with: # with:
@ -145,7 +150,7 @@ jobs:
# repository_url: https://test.pypi.org/legacy/ # repository_url: https://test.pypi.org/legacy/
# packages_dir: dist/*/ # packages_dir: dist/*/
- name: 'Publish on PyPI' - name: "Publish on PyPI"
uses: pypa/gh-action-pypi-publish@release/v1 uses: pypa/gh-action-pypi-publish@release/v1
with: with:
user: __token__ user: __token__

View File

@ -25,17 +25,17 @@ jobs:
image: quay.io/pypa/manylinux2014_x86_64 image: quay.io/pypa/manylinux2014_x86_64
env: env:
PLAT: manylinux2014_x86_64 PLAT: manylinux2014_x86_64
PYBIN: '/opt/python/${{ matrix.python }}/bin' PYBIN: "/opt/python/${{ matrix.python }}/bin"
strategy: strategy:
matrix: matrix:
python: # Update this list whenever the docker image is updated (check /opt/python/) python:
# - cp36-cp36m # - cp36-cp36m
# - cp37-cp37m # - cp37-cp37m
# - cp38-cp38 # - cp38-cp38
# - cp39-cp39 # - cp39-cp39
- cp310-cp310 - cp310-cp310
steps: steps:
- name: Checkout - name: "Checkout"
uses: actions/checkout@v2 uses: actions/checkout@v2
with: with:
submodules: true submodules: true
@ -43,13 +43,13 @@ jobs:
with: with:
toolchain: stable toolchain: stable
- name: Install requirements - name: "Install requirements"
run: ${PYBIN}/pip install -r requirements.txt run: ${PYBIN}/pip install -r requirements.txt
- name: Generate bindings - name: "Generate bdk.py"
run: bash generate.sh run: bash generate.sh
- name: Build wheel - name: "Build wheel"
run: ${PYBIN}/python setup.py bdist_wheel --verbose run: ${PYBIN}/python setup.py bdist_wheel --verbose
- name: Install wheel - name: Install wheel
@ -58,6 +58,12 @@ jobs:
- name: Run tests - name: Run tests
run: ${PYBIN}/python -m unittest tests/test_bdk.py --verbose run: ${PYBIN}/python -m unittest tests/test_bdk.py --verbose
- name: Upload artifact test
uses: actions/upload-artifact@v2
with:
name: bdkpython-manylinux2014-x86_64-${{ matrix.python }}
path: /home/runner/work/bdk-ffi/bdk-ffi/bdk-python/dist/*.whl
build-macos-universal-wheel: build-macos-universal-wheel:
name: "Build and test macOS wheels" name: "Build and test macOS wheels"
runs-on: macos-12 runs-on: macos-12
@ -80,14 +86,14 @@ jobs:
with: with:
python-version: ${{ matrix.python }} python-version: ${{ matrix.python }}
- name: Generate bdk.py - name: "Generate bdk.py"
run: | run: |
python3 --version python3 --version
rustup target add aarch64-apple-darwin rustup target add aarch64-apple-darwin
pip3 install --user -r requirements.txt pip3 install --user -r requirements.txt
bash generate.sh bash generate.sh
- name: Build wheel - name: "Build wheel"
env: env:
ARCHFLAGS: "-arch x86_64 -arch arm64" ARCHFLAGS: "-arch x86_64 -arch arm64"
run: python3 setup.py bdist_wheel --verbose run: python3 setup.py bdist_wheel --verbose
@ -112,7 +118,7 @@ jobs:
# - '3.9' # - '3.9'
- '3.10' - '3.10'
steps: steps:
- name: Checkout - name: "Checkout"
uses: actions/checkout@v2 uses: actions/checkout@v2
with: with:
submodules: true submodules: true
@ -120,13 +126,13 @@ jobs:
with: with:
python-version: ${{ matrix.python }} python-version: ${{ matrix.python }}
- name: Generate bdk.py - name: "Generate bdk.py"
run: | run: |
python --version python --version
pip install --user -r requirements.txt pip install --user -r requirements.txt
bash generate.sh bash generate.sh
- name: Build wheel - name: "Build wheel"
run: python setup.py bdist_wheel --verbose run: python setup.py bdist_wheel --verbose
# TODO: On Windows the pip install ./dist/*.whl step fails with the following error: # TODO: On Windows the pip install ./dist/*.whl step fails with the following error: