Repository navigation
144 lines (139 loc) · 5.34 KB
/
Copy pathpython.yml
File metadata and controls
144 lines (139 loc) · 5.34 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
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
name: Build and Test Python
on:
workflow_call:
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
permissions:
contents: read
jobs:
# Pull requests run only the Linux build and test job. The other jobs
# cover macOS, Windows and packaging, and run on bindings releases and
# the daily run.
build-python-and-test:
name: "Build and test python"
runs-on: ubuntu-26.04
env:
RUSTUP_TOOLCHAIN: 1.85.0
steps:
- name: Checkout
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
persist-credentials: false # unneeded: no git auth beyond checkout
- name: "Install Rust 1.85.0"
uses: dtolnay/rust-toolchain@683b588c487a69d01f6c6ddf40f036ff682cc2c8 # v1
with:
toolchain: 1.85.0
- name: "Use cache"
uses: Swatinem/rust-cache@d1527c8f67ef9af357290475d4af4b0fab8f12e0 # v2.9.3
with:
lookup-only: ${{ startsWith(github.ref, 'refs/tags/') }}
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-python-and-test-macos:
name: "Build and test python (macos)"
if: github.event_name != 'pull_request'
runs-on: macos-latest
env:
RUSTUP_TOOLCHAIN: 1.85.0
steps:
- name: Checkout
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
persist-credentials: false # unneeded: no git auth beyond checkout
- name: "Install Rust 1.85.0"
uses: dtolnay/rust-toolchain@683b588c487a69d01f6c6ddf40f036ff682cc2c8 # v1
with:
toolchain: 1.85.0
- name: "Use cache"
uses: Swatinem/rust-cache@d1527c8f67ef9af357290475d4af4b0fab8f12e0 # v2.9.3
with:
lookup-only: ${{ startsWith(github.ref, 'refs/tags/') }}
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"
if: github.event_name != 'pull_request'
runs-on: ubuntu-26.04
strategy:
fail-fast: false
matrix:
platform: [linux-x64, macos-universal2]
steps:
- name: Checkout
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
persist-credentials: false # unneeded: no git auth beyond checkout
- name: "Use cache"
uses: Swatinem/rust-cache@d1527c8f67ef9af357290475d4af4b0fab8f12e0 # v2.9.3
with:
lookup-only: ${{ startsWith(github.ref, 'refs/tags/') }}
- 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@cf430e030ddbb5b0abf93d22962f4752f3646cd9 # v7.0.2
with:
name: payjoin-python-wheel-${{ matrix.platform }}
path: payjoin-ffi/python/dist/*.whl
if-no-files-found: error
smoke-wheel:
name: "Smoke test wheel"
if: github.event_name != 'pull_request'
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@9000827ccba6bdab643e8b6fd33ac0654aef8333 # v8.0.2
with:
pattern: payjoin-python-wheel-*
merge-multiple: true
path: dist
- name: Install Python
uses: actions/setup-python@6d4fd22b20465ccc0f7354476588e8df7c9ca0e0 # v7.1.0
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")
'