E2E tests #328
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 | |
- xudt | |
- reestablish | |
release: | |
- "0.116.1" | |
name: e2e test for ${{ matrix.workflow }} | |
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/ | |
- name: Start nodes | |
run: | | |
# Prebuild the program so that we can run the following script faster | |
cargo build | |
cd tests/deploy/udt-init && cargo build && cd - | |
./tests/nodes/start.sh & | |
# Wait for the nodes to start, the initialization takes some time | |
# check port 127.0.0.1:(41714 ~ 41716) are open | |
for i in {1..20}; do | |
all_open=true | |
for port in 41714 41715 41716 8114; do | |
if ! nc -z 127.0.0.1 $port; then | |
all_open=false | |
break | |
fi | |
done | |
if $all_open; then | |
echo "All ports are open" | |
break | |
else | |
echo "Not all ports are open, waiting 3 seconds before retrying" | |
sleep 3 | |
fi | |
done | |
test_dir="${{ matrix.workflow }}" | |
test_env="test" | |
if [[ "${{ matrix.workflow }}" == "xudt" ]]; then | |
test_dir="udt" | |
test_env="xudt-test" | |
fi | |
(cd ./tests/bruno; npm exec -- @usebruno/cli run e2e/${test_dir} -r --env ${test_env} ) & | |
# -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 |