Skip to content

Commit

Permalink
Run some multi-package tests in CI
Browse files Browse the repository at this point in the history
Multi-package tests were missing in the CI and they are important. This
adds them.
  • Loading branch information
Kixunil committed Jul 4, 2024
1 parent 5b7d2a5 commit 11fc3a7
Show file tree
Hide file tree
Showing 4 changed files with 55 additions and 1 deletion.
43 changes: 43 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -171,3 +171,46 @@ jobs:
- name: Fix the Dir Permission for Post checkout
run: |
sudo chown -R $USER $PWD
test-multi-package:
needs: [build, prepare]
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
test: ["btcpayserver-regtest", "electrum"]
steps:
- uses: actions/checkout@v2
- name: Setup Test Prefix
run: |
echo "TEST_PREFIX=sudo chown -R $USER_NAME $BUILD_DIR && cd $BUILD_DIR && make BUILD_DIR=$BUILD_DIR/build" >> $GITHUB_ENV
- name: Prepare Podman Container Running Environment
run: |
sudo apt-get update
sudo apt-get upgrade podman
- name: Fetch CADR image cache
id: cache-cadr-image
uses: actions/cache/restore@v3
env:
cache-name: cache-cadr-image
with:
path: CADR_image.tar
key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('Dockerfile', 'debcrafter-version', 'tests/data/microsoft_apt.list', 'tests/data/microsoft_key.gpg') }}
- name: Load Running Environment Image
run: |
$PODMAN_CMD load < CADR_image.tar
mkdir build
- name: Download Pre-built Debian Packages
uses: thecodenebula/download-artifact@e9e49e9bbce8ff2b901957ee034714cab099644a
with:
#name: ${{ join(fromJson(needs.prepare.outputs.sources), '\n') }}
path: packages
- name: Test multi-package CADR integration
run: |
mkdir -p build
mv packages/*/*.deb build/
eval $SPAWN_CONTAINER
eval $EXECUTE_CMD bash -c "\"$TEST_PREFIX test-here-multi-package-${{ matrix.test }}\""
$PODMAN_CMD rm -f $CONTAINER_NAME
- name: Fix the Dir Permission for Post checkout
run: |
sudo chown -R $USER $PWD
8 changes: 8 additions & 0 deletions tests/multi-package/btcpayserver-regtest.sh
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,14 @@ preload_config

echo '127.0.0.1 example.com' | sudo tee -a /etc/hosts >/dev/null

if [ -z "$DBUS_SESSION_BUS_ADDRESS" ];
then
sudo systemctl start dbus.service
sudo systemctl start user@$UID.service
export DBUS_SESSION_BUS_ADDRESS=unix:path=/run/user/$UID/bus
export XDG_RUNTIME_DIR=/run/user/$UID
fi

sudo apt-get install -y bitcoin-regtest lnd btcpayserver python3-selenium selfhost-clearnet python3-lnpbp-testkit

echo "Starting selenium test" >&2
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
import subprocess
from time import sleep
import sys
import os
from lnpbp_testkit.cadr import network
# This is not public, but we control the API, so let's break privacy for now
from lnpbp_testkit.parsing import parse_simple_config_lines
Expand Down Expand Up @@ -50,6 +51,8 @@ def is_synced(self):

chrome_options = webdriver.ChromeOptions()
chrome_options.add_argument("ignore-certificate-errors")
if "DISPLAY" not in os.environ:
chrome_options.add_argument("headless=new")
driver = webdriver.Chrome(chrome_options=chrome_options)

eprint("Registering an admin account")
Expand Down
2 changes: 1 addition & 1 deletion tests/multi-package/electrum.sh
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ test_dir="$(realpath "$(dirname "$0")/..")"

preload_config

sudo apt-get install -y bitcoin-regtest bitcoin-cli electrs electrum-trustless-regtest jq
sudo apt-get install -y bitcoin-regtest bitcoin-cli electrs electrum-trustless-regtest jq libfuse2 fuse3

# Heavily inspired by the one in electrs itself

Expand Down

0 comments on commit 11fc3a7

Please sign in to comment.