Skip to content

Commit

Permalink
Restructure CI jobs
Browse files Browse the repository at this point in the history
Re-enable CLI E2E delivery checking
  • Loading branch information
jmrossy committed Nov 23, 2023
1 parent 1cebc39 commit e852bb0
Show file tree
Hide file tree
Showing 2 changed files with 144 additions and 88 deletions.
108 changes: 81 additions & 27 deletions .github/workflows/node.yml → .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: node
name: test

on:
# Triggers the workflow on push or pull request against main
Expand All @@ -9,13 +9,23 @@ on:
# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:

concurrency:
group: e2e-${{ github.ref }}
cancel-in-progress: ${{ github.ref_name != 'main' }}

env:
DEBUG: 'hyperlane:*'
CARGO_TERM_COLOR: always
RUST_BACKTRACE: full

jobs:
yarn-install:
install:
runs-on: larger-runner
steps:
- uses: actions/setup-node@v3
with:
node-version: 18

- uses: actions/checkout@v3
with:
submodules: recursive
Expand All @@ -38,19 +48,18 @@ jobs:
exit 1
fi
yarn-build:
- name: foundry-install
uses: onbjerg/foundry-toolchain@v1

build:
runs-on: larger-runner
needs: [yarn-install]
needs: [install]
steps:
- uses: actions/checkout@v3
with:
submodules: recursive
fetch-depth: 0

- uses: actions/setup-node@v3
with:
node-version: 18

- name: yarn-cache
uses: actions/cache@v3
with:
Expand All @@ -70,7 +79,7 @@ jobs:

lint-prettier:
runs-on: larger-runner
needs: [yarn-install]
needs: [install]
steps:
- uses: actions/checkout@v3
with:
Expand All @@ -96,18 +105,15 @@ jobs:
exit 1
fi
test:
unit-test:
runs-on: larger-runner
needs: [yarn-build]
needs: [build]
steps:
- uses: actions/checkout@v3
with:
submodules: recursive
fetch-depth: 0

- name: Install Foundry
uses: onbjerg/foundry-toolchain@v1

- uses: actions/cache@v3
with:
path: ./*
Expand All @@ -116,16 +122,69 @@ jobs:
- name: Unit Tests
run: yarn test

test-cli:
agent-build:
runs-on: larger-runner
needs: [yarn-build]
needs: [install]
steps:
- uses: actions/checkout@v3
with:
submodules: recursive

- name: Install Foundry
uses: onbjerg/foundry-toolchain@v1
- name: setup rust
uses: actions-rs/toolchain@v1
with:
toolchain: stable
profile: minimal

- name: Free disk space
run: |
# Based on https://github.com/actions/runner-images/issues/2840#issuecomment-790492173
sudo rm -rf /usr/share/dotnet
sudo rm -rf /opt/ghc
sudo rm -rf "/usr/local/share/boost"
sudo rm -rf "$AGENT_TOOLSDIRECTORY"
- name: Install mold linker
uses: rui314/setup-mold@v1
with:
mold-version: 2.0.0
make-default: true

- name: rust cache
uses: Swatinem/rust-cache@v2
with:
prefix-key: 'v2-rust'
shared-key: 'e2e'
workspaces: |
./rust
- name: agent build
run: cargo build --release --bin run-locally
working-directory: ./rust

agent-e2e:
runs-on: larger-runner
needs: [agent-build]
steps:
- name: run CosmWasm test
run: RUST_BACKTRACE=1 cargo test --package run-locally --bin run-locally -- cosmos::test --nocapture
working-directory: ./rust

- name: run test (excluding CosmWasm)
run: ./target/release/run-locally
working-directory: ./rust
env:
E2E_CI_MODE: 'true'
E2E_CI_TIMEOUT_SEC: '600'
E2E_KATHY_MESSAGES: '20'

cli-e2e:
runs-on: larger-runner
needs: [agent-build]
steps:
- uses: actions/checkout@v3
with:
submodules: recursive

- uses: actions/cache@v3
with:
Expand All @@ -134,10 +193,11 @@ jobs:

- name: test
run: ./typescript/cli/ci-test.sh
working-directory: ./typescript/cli

test-env:
env-test:
runs-on: larger-runner
needs: [yarn-build]
needs: [build]
strategy:
matrix:
environment: [testnet4, mainnet3]
Expand All @@ -150,15 +210,12 @@ jobs:
path: ./*
key: ${{ github.sha }}

- name: Install Foundry
uses: onbjerg/foundry-toolchain@v1

- name: Test ${{ matrix.environment }} ${{ matrix.module }} deployment (check, deploy, govern, check again)
run: cd typescript/infra && ./fork.sh ${{ matrix.environment }} ${{ matrix.module }}

coverage:
runs-on: larger-runner
needs: [yarn-build]
needs: [build]

steps:
- uses: actions/checkout@v3
Expand All @@ -178,9 +235,6 @@ jobs:
.yarn/cache
key: ${{ runner.os }}-yarn-cache-${{ hashFiles('./yarn.lock') }}

- name: Install Foundry
uses: onbjerg/foundry-toolchain@v1

- name: Run tests with coverage
run: yarn coverage
env:
Expand Down
124 changes: 63 additions & 61 deletions typescript/cli/ci-test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -103,67 +103,69 @@ yarn workspace @hyperlane-xyz/cli run hyperlane send transfer \
MESSAGE2_ID=`cat /tmp/message2 | grep "Message ID" | grep -E -o '0x[0-9a-f]+'`
echo "Message 2 ID: $MESSAGE2_ID"

# ANVIL_CONNECTION_URL="http://127.0.0.1"
# cd ../../rust
# for i in "anvil1 8545 ANVIL1" "anvil2 8555 ANVIL2"
# do
# set -- $i
# echo "Running validator on $1"
# export CONFIG_FILES=/tmp/${AGENT_CONFIG_FILENAME}
# export HYP_ORIGINCHAINNAME=$1
# export HYP_CHAINS_${3}_BLOCKS_REORGPERIOD=0
# export HYP_VALIDATOR_INTERVAL=1
# export HYP_CHAINS_${3}_CUSTOMRPCURLS=${ANVIL_CONNECTION_URL}:${2}
# export HYP_VALIDATOR_TYPE=hexKey
# export HYP_VALIDATOR_KEY=0x2a871d0798f97d79848a013d4936a73bf4cc922c825d33c1cf7073dff6d409c6
# export HYP_CHECKPOINTSYNCER_TYPE=localStorage
# export HYP_CHECKPOINTSYNCER_PATH=/tmp/${1}/validator
# export HYP_TRACING_LEVEL=debug
# export HYP_TRACING_FMT=compact

# cargo run --bin validator > /tmp/${1}/validator-logs.txt &
# done

# echo "Validator running, sleeping to let it sync"
# sleep 15
# echo "Done sleeping"

# echo "Validator Announcement:"
# cat /tmp/anvil1/validator/announcement.json

# echo "Running relayer"

# export HYP_RELAYCHAINS=anvil1,anvil2
# export HYP_ALLOWLOCALCHECKPOINTSYNCERS=true
# export HYP_DB=/tmp/relayer
# export HYP_GASPAYMENTENFORCEMENT='[{"type":"none"}]'
# export HYP_CHAINS_ANVIL1_SIGNER_TYPE=hexKey
# export HYP_CHAINS_ANVIL1_SIGNER_KEY=0xdbda1821b80551c9d65939329250298aa3472ba22feea921c0cf5d620ea67b97
# export HYP_CHAINS_ANVIL2_SIGNER_TYPE=hexKey
# export HYP_CHAINS_ANVIL2_SIGNER_KEY=0xdbda1821b80551c9d65939329250298aa3472ba22feea921c0cf5d620ea67b97

# cargo run --bin relayer > /tmp/relayer/relayer-logs.txt &

# sleep 10
# echo "Done running relayer, checking message delivery statuses"

# for i in "1 $MESSAGE1_ID" "2 $MESSAGE2_ID"
# do
# set -- $i
# echo "Checking delivery status of $1: $2"
# yarn workspace @hyperlane-xyz/cli run hyperlane status \
# --id $2 \
# --destination anvil2 \
# --chains ./examples/anvil-chains.yaml \
# --core $CORE_ARTIFACTS_PATH \
# | tee /tmp/message-status-$1
# if ! grep -q "$2 was delivered" /tmp/message-status-$1; then
# echo "ERROR: Message $1 was not delivered"
# exit 1
# else
# echo "Message $1 was delivered!"
# fi
# done
ANVIL_CONNECTION_URL="http://127.0.0.1"
cd ../../rust
for i in "anvil1 8545 ANVIL1" "anvil2 8555 ANVIL2"
do
set -- $i
echo "Running validator on $1"
export CONFIG_FILES=/tmp/${AGENT_CONFIG_FILENAME}
export HYP_ORIGINCHAINNAME=$1
export HYP_CHAINS_${3}_BLOCKS_REORGPERIOD=0
export HYP_VALIDATOR_INTERVAL=1
export HYP_CHAINS_${3}_CUSTOMRPCURLS=${ANVIL_CONNECTION_URL}:${2}
export HYP_VALIDATOR_TYPE=hexKey
export HYP_VALIDATOR_KEY=0x2a871d0798f97d79848a013d4936a73bf4cc922c825d33c1cf7073dff6d409c6
export HYP_CHECKPOINTSYNCER_TYPE=localStorage
export HYP_CHECKPOINTSYNCER_PATH=/tmp/${1}/validator
export HYP_TRACING_LEVEL=debug
export HYP_TRACING_FMT=compact

cargo run --bin validator > /tmp/${1}/validator-logs.txt &
done

echo "Validator running, sleeping to let it sync"
# This needs to be long to allow time for the cargo build to finish
sleep 150
echo "Done sleeping"

echo "Validator Announcement:"
cat /tmp/anvil1/validator/announcement.json

echo "Running relayer"

export HYP_RELAYCHAINS=anvil1,anvil2
export HYP_ALLOWLOCALCHECKPOINTSYNCERS=true
export HYP_DB=/tmp/relayer
export HYP_GASPAYMENTENFORCEMENT='[{"type":"none"}]'
export HYP_CHAINS_ANVIL1_SIGNER_TYPE=hexKey
export HYP_CHAINS_ANVIL1_SIGNER_KEY=0xdbda1821b80551c9d65939329250298aa3472ba22feea921c0cf5d620ea67b97
export HYP_CHAINS_ANVIL2_SIGNER_TYPE=hexKey
export HYP_CHAINS_ANVIL2_SIGNER_KEY=0xdbda1821b80551c9d65939329250298aa3472ba22feea921c0cf5d620ea67b97

cargo run --bin relayer > /tmp/relayer/relayer-logs.txt &

# This needs to be long to allow time for the cargo build to finish
sleep 30
echo "Done running relayer, checking message delivery statuses"

for i in "1 $MESSAGE1_ID" "2 $MESSAGE2_ID"
do
set -- $i
echo "Checking delivery status of $1: $2"
yarn workspace @hyperlane-xyz/cli run hyperlane status \
--id $2 \
--destination anvil2 \
--chains ./examples/anvil-chains.yaml \
--core $CORE_ARTIFACTS_PATH \
| tee /tmp/message-status-$1
if ! grep -q "$2 was delivered" /tmp/message-status-$1; then
echo "ERROR: Message $1 was not delivered"
exit 1
else
echo "Message $1 was delivered!"
fi
done

pkill -f anvil
echo "Done"

0 comments on commit e852bb0

Please sign in to comment.