Add ckb version 0.118 0.119 to the test list #380
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
on: [push, pull_request] | |
name: E2E tests | |
jobs: | |
e2e-testing: | |
strategy: | |
fail-fast: false | |
matrix: | |
workflow: | |
- 3-nodes-transfer | |
- invoice-ops | |
- open-use-close-a-channel | |
- udt | |
- reestablish | |
- cross-chain-hub | |
- router-pay | |
- udt-router-pay | |
release: | |
- "0.119.0" | |
- "0.118.0" | |
- "0.116.1" | |
test_env: | |
- "test" | |
include: | |
# add an extra workflow to run udt using the env file xudt-test | |
- workflow: "udt" | |
test_env: "xudt-test" | |
# https://docs.github.com/en/actions/writing-workflows/choosing-what-your-workflow-does/running-variations-of-jobs-in-a-workflow | |
# One of github actions include rules to run the job with the matrix is that if | |
# all keys are included in the previous job, then we will create a new job with the matrix. | |
# Otherwise, if some of the keys are not included in the previous job, then we will override value of these keys. | |
# So adding a dummy key will effective override the value of the key test_env (instead of creating a new job | |
# with workflow set to udt and test_env set to xudt-test, and release set to empty). | |
dummy_key: "dummy_value" | |
# add an extra workflow to run 3-nodes-transfer with sha256 hash algorithm | |
- workflow: "3-nodes-transfer" | |
extra_bru_args: "--env-var HASH_ALGORITHM=sha256" | |
name: e2e test for ${{ matrix.workflow }} ${{ matrix.release }} --env ${{ matrix.test_env }} ${{ matrix.extra_bru_args }} | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v2 | |
- uses: Swatinem/rust-cache@v2 | |
- uses: dsherret/rust-toolchain-file@v1 | |
- name: Install dependencies | |
run: | | |
version=${{ matrix.release }} | |
wget "https://github.com/nervosnetwork/ckb/releases/download/v${version}/ckb_v${version}_x86_64-unknown-linux-gnu-portable.tar.gz" | |
tar -xvaf "ckb_v${version}_x86_64-unknown-linux-gnu-portable.tar.gz" | |
sudo mv "ckb_v${version}_x86_64-unknown-linux-gnu-portable"/* /usr/local/bin/ | |
if [ ${{ matrix.workflow }} = "cross-chain-hub" ]; then | |
wget "https://bitcoin.org/bin/bitcoin-core-27.0/bitcoin-27.0-x86_64-linux-gnu.tar.gz" | |
tar -xvaf "bitcoin-27.0-x86_64-linux-gnu.tar.gz" | |
echo "$(pwd)/bitcoin-27.0/bin" >> $GITHUB_PATH | |
wget "https://github.com/lightningnetwork/lnd/releases/download/v0.18.0-beta/lnd-linux-amd64-v0.18.0-beta.tar.gz" | |
tar -xvaf "lnd-linux-amd64-v0.18.0-beta.tar.gz" | |
echo "$(pwd)/lnd-linux-amd64-v0.18.0-beta" >> $GITHUB_PATH | |
fi | |
- name: Run e2e workflow | |
run: | | |
if [ ${{ matrix.workflow }} = "cross-chain-hub" ]; then | |
./tests/deploy/lnd-init/setup-lnd.sh | |
fi | |
# Prebuild the program so that we can run the following script faster | |
cargo build | |
cd tests/deploy/udt-init && cargo build && cd - | |
if [ ${{ matrix.workflow }} = "router-pay" ]; then | |
export START_BOOTNODE=y | |
fi | |
export ON_GITHUB_ACTION=y | |
./tests/nodes/start.sh & | |
# Wait for the nodes to start, the initialization takes some time | |
# check all the ports are open | |
# when .ports file is not generated, we will retry 20 times to check if all ports are open | |
port_file=./tests/nodes/.ports | |
retry_count=0 | |
while [ $retry_count -lt 100 ]; do | |
if [ -f $port_file ]; then | |
break | |
else | |
echo "File $port_file not found. Retrying in 2 seconds..." | |
sleep 2 | |
retry_count=$((retry_count + 1)) | |
fi | |
done | |
ports=() | |
while IFS= read -r line; do | |
ports+=("$line") | |
done < ./tests/nodes/.ports | |
for i in {1..20}; do | |
all_open=true | |
for port in $ports; do | |
echo "Checking port $port" | |
if ! nc -z 127.0.0.1 $port; then | |
all_open=false | |
break | |
fi | |
done | |
if $all_open; then | |
echo "All ports are open now ..." | |
break | |
else | |
echo "Not all ports are open, waiting 3 seconds before retrying" | |
sleep 3 | |
fi | |
done | |
(cd ./tests/bruno; npm exec -- @usebruno/cli@1.20.0 run e2e/${{ matrix.workflow }} -r --env ${{ matrix.test_env }} ${{ matrix.extra_bru_args }} ) & | |
# -n means we will exit when any of the background processes exits. | |
# https://www.gnu.org/software/bash/manual/bash.html#index-wait | |
wait -n |