Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
111 changes: 79 additions & 32 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
@@ -1,47 +1,94 @@
name: Python-bitcointx
name: python-bitcointx

on:
push:
branches: [ $default-branch ]
branches: [master, main]
pull_request:
branches: [ $default-branch ]
branches: [master, main]
workflow_dispatch:

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

jobs:
build:
lint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: "3.11"
- name: Install tooling
run: |
python -m pip install --upgrade pip
python -m pip install -e ".[dev]"
- name: Ruff lint
run: ruff check .
- name: Ruff format check
run: ruff format --check .
- name: Mypy
run: mypy

test:
needs: lint
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, macOS-latest]
python-version: ["3.7", "3.8", "3.9", "3.10", "3.11"]
os: [ubuntu-latest, macos-latest]
python-version: ["3.11", "3.12", "3.13"]
# libsecp256k1 v0.4.0 is the documented reference; v0.7.0 is included
# to ensure our compatibility shim (issue #88) keeps working.
libsecp256k1-version: ["v0.4.0", "v0.7.0"]

steps:
- uses: actions/checkout@v2
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v2
with:
python-version: ${{ matrix.python-version }}
- name: Install dependencies
run: |
if [ "$RUNNER_OS" == "Linux" ]; then
sudo apt install libtool build-essential autotools-dev libevent-dev libboost-system-dev libboost-filesystem-dev libboost-test-dev libboost-thread-dev
elif [ "$RUNNER_OS" == "macOS" ]; then
brew install automake libtool boost pkg-config libevent
fi
SECP256K1_VERSION=$(grep -A1 '!LIBSECP256K1_VERSION_MARKER_DO_NOT_MOVE_OR_EDIT!' README.md |tail -n 1|sed -E 's/`(v[0-9\.]+)`/\1/g')
sh -c "git clone https://github.com/bitcoin/secp256k1.git /tmp/libsecp256k1 && cd /tmp/libsecp256k1 && git checkout $SECP256K1_VERSION && ./autogen.sh && ./configure --disable-coverage --disable-benchmark --disable-tests --disable-exhaustive-tests --enable-module-recovery --enable-module-ecdh --enable-module-schnorrsig && make && sudo make install"
sh -c "git clone https://github.com/bitcoin/bitcoin.git /tmp/bitcoin && cd /tmp/bitcoin && git checkout v25.0 && ./autogen.sh && ./configure --without-qtdbus --without-qrencode --without-miniupnpc --disable-tests --disable-wallet --disable-zmq --with-libs --disable-util-cli --disable-util-tx --disable-util-wallet --disable-bench --without-daemon --without-gui --disable-fuzz --disable-ccache --disable-static --with-system-libsecp256k1 && make && sudo make install"
python -m pip install flake8 pytest coverage mypy typing-extensions types-contextvars
- name: Lint with flake8
shell: bash
run: ./run_flake8.sh
- name: Typecheck with mypy
shell: bash
run: ./run_mypy.sh
- name: Test with pytest
env:
LD_LIBRARY_PATH: /usr/local/lib
run: pytest
- uses: actions/checkout@v4

- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}

- name: Install system build dependencies
run: |
if [ "$RUNNER_OS" = "Linux" ]; then
sudo apt-get update
sudo apt-get install -y libtool build-essential autotools-dev
elif [ "$RUNNER_OS" = "macOS" ]; then
brew install automake libtool pkg-config
fi

- name: Build libsecp256k1 ${{ matrix.libsecp256k1-version }}
run: |
git clone https://github.com/bitcoin-core/secp256k1.git /tmp/libsecp256k1
cd /tmp/libsecp256k1
git checkout ${{ matrix.libsecp256k1-version }}
# v0.6.0+ uses CMake exclusively; older versions use autotools.
if [ -f autogen.sh ]; then
./autogen.sh
./configure --disable-coverage --disable-benchmark --disable-tests \
--disable-exhaustive-tests --enable-module-recovery \
--enable-module-ecdh --enable-module-schnorrsig
make
sudo make install
else
cmake -B build -DSECP256K1_ENABLE_MODULE_RECOVERY=ON \
-DSECP256K1_ENABLE_MODULE_ECDH=ON \
-DSECP256K1_ENABLE_MODULE_SCHNORRSIG=ON \
-DSECP256K1_BUILD_TESTS=OFF \
-DSECP256K1_BUILD_BENCHMARK=OFF \
-DSECP256K1_BUILD_EXHAUSTIVE_TESTS=OFF
cmake --build build
sudo cmake --install build
fi

- name: Install package
run: |
python -m pip install --upgrade pip
python -m pip install -e ".[dev]"

- name: Run tests
env:
LD_LIBRARY_PATH: /usr/local/lib
run: pytest -q
59 changes: 0 additions & 59 deletions .travis.yml

This file was deleted.