Skip to content

Commit 1ba3540

Browse files
committed
chore: add test-python.yaml
1 parent a562582 commit 1ba3540

1 file changed

Lines changed: 195 additions & 0 deletions

File tree

.github/workflows/test-python.yaml

Lines changed: 195 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,195 @@
1+
name: Test Python
2+
on:
3+
workflow_dispatch:
4+
push:
5+
pull_request:
6+
7+
permissions: {}
8+
9+
jobs:
10+
build-manylinux_2_28-x86_64-wheels:
11+
name: "Build and test Manylinux 2.28 x86_64 wheels"
12+
runs-on: ubuntu-24.04
13+
container:
14+
image: quay.io/pypa/manylinux_2_28_x86_64
15+
env:
16+
PLAT: manylinux_2_28_x86_64
17+
PYBIN: "/opt/python/${{ matrix.python }}/bin"
18+
strategy:
19+
matrix:
20+
python:
21+
- cp310-cp310
22+
- cp311-cp311
23+
- cp312-cp312
24+
- cp313-cp313
25+
steps:
26+
- name: "Checkout"
27+
uses: actions/checkout@v4
28+
with:
29+
submodules: true
30+
persist-credentials: false
31+
32+
- name: "Install Rust 1.84.1"
33+
uses: actions-rs/toolchain@v1
34+
with:
35+
toolchain: 1.84.1
36+
37+
- name: "Generate bdk.py and binaries"
38+
run: bash ./scripts/generate-linux.sh
39+
40+
- name: "Build wheel"
41+
# Specifying the plat-name argument is necessary to build a wheel with the correct name,
42+
# see issue #350 for more information
43+
run: ${PYBIN}/python setup.py bdist_wheel --plat-name manylinux_2_28_x86_64 --verbose
44+
45+
- name: "Install wheel"
46+
run: ${PYBIN}/pip install ./dist/*.whl
47+
48+
- name: "Run tests"
49+
run: ${PYBIN}/python -m unittest discover --start "./tests/" --pattern "test_offline_*.py" --verbose
50+
51+
- name: "Upload artifact test"
52+
uses: actions/upload-artifact@v4
53+
with:
54+
name: bdkpython-manylinux_2_28_x86_64-${{ matrix.python }}
55+
path: /home/runner/work/bdkpython/bdkpython/dist/*.whl
56+
57+
build-macos-arm64-wheels:
58+
name: "Build and test macOS arm64 wheels"
59+
runs-on: macos-13
60+
strategy:
61+
matrix:
62+
python:
63+
- "3.10"
64+
- "3.11"
65+
- "3.12"
66+
- "3.13"
67+
steps:
68+
- name: "Checkout"
69+
uses: actions/checkout@v4
70+
with:
71+
submodules: true
72+
persist-credentials: false
73+
74+
- name: "Install Python"
75+
uses: actions/setup-python@v4
76+
with:
77+
python-version: ${{ matrix.python }}
78+
79+
- name: "Generate bdk.py and binaries"
80+
run: bash ./scripts/generate-macos-arm64.sh
81+
82+
- name: "Build wheel"
83+
# Specifying the plat-name argument is necessary to build a wheel with the correct name,
84+
# see issue #350 for more information
85+
run: python3 setup.py bdist_wheel --plat-name macosx_11_0_arm64 --verbose
86+
87+
# You can't install the arm64 wheel on the CI, so we skip these steps and simply test that the wheel builds
88+
# - name: "Install wheel and run tests"
89+
# run: |
90+
# pip3 install ./dist/*.whl
91+
# python3 -m unittest discover --start "./tests/" --pattern "test_offline_*.py" --verbose
92+
93+
- name: "Upload artifact test"
94+
uses: actions/upload-artifact@v4
95+
with:
96+
name: bdkpython-macos-arm64-${{ matrix.python }}
97+
path: /Users/runner/work/bdkpython/bdkpython/dist/*.whl
98+
99+
build-macos-x86_64-wheels:
100+
name: "Build and test macOS x86_64 wheels"
101+
runs-on: macos-13
102+
strategy:
103+
matrix:
104+
python:
105+
- "3.10"
106+
- "3.11"
107+
- "3.12"
108+
- "3.13"
109+
steps:
110+
- name: "Checkout"
111+
uses: actions/checkout@v4
112+
with:
113+
submodules: true
114+
persist-credentials: false
115+
116+
- uses: actions/setup-python@v4
117+
with:
118+
python-version: ${{ matrix.python }}
119+
120+
- name: "Generate bdk.py and binaries"
121+
run: bash ./scripts/generate-macos-x86_64.sh
122+
123+
- name: "Build wheel"
124+
# Specifying the plat-name argument is necessary to build a wheel with the correct name,
125+
# see issue #350 for more information
126+
run: python3 setup.py bdist_wheel --plat-name macosx_11_0_x86_64 --verbose
127+
128+
- name: "Install wheel"
129+
run: pip3 install ./dist/*.whl
130+
131+
- name: "Run tests"
132+
run: python3 -m unittest discover --start "./tests/" --pattern "test_offline_*.py" --verbose
133+
134+
- name: "Upload artifact test"
135+
uses: actions/upload-artifact@v4
136+
with:
137+
name: bdkpython-macos-x86_64-${{ matrix.python }}
138+
path: /Users/runner/work/bdkpython/bdkpython/dist/*.whl
139+
140+
build-windows-wheels:
141+
name: "Build and test Windows wheels"
142+
runs-on: windows-2022
143+
strategy:
144+
matrix:
145+
python:
146+
- "3.10"
147+
- "3.11"
148+
- "3.12"
149+
- "3.13"
150+
steps:
151+
- name: "Checkout"
152+
uses: actions/checkout@v4
153+
with:
154+
submodules: true
155+
persist-credentials: false
156+
157+
- name: "Install Python"
158+
uses: actions/setup-python@v4
159+
with:
160+
python-version: ${{ matrix.python }}
161+
162+
- name: "Generate bdk.py and binaries"
163+
run: bash ./scripts/generate-windows.sh
164+
165+
- name: "Build wheel"
166+
run: python setup.py bdist_wheel --verbose
167+
168+
- name: "Upload artifact test"
169+
uses: actions/upload-artifact@v4
170+
with:
171+
name: bdkpython-windows-${{ matrix.python }}
172+
path: D:\a\bdkpython\bdkpython\dist\*.whl
173+
174+
- name: "Install dependencies"
175+
run: Get-ChildItem 'D:\a\bdkpython\bdkpython\dist\*.whl' | ForEach-Object {pip install $_.FullName}
176+
shell: powershell
177+
178+
- name: "Run tests"
179+
run: python -m unittest discover --start "./tests/" --pattern "test_offline_*.py" --verbose
180+
181+
ruff:
182+
name: "Lint tests"
183+
runs-on: ubuntu-24.04
184+
steps:
185+
- name: "Checkout"
186+
uses: actions/checkout@v4
187+
with:
188+
submodules: true
189+
persist-credentials: false
190+
191+
- name: "Install Ruff"
192+
run: curl -LsSf https://astral.sh/ruff/install.sh | sh
193+
194+
- name: "Lint test targets"
195+
run: ruff check ./tests/

0 commit comments

Comments
 (0)