Skip to content
Draft
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
7 changes: 7 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
.git
.DS_Store
target
web/node_modules
web/dist
deployment/configs/compose.env
web/.env
38 changes: 38 additions & 0 deletions .github/actions/setup-regtest-execs/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
name: Setup regtest executables
description: Download and expose Liquid regtest executables for CI

runs:
using: composite
steps:
- name: Download regtest executables
shell: bash
run: |
set -euo pipefail

BIN_DIR="${RUNNER_TEMP}/regtest-bin"
mkdir -p "${BIN_DIR}"
cd "${BIN_DIR}"

ELECTRS_FILENAME="electrs_linux_esplora_027e38d3ebc2f85b28ae76f8f3448438ee4fc7b1_liquid.zip"
ELECTRS_SHA256="a63a314c16bc6642fc060bbc19bd1d54ebf86b42188ff2a11c705177c1eb22f7"
if [ ! -x "${BIN_DIR}/electrs" ]; then
curl -Ls "https://github.com/RCasatta/electrsd/releases/download/electrs_releases/${ELECTRS_FILENAME}" -o "${ELECTRS_FILENAME}"
echo "${ELECTRS_SHA256} ${ELECTRS_FILENAME}" | sha256sum -c -
unzip -qo "${ELECTRS_FILENAME}"
chmod +x "${BIN_DIR}/electrs"
fi

ELEMENTSD_VERSION="23.3.1"
ELEMENTSD_FILENAME="elements-${ELEMENTSD_VERSION}-x86_64-linux-gnu.tar.gz"
ELEMENTSD_SHA256="864e3a8240137c4e948ecae7c526ccb363771351ea68737a14c682025d5fedaa"
if [ ! -x "${BIN_DIR}/elements-${ELEMENTSD_VERSION}/bin/elementsd" ]; then
curl -Ls "https://github.com/ElementsProject/elements/releases/download/elements-${ELEMENTSD_VERSION}/${ELEMENTSD_FILENAME}" -o "${ELEMENTSD_FILENAME}"
echo "${ELEMENTSD_SHA256} ${ELEMENTSD_FILENAME}" | sha256sum -c -
tar -xzf "${ELEMENTSD_FILENAME}"
chmod +x "${BIN_DIR}/elements-${ELEMENTSD_VERSION}/bin/elementsd"
fi

echo "${BIN_DIR}" >> "${GITHUB_PATH}"
echo "${BIN_DIR}/elements-${ELEMENTSD_VERSION}/bin" >> "${GITHUB_PATH}"
echo "ELECTRS_LIQUID_EXEC=${BIN_DIR}/electrs" >> "${GITHUB_ENV}"
echo "ELEMENTSD_EXEC=${BIN_DIR}/elements-${ELEMENTSD_VERSION}/bin/elementsd" >> "${GITHUB_ENV}"
44 changes: 41 additions & 3 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ permissions:

jobs:
test:
name: Build and test (matrix)
name: Build and test (matrix, non-regtest)
runs-on: ubuntu-latest
services:
postgres:
Expand Down Expand Up @@ -88,8 +88,46 @@ jobs:
cd crates/indexer
SKIP_DOCKER=true ./scripts/init_db.sh

- name: Run tests
run: cargo test --workspace --all-features --no-fail-fast --verbose
- name: Run non-regtest workspace tests
run: cargo test --workspace --all-features --exclude lending-contracts --no-fail-fast --verbose

- name: Run lending-contracts library tests
run: cargo test -p lending-contracts --lib --all-features --verbose

- name: Check that queries are fresh
run: cargo sqlx prepare --workspace --check -- --all-targets

contracts-regtest:
name: Contracts regtest tests
runs-on: ubuntu-latest

steps:
- name: Checkout
uses: actions/checkout@v4

- name: Setup Rust (stable)
uses: actions-rust-lang/setup-rust-toolchain@v1
with:
toolchain: stable

- name: Cache cargo
uses: Swatinem/rust-cache@v2
with:
cache-on-failure: true

- name: Setup regtest executables
uses: ./.github/actions/setup-regtest-execs

- name: Test lending-contracts regtest integration tests
run: cargo test -p lending-contracts --tests --all-features --no-fail-fast --verbose -- --test-threads=1

- name: Assert no leaked regtest nodes after contracts tests
if: always()
run: |
set -euo pipefail
leaks="$(ps -eo pid=,comm=,args= | awk '$2=="elementsd" || $2=="electrs" {print}')"
if [ -n "$leaks" ]; then
echo "Leaked regtest node processes after contracts regtest tests:"
echo "$leaks"
exit 1
fi
Loading
Loading