Repository navigation
110 lines (107 loc) · 3.59 KB
/
Copy pathpython.yml
File metadata and controls
110 lines (107 loc) · 3.59 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
name: Build and Test Python
on:
workflow_run:
workflows: ["Flake maintenance"]
types: [requested]
branches:
- "update_flake_lock_action"
pull_request:
paths:
- payjoin-ffi/**
# The jobs run inside the flake's dev shell, so changes to the flake
# change this workflow's environment.
- flake.nix
- flake.lock
workflow_call:
jobs:
build-python-and-test:
name: "Build and test python"
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-26.04, macos-latest]
env:
RUSTUP_TOOLCHAIN: 1.85.0
steps:
- name: Checkout
uses: actions/checkout@v6
- name: "Install Rust 1.85.0"
uses: dtolnay/rust-toolchain@1.85.0
- name: "Use cache"
uses: Swatinem/rust-cache@v2
with:
shared-key: msrv-workspace
- name: Set up nix
uses: ./.github/actions/setup-nix
- name: "Build and test"
run: nix develop .#python --command bash ./payjoin-ffi/python/contrib/test.sh
build-wheel:
# The wheel bundles a prebuilt native library, so each supported
# platform packs its own wheel: x86_64 on Linux (retagged manylinux by
# auditwheel) and a fat universal2 dylib for macOS. Both wheels build
# on a Linux host. The smoke jobs below verify each wheel on real hardware.
name: "Build wheel"
runs-on: ubuntu-26.04
strategy:
fail-fast: false
matrix:
platform: [linux-x64, macos-universal2]
steps:
- name: Checkout
uses: actions/checkout@v6
- name: "Use cache"
uses: Swatinem/rust-cache@v2
- name: Set up nix
uses: ./.github/actions/setup-nix
- name: Build the wheel
run: nix develop .#python --command bash ./payjoin-ffi/python/contrib/build-wheel.sh
env:
PAYJOIN_WHEEL_PLATFORM: ${{ matrix.platform }}
- name: Upload wheel
uses: actions/upload-artifact@v4
with:
name: payjoin-python-wheel-${{ matrix.platform }}
path: payjoin-ffi/python/dist/*.whl
if-no-files-found: error
smoke-wheel:
name: "Smoke test wheel"
runs-on: ${{ matrix.os }}
needs: build-wheel
strategy:
matrix:
os: [ubuntu-26.04, macos-latest, macos-15-intel]
steps:
- name: Download wheels
uses: actions/download-artifact@v4
with:
pattern: payjoin-python-wheel-*
merge-multiple: true
path: dist
- name: Install Python
uses: actions/setup-python@v5
with:
# Deliberately not the version the wheel was built with: the
# wheels are tagged py3-none (the bindings load the library
# through ctypes), and installing on a different CPython proves
# the retag.
python-version: "3.12"
- name: Install and exercise the wheel
shell: bash
run: |
set -euo pipefail
shopt -s nullglob
pkgs=(dist/payjoin-*.whl)
# download-artifact succeeds even when the pattern matches nothing.
if [ "${#pkgs[@]}" -eq 0 ]; then
echo "::error::no payjoin wheels found in dist/"
exit 1
fi
version="$(basename "${pkgs[0]}" | cut -d- -f2)"
# pip picks whichever wheel matches this runner's platform;
# dependencies come from PyPI.
python -m pip install --only-binary payjoin --find-links dist "payjoin==$version"
python -c '
import payjoin
payjoin.Uri.parse("bitcoin:12c6DSiU4Rq3P4ZxziKxzrL5LmMBrzjrJX?amount=1&pj=https://example.com")
print("smoke ok")
'