Skip to content

Commit 1364c24

Browse files
committed
Add redis compatible workflow
By adding ubuntu latest for linux and a special workflow command for macos we are able to enable redis to create a compatible workflow for running the new integration tests.
1 parent 021dab3 commit 1364c24

File tree

1 file changed

+42
-26
lines changed

1 file changed

+42
-26
lines changed

.github/workflows/build-python.yml

Lines changed: 42 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -3,30 +3,23 @@ name: Build and Test Python
33
on: [push, pull_request]
44

55
jobs:
6-
build-manylinux_2_28-x86_64-wheels:
7-
name: "Build and test Manylinux 2.28 x86_64 wheels"
8-
runs-on: ubuntu-24.04
6+
build-wheels-and-test:
7+
name: "Build and test wheels with Redis"
8+
runs-on: ubuntu-latest
9+
services:
10+
redis:
11+
image: redis:7-alpine
912
defaults:
1013
run:
1114
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"
1715
strategy:
1816
matrix:
1917
include:
2018
- python: "3.9"
21-
python_dir: "cp39-cp39"
2219
- python: "3.10"
23-
python_dir: "cp310-cp310"
2420
- python: "3.11"
25-
python_dir: "cp311-cp311"
2621
- python: "3.12"
27-
python_dir: "cp312-cp312"
2822
- python: "3.13"
29-
python_dir: "cp313-cp313"
3023
steps:
3124
- name: "Checkout"
3225
uses: actions/checkout@v4
@@ -41,22 +34,29 @@ jobs:
4134
with:
4235
python-version: ${{ matrix.python }}
4336

37+
- name: "Install build dependencies"
38+
run: |
39+
sudo apt update
40+
sudo apt install -y build-essential python3-dev
41+
4442
- name: "Use cache"
4543
uses: Swatinem/rust-cache@v2
4644

4745
- name: "Generate payjoin-ffi.py and binaries"
48-
run: PYBIN="/opt/python/${{ matrix.python_dir }}/bin" bash ./scripts/generate_linux.sh
46+
run: |
47+
PYBIN=$(dirname $(which python))
48+
PYBIN="$PYBIN" bash ./scripts/generate_linux.sh
4949
5050
- name: "Build wheel"
51-
# Specifying the plat-name argument is necessary to build a wheel with the correct name,
52-
# see issue BDK#350 for more information
53-
run: ${PYBIN}/python setup.py bdist_wheel --plat-name $PLAT --verbose
51+
run: python setup.py bdist_wheel --verbose
5452

5553
- name: "Install wheel"
56-
run: ${PYBIN}/pip install ./dist/*.whl
54+
run: pip install ./dist/*.whl
5755

5856
- name: "Run tests"
59-
run: ${PYBIN}/python -m unittest -v
57+
env:
58+
REDIS_URL: redis://localhost:6379
59+
run: python -m unittest -v
6060

6161
build-macos:
6262
name: "Build and test macOS"
@@ -84,23 +84,39 @@ jobs:
8484
with:
8585
python-version: ${{ matrix.python }}
8686

87+
- name: Setup Docker on macOS
88+
uses: douglascamata/setup-docker-macos-action@v1.0.0
89+
90+
- name: "Install Redis"
91+
run: |
92+
brew update
93+
brew install redis
94+
95+
- name: "Start Redis"
96+
run: |
97+
redis-server --daemonize yes
98+
for i in {1..10}; do
99+
if redis-cli ping | grep -q PONG; then
100+
echo "Redis is ready"
101+
break
102+
fi
103+
echo "Waiting for Redis..."
104+
sleep 1
105+
done
106+
87107
- name: "Use cache"
88108
uses: Swatinem/rust-cache@v2
89109

90110
- name: "Generate payjoin-ffi.py and binaries"
91111
run: bash ./scripts/generate_macos.sh
92112

93113
- name: "Build wheel"
94-
# Specifying the plat-name argument is necessary to build a wheel with the correct name,
95-
# see issue BDK#350 for more information
96-
run: python3 setup.py bdist_wheel --plat-name macosx_11_0_x86_64 --verbose
114+
run: python3 setup.py bdist_wheel --verbose
97115

98116
- name: "Install wheel"
99117
run: pip3 install ./dist/*.whl
100118

101119
- name: "Run tests"
120+
env:
121+
REDIS_URL: redis://localhost:6379
102122
run: python3 -m unittest -v
103-
104-
- name: "Build arm64 wheel"
105-
run: python3 setup.py bdist_wheel --plat-name macosx_11_0_arm64 --verbose
106-
# Note: You can't install the arm64 wheel on the CI, so we skip these steps and simply test that the wheel builds

0 commit comments

Comments
 (0)