Skip to content
Merged
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
16 changes: 14 additions & 2 deletions .github/scripts/install-bitcoind.sh
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
#!/bin/sh
# If an argument is specified, that dir is checked before downloading,
# and updated after successful install.

set -e

Expand All @@ -18,13 +20,23 @@ cd /tmp/
# testing against `bitcoind` but still believe that we ran against
# `elementsd`.
if [ "$TEST_NETWORK" = "liquid-regtest" ]; then
wget "https://github.com/ElementsProject/elements/releases/download/elements-${ELEMENTS_VERSION}/${EFILENAME}"
if [ -f "$1/${EFILENAME}" ]; then
cp "$1/${EFILENAME}" .
else
wget "https://github.com/ElementsProject/elements/releases/download/elements-${ELEMENTS_VERSION}/${EFILENAME}"
fi
tar -xf "${EFILENAME}"
[ "$1" = "" ] || cp "${EFILENAME}" "$1"/
sudo mv "${EDIRNAME}"/bin/* "/usr/local/bin"
rm -rf "${EFILENAME}" "${EDIRNAME}"
else
wget "https://bitcoincore.org/bin/bitcoin-core-${BITCOIN_VERSION}/${FILENAME}"
if [ -f "$1/${FILENAME}" ]; then
cp "$1/${FILENAME}" .
else
wget "https://bitcoincore.org/bin/bitcoin-core-${BITCOIN_VERSION}/${FILENAME}"
fi
tar -xf "${FILENAME}"
[ "$1" = "" ] || cp "${FILENAME}" "$1"/
sudo mv "${DIRNAME}"/bin/* "/usr/local/bin"
rm -rf "${FILENAME}" "${DIRNAME}"
fi
Expand Down
30 changes: 23 additions & 7 deletions .github/scripts/setup.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,18 +3,26 @@ set -e
export DEBIAN_FRONTEND=noninteractive
export RUST_VERSION=stable

sudo useradd -ms /bin/bash tester
sudo apt-get update -qq
sudo mkdir -p /var/cache/apt/archives
mkdir -p ~/ci-cache/apt/
sudo cp -a ~/ci-cache/apt/. /var/cache/apt/archives/ 2>/dev/null || true

sudo apt-get -qq install --no-install-recommends --allow-unauthenticated -yy \
sudo apt-get update

# Install eatmydata, then use it for the rest.
sudo apt-get install --no-install-recommends --allow-unauthenticated -yy \
-o APT::Keep-Downloaded-Packages=true \
eatmydata

sudo eatmydata apt-get install --no-install-recommends --allow-unauthenticated -yy \
-o APT::Keep-Downloaded-Packages=true \
autoconf \
automake \
binfmt-support \
build-essential \
clang \
cppcheck \
docbook-xml \
eatmydata \
gcc-aarch64-linux-gnu \
gcc-arm-linux-gnueabihf \
gcc-arm-none-eabi \
Expand Down Expand Up @@ -64,7 +72,7 @@ sudo apt-get -qq install --no-install-recommends --allow-unauthenticated -yy \
echo "tester ALL=(root) NOPASSWD:ALL" | sudo tee /etc/sudoers.d/tester
sudo chmod 0440 /etc/sudoers.d/tester

"$(dirname "$0")"/install-bitcoind.sh
"$(dirname "$0")"/install-bitcoind.sh ~/ci-cache/

curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- \
-y --default-toolchain ${RUST_VERSION}
Expand Down Expand Up @@ -92,8 +100,14 @@ uv tool install poetry

PROTOC_VERSION=29.4
PB_REL="https://github.com/protocolbuffers/protobuf/releases"
curl -LO $PB_REL/download/v${PROTOC_VERSION}/protoc-${PROTOC_VERSION}-linux-x86_64.zip
sudo unzip protoc-${PROTOC_VERSION}-linux-x86_64.zip -d /usr/local/
PROTOC_ZIP=protoc-${PROTOC_VERSION}-linux-x86_64.zip
if [ ! -f ~/ci-cache/$PROTOC_ZIP ]; then
curl -LO $PB_REL/download/v${PROTOC_VERSION}/$PROTOC_ZIP
# Check it before we commit it to the cache!
unzip -t $PROTOC_ZIP
cp $PROTOC_ZIP ~/ci-cache/
fi
sudo unzip ~/ci-cache/$PROTOC_ZIP -d /usr/local/
sudo chmod a+x /usr/local/bin/protoc
export PROTOC=/usr/local/bin/protoc
export PATH=$PATH:/usr/local/bin
Expand All @@ -110,3 +124,5 @@ sudo setcap cap_net_raw,cap_net_admin=eip /usr/bin/dumpcap
# Add ourselves to the wireshark group (still need "sg wireshark..." for it to take effect)
sudo usermod -aG wireshark "$(id -nu)"

# Copy archives back for caching
cp /var/cache/apt/archives/*.deb ~/ci-cache/apt/ || true
74 changes: 65 additions & 9 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,8 @@ env:
# Reduce size, helps upload-artifact work more reliably
RUST_PROFILE: small
SLOW_MACHINE: 1
CI_SERVER_URL: "http://35.239.136.52:3170"
# This is for the pytest-trackflaky:
# CI_SERVER_URL: "http://35.239.136.52:3170"
PYTEST_OPTS_BASE: "-vvv --junit-xml=report.xml --timeout=1800 --durations=10"
TEST_LOG_IGNORE_ERRORS: "1"
SCCACHE_GHA_ENABLED: "true"
Expand Down Expand Up @@ -81,6 +82,11 @@ jobs:
- name: Install uv
uses: astral-sh/setup-uv@v5

- uses: actions/cache@v4
with:
path: ~/ci-cache
key: apt-${{ runner.os }}

- name: Install dependencies
env:
TEST_NETWORK: ${{ matrix.TEST_NETWORK }}
Expand All @@ -105,7 +111,7 @@ jobs:
if-no-files-found: ignore

compile:
name: Compile CLN ${{ matrix.cfg }}
name: Build ${{ matrix.cfg }}
runs-on: ubuntu-24.04
timeout-minutes: 30
needs:
Expand All @@ -132,6 +138,7 @@ jobs:
- CFG: compile-clang
VALGRIND: 1
COMPILER: clang
COPTFLAGS_VAR: COPTFLAGS="-O3"
DEBUG_BUILD: --enable-debugbuild
- CFG: compile-clang-sanitizers
COMPILER: clang
Expand All @@ -152,6 +159,11 @@ jobs:
- name: Install uv
uses: astral-sh/setup-uv@v5

- uses: actions/cache@v4
with:
path: ~/ci-cache
key: apt-${{ runner.os }}

- name: Install dependencies
env:
TEST_NETWORK: ${{ matrix.TEST_NETWORK }}
Expand Down Expand Up @@ -202,6 +214,11 @@ jobs:
- name: Install uv
uses: astral-sh/setup-uv@v5

- uses: actions/cache@v4
with:
path: ~/ci-cache
key: apt-${{ runner.os }}

- name: Install dependencies
env:
TEST_NETWORK: ${{ matrix.TEST_NETWORK }}
Expand Down Expand Up @@ -262,6 +279,11 @@ jobs:
- name: Install uv
uses: astral-sh/setup-uv@v5

- uses: actions/cache@v4
with:
path: ~/ci-cache
key: apt-${{ runner.os }}

- name: Install dependencies
env:
TEST_NETWORK: ${{ matrix.TEST_NETWORK }}
Expand Down Expand Up @@ -307,6 +329,11 @@ jobs:
- name: Install uv
uses: astral-sh/setup-uv@v5

- uses: actions/cache@v4
with:
path: ~/ci-cache
key: apt-${{ runner.os }}

- name: Install dependencies
env:
TEST_NETWORK: ${{ matrix.TEST_NETWORK }}
Expand Down Expand Up @@ -355,6 +382,11 @@ jobs:
- name: Install uv
uses: astral-sh/setup-uv@v5

- uses: actions/cache@v4
with:
path: ~/ci-cache
key: apt-${{ runner.os }}

- name: Install dependencies
env:
TEST_NETWORK: ${{ matrix.TEST_NETWORK }}
Expand Down Expand Up @@ -441,6 +473,11 @@ jobs:
- name: Install uv
uses: astral-sh/setup-uv@v5

- uses: actions/cache@v4
with:
path: ~/ci-cache
key: apt-${{ runner.os }}

- name: Install dependencies
env:
TEST_NETWORK: ${{ matrix.TEST_NETWORK }}
Expand Down Expand Up @@ -535,6 +572,11 @@ jobs:
- name: Install uv
uses: astral-sh/setup-uv@v5

- uses: actions/cache@v4
with:
path: ~/ci-cache
key: apt-${{ runner.os }}

- name: Install dependencies
env:
TEST_NETWORK: ${{ matrix.TEST_NETWORK }}
Expand Down Expand Up @@ -610,13 +652,15 @@ jobs:
- name: Install uv
uses: astral-sh/setup-uv@v5

- uses: actions/cache@v4
with:
path: ~/ci-cache
key: apt-${{ runner.os }}

- name: Install dependencies
run: |
bash -x .github/scripts/setup.sh

- name: Install bitcoind
run: .github/scripts/install-bitcoind.sh

- name: Download build
uses: actions/download-artifact@v4
with:
Expand Down Expand Up @@ -672,6 +716,11 @@ jobs:
- name: Install uv
uses: astral-sh/setup-uv@v5

- uses: actions/cache@v4
with:
path: ~/ci-cache
key: apt-${{ runner.os }}

- name: Install dependencies
env:
TEST_NETWORK: ${{ matrix.TEST_NETWORK }}
Expand Down Expand Up @@ -729,13 +778,15 @@ jobs:
- name: Install uv
uses: astral-sh/setup-uv@v5

- uses: actions/cache@v4
with:
path: ~/ci-cache
key: apt-${{ runner.os }}

- name: Install dependencies
run: |
bash -x .github/scripts/setup.sh
- name: Install bitcoind
env:
TEST_NETWORK: regtest
run: .github/scripts/install-bitcoind.sh

- name: Download build
uses: actions/download-artifact@v4
with:
Expand Down Expand Up @@ -790,6 +841,11 @@ jobs:
- name: Install uv
uses: astral-sh/setup-uv@v5

- uses: actions/cache@v4
with:
path: ~/ci-cache
key: apt-${{ runner.os }}

- name: Install dependencies
env:
TEST_NETWORK: ${{ matrix.TEST_NETWORK }}
Expand Down
11 changes: 4 additions & 7 deletions tests/fixtures.py
Original file line number Diff line number Diff line change
Expand Up @@ -119,12 +119,6 @@ def have_binary(name):
return False


@pytest.fixture(scope="session")
def have_pcap_tools():
if not dumpcap_usable():
pytest.skip("dumpcap/tshark not available or insufficient privileges")


class TcpCapture:
def __init__(self, tmpdir):
self.tmpdir = Path(tmpdir)
Expand Down Expand Up @@ -179,14 +173,17 @@ def assert_constant_payload(self):


@pytest.fixture
def tcp_capture(have_pcap_tools, tmp_path):
def tcp_capture(tmp_path):
# You will need permissions. Most distributions have a group which has
# permissions to use dumpcap:
# $ ls -l /usr/bin/dumpcap
# -rwxr-xr-- 1 root wireshark 229112 Apr 16 2024 /usr/bin/dumpcap
# $ getcap /usr/bin/dumpcap
# /usr/bin/dumpcap cap_net_admin,cap_net_raw=eip
# So you just need to be in the wireshark group.
if not dumpcap_usable():
pytest.skip("dumpcap/tshark not available or insufficient privileges")

cap = TcpCapture(tmp_path)
yield cap
cap.stop()
Expand Down
Loading