mirror of
https://github.com/daywalker90/cln-nip47.git
synced 2026-08-13 12:33:43 +02:00
ci/tests: switch to uv and cleanup github action
This commit is contained in:
parent
ae8817e7a6
commit
0a9eb7cd82
5 changed files with 3044 additions and 101 deletions
69
.github/workflows/ci.yml
vendored
69
.github/workflows/ci.yml
vendored
|
|
@ -27,8 +27,8 @@ jobs:
|
|||
bitcoind-version: ["29.0"]
|
||||
experimental: [1]
|
||||
deprecated: [0]
|
||||
python-version: ["3.9", "3.12"]
|
||||
os: ["ubuntu-24.04"]
|
||||
python-version: ["3.9", "3.13"]
|
||||
os: ["ubuntu-latest"]
|
||||
|
||||
runs-on: ${{ matrix.os }}
|
||||
|
||||
|
|
@ -74,23 +74,17 @@ jobs:
|
|||
path: /usr/local/bin/bitcoin*
|
||||
key: cache-bitcoind-${{ matrix.bitcoind-version }}-${{ steps.exact_versions.outputs.os_version }}
|
||||
|
||||
- name: Cache python dependencies
|
||||
id: cache-python
|
||||
uses: actions/cache@v4
|
||||
- name: Install uv
|
||||
uses: astral-sh/setup-uv@v6
|
||||
with:
|
||||
path: venv
|
||||
key: cache-python-${{ steps.exact_versions.outputs.python_version }}-${{ steps.exact_versions.outputs.os_version }}-${{ inputs.pyln-version }}-${{ hashFiles('tests/requirements.txt') }}
|
||||
enable-cache: true
|
||||
cache-dependency-glob: "**/pyproject.toml"
|
||||
|
||||
- name: Download Bitcoin ${{ matrix.bitcoind-version }} & install binaries
|
||||
if: ${{ steps.cache-bitcoind.outputs.cache-hit != 'true' }}
|
||||
run: |
|
||||
export BITCOIND_VERSION=${{ matrix.bitcoind-version }}
|
||||
if [[ "${{ matrix.os }}" =~ "ubuntu" ]]; then
|
||||
export TARGET_ARCH="x86_64-linux-gnu"
|
||||
fi
|
||||
if [[ "${{ matrix.os }}" =~ "macos" ]]; then
|
||||
export TARGET_ARCH="x86_64-apple-darwin"
|
||||
fi
|
||||
export TARGET_ARCH="x86_64-linux-gnu"
|
||||
wget https://bitcoincore.org/bin/bitcoin-core-${BITCOIND_VERSION}/bitcoin-${BITCOIND_VERSION}-${TARGET_ARCH}.tar.gz
|
||||
tar -xzf bitcoin-${BITCOIND_VERSION}-${TARGET_ARCH}.tar.gz
|
||||
sudo mv bitcoin-${BITCOIND_VERSION}/bin/* /usr/local/bin
|
||||
|
|
@ -111,54 +105,11 @@ jobs:
|
|||
uses: dtolnay/rust-toolchain@stable
|
||||
|
||||
- name: Set up protoc
|
||||
if: ${{ inputs.tagged-release == false}} || contains(matrix.os, 'macos') && ${{ steps.cache-cln.outputs.cache-hit != 'true' }}
|
||||
if: ${{ inputs.tagged-release == false}} && ${{ steps.cache-cln.outputs.cache-hit != 'true' }}
|
||||
uses: arduino/setup-protoc@v3
|
||||
with:
|
||||
repo-token: ${{ secrets.GITHUB_TOKEN }}
|
||||
|
||||
- name: Checkout Core Lightning ${{ inputs.cln-version }}
|
||||
if: ${{ contains(matrix.os, 'macos') && steps.cache-cln.outputs.cache-hit != 'true' }}
|
||||
uses: actions/checkout@v4
|
||||
with:
|
||||
repository: 'ElementsProject/lightning'
|
||||
path: 'lightning'
|
||||
ref: ${{ inputs.cln-version }}
|
||||
submodules: 'recursive'
|
||||
|
||||
- name: Install System dependencies
|
||||
run: |
|
||||
if [[ "${{ matrix.os }}" =~ "macos" ]]; then
|
||||
brew install autoconf automake libtool gnu-sed gettext libsodium sqlite
|
||||
fi
|
||||
|
||||
- name: Install Python dependencies
|
||||
if: ${{ steps.cache-python.outputs.cache-hit != 'true' }}
|
||||
run: |
|
||||
python -m venv venv
|
||||
source venv/bin/activate
|
||||
python -m pip install -U pip poetry wheel
|
||||
pip3 install "pyln-proto<=${{ inputs.pyln-version }}" "pyln-client<=${{ inputs.pyln-version }}" "pyln-testing<=${{ inputs.pyln-version }}"
|
||||
pip3 install pytest-xdist pytest-test-groups pytest-timeout
|
||||
if [ -f "tests/requirements.txt" ]; then
|
||||
pip3 install -r tests/requirements.txt
|
||||
fi
|
||||
|
||||
- name: Compile Core Lightning ${{ inputs.cln-version }} & install binaries
|
||||
if: ${{ contains(matrix.os, 'macos') && steps.cache-cln.outputs.cache-hit != 'true' }}
|
||||
run: |
|
||||
export EXPERIMENTAL_FEATURES=${{ matrix.experimental }}
|
||||
export COMPAT=${{ matrix.deprecated }}
|
||||
export VALGRIND=0
|
||||
source venv/bin/activate
|
||||
|
||||
cd lightning
|
||||
|
||||
poetry lock
|
||||
poetry install
|
||||
./configure --disable-valgrind
|
||||
poetry run make
|
||||
sudo make install
|
||||
|
||||
- name: Get plugin binary
|
||||
run: |
|
||||
source venv/bin/activate
|
||||
|
|
@ -184,5 +135,5 @@ jobs:
|
|||
export TRAVIS=1
|
||||
export VALGRIND=0
|
||||
export PYTEST_TIMEOUT=600
|
||||
source venv/bin/activate
|
||||
pytest -n=5 tests/test_*.py
|
||||
|
||||
uv run pytest -n=10 tests/test_*.py
|
||||
|
|
|
|||
20
pyproject.toml
Normal file
20
pyproject.toml
Normal file
|
|
@ -0,0 +1,20 @@
|
|||
[project]
|
||||
name = "cln-nip47"
|
||||
version = "0.1.0"
|
||||
requires-python = ">=3.9"
|
||||
description = "python dependencies for running tests"
|
||||
|
||||
[dependency-groups]
|
||||
dev = [
|
||||
"pytest>=8.4,<9",
|
||||
"pytest-asyncio>=0.23.8,<2",
|
||||
"pytest-xdist>=3.7,<4",
|
||||
"pytest-timeout>=2.4,<3",
|
||||
"nostr-sdk>=0.43",
|
||||
"PyYAML>=6.0.2,<7",
|
||||
"nostr_relay>=1.14",
|
||||
"pyln-testing>=25.5",
|
||||
]
|
||||
|
||||
[tool.uv]
|
||||
override-dependencies = ["pytest>=8.4,<9"]
|
||||
|
|
@ -1,4 +0,0 @@
|
|||
pytest-asyncio<0.24
|
||||
nostr-sdk>=0.43
|
||||
PyYAML
|
||||
nostr_relay
|
||||
60
tests/test_clnnwc.py
Normal file → Executable file
60
tests/test_clnnwc.py
Normal file → Executable file
|
|
@ -1,12 +1,9 @@
|
|||
#!/usr/bin/python
|
||||
|
||||
import hashlib
|
||||
import importlib.resources as pkg_resources
|
||||
import json
|
||||
import logging
|
||||
import socket
|
||||
import subprocess
|
||||
import sys
|
||||
import time
|
||||
from datetime import datetime, timedelta
|
||||
from pathlib import Path
|
||||
|
|
@ -19,34 +16,32 @@ from pyln.testing.fixtures import * # noqa: F403
|
|||
from pyln.testing.utils import RpcError, wait_for
|
||||
from util import generate_random_label, get_plugin # noqa: F401
|
||||
|
||||
if sys.version_info >= (3, 9):
|
||||
from nostr_sdk import (
|
||||
Alphabet,
|
||||
Client,
|
||||
RelayUrl,
|
||||
EventBuilder,
|
||||
Filter,
|
||||
Keys,
|
||||
KeysendTlvRecord,
|
||||
Kind,
|
||||
ListTransactionsRequest,
|
||||
LookupInvoiceRequest,
|
||||
MakeInvoiceRequest,
|
||||
NostrSdkError,
|
||||
NostrSigner,
|
||||
NostrWalletConnectUri,
|
||||
Nwc,
|
||||
PayInvoiceRequest,
|
||||
PayKeysendRequest,
|
||||
SingleLetterTag,
|
||||
Tag,
|
||||
TagKind,
|
||||
)
|
||||
from nostr_sdk import (
|
||||
Alphabet,
|
||||
Client,
|
||||
RelayUrl,
|
||||
EventBuilder,
|
||||
Filter,
|
||||
Keys,
|
||||
KeysendTlvRecord,
|
||||
Kind,
|
||||
ListTransactionsRequest,
|
||||
LookupInvoiceRequest,
|
||||
MakeInvoiceRequest,
|
||||
NostrSdkError,
|
||||
NostrSigner,
|
||||
NostrWalletConnectUri,
|
||||
Nwc,
|
||||
PayInvoiceRequest,
|
||||
PayKeysendRequest,
|
||||
SingleLetterTag,
|
||||
Tag,
|
||||
TagKind,
|
||||
)
|
||||
|
||||
LOGGER = logging.getLogger(__name__)
|
||||
|
||||
|
||||
@pytest.mark.skipif(sys.version_info < (3, 9), reason="Requires Python 3.9 or higher")
|
||||
@pytest.mark.asyncio
|
||||
async def test_get_balance(node_factory, get_plugin, nostr_client): # noqa: F811
|
||||
nostr_client, relay_port = nostr_client
|
||||
|
|
@ -86,7 +81,6 @@ async def test_get_balance(node_factory, get_plugin, nostr_client): # noqa: F81
|
|||
uri_str = l1.rpc.call("nip47-create", ["test3", -1])["uri"]
|
||||
|
||||
|
||||
@pytest.mark.skipif(sys.version_info < (3, 9), reason="Requires Python 3.9 or higher")
|
||||
@pytest.mark.asyncio
|
||||
async def test_get_info(node_factory, get_plugin, nostr_client): # noqa: F811
|
||||
nostr_client, relay_port = nostr_client
|
||||
|
|
@ -203,7 +197,6 @@ async def test_get_info(node_factory, get_plugin, nostr_client): # noqa: F811
|
|||
)
|
||||
|
||||
|
||||
@pytest.mark.skipif(sys.version_info < (3, 9), reason="Requires Python 3.9 or higher")
|
||||
@pytest.mark.asyncio
|
||||
async def test_make_invoice(node_factory, get_plugin, nostr_client): # noqa: F811
|
||||
nostr_client, relay_port = nostr_client
|
||||
|
|
@ -274,7 +267,6 @@ async def test_make_invoice(node_factory, get_plugin, nostr_client): # noqa: F8
|
|||
)
|
||||
|
||||
|
||||
@pytest.mark.skipif(sys.version_info < (3, 9), reason="Requires Python 3.9 or higher")
|
||||
@pytest.mark.asyncio
|
||||
async def test_pay_keysend(node_factory, get_plugin, nostr_client): # noqa: F811
|
||||
nostr_client, relay_port = nostr_client
|
||||
|
|
@ -326,7 +318,6 @@ async def test_pay_keysend(node_factory, get_plugin, nostr_client): # noqa: F81
|
|||
)
|
||||
|
||||
|
||||
@pytest.mark.skipif(sys.version_info < (3, 9), reason="Requires Python 3.9 or higher")
|
||||
@pytest.mark.asyncio
|
||||
async def test_multi_keysend(node_factory, get_plugin, nostr_client): # noqa: F811
|
||||
nostr_client, relay_port = nostr_client
|
||||
|
|
@ -425,7 +416,6 @@ async def test_multi_keysend(node_factory, get_plugin, nostr_client): # noqa: F
|
|||
assert content["error"]["code"] == "QUOTA_EXCEEDED"
|
||||
|
||||
|
||||
@pytest.mark.skipif(sys.version_info < (3, 9), reason="Requires Python 3.9 or higher")
|
||||
@pytest.mark.asyncio
|
||||
async def test_lookup_invoice(node_factory, get_plugin, nostr_client): # noqa: F811
|
||||
nostr_client, relay_port = nostr_client
|
||||
|
|
@ -632,7 +622,6 @@ async def test_lookup_invoice(node_factory, get_plugin, nostr_client): # noqa:
|
|||
)
|
||||
|
||||
|
||||
@pytest.mark.skipif(sys.version_info < (3, 9), reason="Requires Python 3.9 or higher")
|
||||
@pytest.mark.asyncio
|
||||
async def test_list_transactions(node_factory, get_plugin, nostr_client): # noqa: F811
|
||||
nostr_client, relay_port = nostr_client
|
||||
|
|
@ -717,7 +706,6 @@ async def test_list_transactions(node_factory, get_plugin, nostr_client): # noq
|
|||
tx.fees_paid is not None
|
||||
|
||||
|
||||
@pytest.mark.skipif(sys.version_info < (3, 9), reason="Requires Python 3.9 or higher")
|
||||
@pytest.mark.asyncio
|
||||
async def test_notifications(node_factory, get_plugin, nostr_client): # noqa: F811
|
||||
nostr_client, relay_port = nostr_client
|
||||
|
|
@ -877,7 +865,6 @@ async def test_notifications(node_factory, get_plugin, nostr_client): # noqa: F
|
|||
assert events.len() == 2
|
||||
|
||||
|
||||
@pytest.mark.skipif(sys.version_info < (3, 9), reason="Requires Python 3.9 or higher")
|
||||
@pytest.mark.asyncio
|
||||
async def test_pay_invoice(node_factory, get_plugin, nostr_client): # noqa: F811
|
||||
nostr_client, relay_port = nostr_client
|
||||
|
|
@ -925,7 +912,6 @@ async def test_pay_invoice(node_factory, get_plugin, nostr_client): # noqa: F81
|
|||
)
|
||||
|
||||
|
||||
@pytest.mark.skipif(sys.version_info < (3, 9), reason="Requires Python 3.9 or higher")
|
||||
@pytest.mark.asyncio
|
||||
async def test_multi_pay(node_factory, get_plugin, nostr_client): # noqa: F811
|
||||
nostr_client, relay_port = nostr_client
|
||||
|
|
@ -1016,7 +1002,6 @@ async def test_multi_pay(node_factory, get_plugin, nostr_client): # noqa: F811
|
|||
assert len(error_pays) == 1
|
||||
|
||||
|
||||
@pytest.mark.skipif(sys.version_info < (3, 9), reason="Requires Python 3.9 or higher")
|
||||
@pytest.mark.asyncio
|
||||
async def test_persistency(node_factory, get_plugin, nostr_client): # noqa: F811
|
||||
nostr_client, relay_port = nostr_client
|
||||
|
|
@ -1146,7 +1131,6 @@ async def test_persistency(node_factory, get_plugin, nostr_client): # noqa: F81
|
|||
assert list["test1"]["budget_msat"] == 3000
|
||||
|
||||
|
||||
@pytest.mark.skipif(sys.version_info < (3, 9), reason="Requires Python 3.9 or higher")
|
||||
@pytest.mark.asyncio
|
||||
async def test_budget_command(node_factory, get_plugin, nostr_client): # noqa: F811
|
||||
nostr_client, relay_port = nostr_client
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue