|
| 1 | +# Copied from [bdk-ffi](https://github.com/bitcoindevkit/bdk-ffi/blob/master/.github/workflows/test-python.yaml) |
| 2 | +name: Build and Test Python |
| 3 | +on: [push, pull_request] |
| 4 | + |
| 5 | +jobs: |
| 6 | + build-manylinux_2_28-x86_64-wheels: |
| 7 | + name: "Build and test Manylinux 2.28 x86_64 wheels" |
| 8 | + runs-on: ubuntu-20.04 |
| 9 | + defaults: |
| 10 | + run: |
| 11 | + working-directory: python |
| 12 | + container: |
| 13 | + image: quay.io/pypa/manylinux_2_28_x86_64 |
| 14 | + env: |
| 15 | + PLAT: manylinux_2_28_x86_64 |
| 16 | + PYBIN: "/opt/python/${{ matrix.python_dir }}/bin" |
| 17 | + strategy: |
| 18 | + matrix: |
| 19 | + include: |
| 20 | + - python: "3.8" |
| 21 | + python_dir: "cp38-cp38" |
| 22 | + - python: "3.9" |
| 23 | + python_dir: "cp39-cp39" |
| 24 | + - python: "3.10" |
| 25 | + python_dir: "cp310-cp310" |
| 26 | + - python: "3.11" |
| 27 | + python_dir: "cp311-cp311" |
| 28 | + - python: "3.12" |
| 29 | + python_dir: "cp312-cp312" |
| 30 | + steps: |
| 31 | + - name: "Checkout" |
| 32 | + uses: actions/checkout@v4 |
| 33 | + |
| 34 | + - name: "Install Rust 1.78.0" |
| 35 | + uses: actions-rs/toolchain@v1 |
| 36 | + with: |
| 37 | + toolchain: 1.78.0 |
| 38 | + |
| 39 | + - name: "Install Python" |
| 40 | + uses: actions/setup-python@v4 |
| 41 | + with: |
| 42 | + python-version: ${{ matrix.python }} |
| 43 | + |
| 44 | + - name: "Generate payjoin-ffi.py and binaries" |
| 45 | + run: PYBIN="/opt/python/${{ matrix.python_dir }}/bin" bash ./scripts/generate_linux.sh |
| 46 | + |
| 47 | + - name: "Build wheel" |
| 48 | + # Specifying the plat-name argument is necessary to build a wheel with the correct name, |
| 49 | + # see issue BDK#350 for more information |
| 50 | + run: ${PYBIN}/python setup.py bdist_wheel --plat-name $PLAT --verbose |
| 51 | + |
| 52 | + - name: "Install wheel" |
| 53 | + run: ${PYBIN}/pip install ./dist/*.whl |
| 54 | + |
| 55 | + - name: "Run tests" |
| 56 | + run: ${PYBIN}/python -m unittest --verbose test/payjoin_unit_test.py |
| 57 | + |
| 58 | + build-macos: |
| 59 | + name: "Build and test macOS" |
| 60 | + runs-on: macos-13 |
| 61 | + defaults: |
| 62 | + run: |
| 63 | + working-directory: python |
| 64 | + strategy: |
| 65 | + matrix: |
| 66 | + python: |
| 67 | + - "3.8" |
| 68 | + - "3.9" |
| 69 | + - "3.10" |
| 70 | + - "3.11" |
| 71 | + - "3.12" |
| 72 | + steps: |
| 73 | + - name: "Checkout" |
| 74 | + uses: actions/checkout@v4 |
| 75 | + with: |
| 76 | + submodules: true |
| 77 | + |
| 78 | + - name: "Install Rust 1.78.0" |
| 79 | + uses: actions-rs/toolchain@v1 |
| 80 | + with: |
| 81 | + toolchain: 1.78.0 |
| 82 | + |
| 83 | + - name: "Install Python" |
| 84 | + uses: actions/setup-python@v4 |
| 85 | + with: |
| 86 | + python-version: ${{ matrix.python }} |
| 87 | + |
| 88 | + - name: "Generate payjoin-ffi.py and binaries" |
| 89 | + run: bash ./scripts/generate_macos.sh |
| 90 | + |
| 91 | + - name: "Build wheel" |
| 92 | + # Specifying the plat-name argument is necessary to build a wheel with the correct name, |
| 93 | + # see issue BDK#350 for more information |
| 94 | + run: python3 setup.py bdist_wheel --plat-name macosx_11_0_x86_64 --verbose |
| 95 | + |
| 96 | + - name: "Install wheel" |
| 97 | + run: pip3 install ./dist/*.whl |
| 98 | + |
| 99 | + - name: "Run tests" |
| 100 | + run: python3 -m unittest --verbose test/payjoin_unit_test.py |
0 commit comments