From c1243f9e1c9ff6b5661ac54d799fc2f0d96232a0 Mon Sep 17 00:00:00 2001 From: thunderbiscuit Date: Wed, 1 Mar 2023 13:43:24 -0500 Subject: [PATCH] Update publish Python CI workflow --- .github/workflows/publish-python.yaml | 85 ++++++++++++++------------- .github/workflows/test-python.yaml | 28 +++++---- 2 files changed, 62 insertions(+), 51 deletions(-) diff --git a/.github/workflows/publish-python.yaml b/.github/workflows/publish-python.yaml index b5b8a41..ba4d81c 100644 --- a/.github/workflows/publish-python.yaml +++ b/.github/workflows/publish-python.yaml @@ -8,8 +8,8 @@ on: [workflow_dispatch] jobs: build-manylinux2014-x86_64-wheel: - name: 'Build Manylinux 2014 x86_64 wheel' - runs-on: ubuntu-latest + name: "Build Manylinux 2014 x86_64 wheel" + runs-on: ubuntu-22.04 defaults: run: working-directory: bdk-python @@ -17,7 +17,7 @@ jobs: image: quay.io/pypa/manylinux2014_x86_64 env: PLAT: manylinux2014_x86_64 - PYBIN: '/opt/python/${{ matrix.python }}/bin' + PYBIN: "/opt/python/${{ matrix.python }}/bin" strategy: matrix: python: # Update this list whenever the docker image is updated (check /opt/python/) @@ -29,29 +29,31 @@ jobs: - pp37-pypy37_pp73 - pp38-pypy38_pp73 steps: - - name: checkout + - name: "Checkout" uses: actions/checkout@v2 with: submodules: true - uses: actions-rs/toolchain@v1 with: toolchain: stable - - name: install requirements + + - name: "Install requirements" run: ${PYBIN}/pip install -r requirements.txt - - name: generate bindings + + - name: "Generate bdk.py" run: bash generate.sh - - name: build wheel - run: ${PYBIN}/pip wheel . --no-deps -w /tmp/wheelhouse - - name: repair wheel - run: auditwheel repair /tmp/wheelhouse/* --plat "$PLAT" -w /tmp/wheelhouse-repaired + + - name: "Build wheel" + run: ${PYBIN}/python setup.py bdist_wheel --verbose + - uses: actions/upload-artifact@v2 with: 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: - name: 'Build macOS universal wheel' - runs-on: macos-latest + name: "Build macOS universal wheel" + runs-on: macos-12 defaults: run: working-directory: bdk-python @@ -63,30 +65,34 @@ jobs: - '3.9' - '3.10' steps: - - name: checkout + - name: "Checkout" uses: actions/checkout@v2 with: submodules: true - uses: actions/setup-python@v2 with: python-version: ${{ matrix.python }} - - run: python3 --version - - run: rustup target add aarch64-apple-darwin - - run: pip3 install --user -r requirements.txt - - run: pip3 install --user wheel - - run: bash generate.sh - - name: build wheel + + - name: "Generate bdk.py" + run: | + python3 --version + rustup target add aarch64-apple-darwin + pip3 install --user -r requirements.txt + bash generate.sh + + - name: "Build wheel" env: 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 with: name: bdkpython-macos-${{ matrix.python }} path: /Users/runner/work/bdk-ffi/bdk-ffi/bdk-python/dist/*.whl build-windows-wheel: - name: 'Build windows wheel' - runs-on: windows-latest + name: "Build windows wheel" + runs-on: windows-2022 defaults: run: working-directory: bdk-python @@ -98,45 +104,44 @@ jobs: - '3.9' - '3.10' steps: - - name: checkout + - name: "Checkout" uses: actions/checkout@v2 with: submodules: true - uses: actions/setup-python@v2 with: python-version: ${{ matrix.python }} - - run: python --version - - run: pip install --user -r requirements.txt - - run: bash generate.sh - shell: bash - - run: pip install --user wheel - - name: build wheel - run: python setup.py -v bdist_wheel + + - name: "Generate bdk.py" + run: | + python --version + pip install --user -r requirements.txt + bash generate.sh + + - name: "Build wheel" + run: python setup.py bdist_wheel --verbose + - uses: actions/upload-artifact@v2 with: name: bdkpython-win-${{ matrix.python }} path: D:\a\bdk-ffi\bdk-ffi\bdk-python\dist\*.whl publish-pypi: - name: 'Publish on PyPI' - runs-on: ubuntu-latest + name: "Publish on PyPI" + runs-on: ubuntu-22.04 defaults: run: working-directory: bdk-python needs: [build-manylinux2014-x86_64-wheel, build-macos-universal-wheel, build-windows-wheel] - # needs: [build-macos-universal-wheel] steps: - - name: Checkout + - name: "Checkout" uses: actions/checkout@v2 - - name: 'Download artifacts in dist/ directory' + - name: "Download artifacts in dist/ directory" uses: actions/download-artifact@v2 with: path: dist/ - # - name: Display structure of downloaded files - # run: ls -R - # - name: 'Publish on test PyPI' # uses: pypa/gh-action-pypi-publish@release/v1 # with: @@ -145,7 +150,7 @@ jobs: # repository_url: https://test.pypi.org/legacy/ # packages_dir: dist/*/ - - name: 'Publish on PyPI' + - name: "Publish on PyPI" uses: pypa/gh-action-pypi-publish@release/v1 with: user: __token__ diff --git a/.github/workflows/test-python.yaml b/.github/workflows/test-python.yaml index 938fddd..c048be6 100644 --- a/.github/workflows/test-python.yaml +++ b/.github/workflows/test-python.yaml @@ -25,17 +25,17 @@ jobs: image: quay.io/pypa/manylinux2014_x86_64 env: PLAT: manylinux2014_x86_64 - PYBIN: '/opt/python/${{ matrix.python }}/bin' + PYBIN: "/opt/python/${{ matrix.python }}/bin" strategy: matrix: - python: # Update this list whenever the docker image is updated (check /opt/python/) + python: # - cp36-cp36m # - cp37-cp37m # - cp38-cp38 # - cp39-cp39 - cp310-cp310 steps: - - name: Checkout + - name: "Checkout" uses: actions/checkout@v2 with: submodules: true @@ -43,13 +43,13 @@ jobs: with: toolchain: stable - - name: Install requirements + - name: "Install requirements" run: ${PYBIN}/pip install -r requirements.txt - - name: Generate bindings + - name: "Generate bdk.py" run: bash generate.sh - - name: Build wheel + - name: "Build wheel" run: ${PYBIN}/python setup.py bdist_wheel --verbose - name: Install wheel @@ -58,6 +58,12 @@ jobs: - name: Run tests 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: name: "Build and test macOS wheels" runs-on: macos-12 @@ -80,14 +86,14 @@ jobs: with: python-version: ${{ matrix.python }} - - name: Generate bdk.py + - name: "Generate bdk.py" run: | python3 --version rustup target add aarch64-apple-darwin pip3 install --user -r requirements.txt bash generate.sh - - name: Build wheel + - name: "Build wheel" env: ARCHFLAGS: "-arch x86_64 -arch arm64" run: python3 setup.py bdist_wheel --verbose @@ -112,7 +118,7 @@ jobs: # - '3.9' - '3.10' steps: - - name: Checkout + - name: "Checkout" uses: actions/checkout@v2 with: submodules: true @@ -120,13 +126,13 @@ jobs: with: python-version: ${{ matrix.python }} - - name: Generate bdk.py + - name: "Generate bdk.py" run: | python --version pip install --user -r requirements.txt bash generate.sh - - name: Build wheel + - name: "Build wheel" run: python setup.py bdist_wheel --verbose # TODO: On Windows the pip install ./dist/*.whl step fails with the following error: