Skip to content

feat: Starknet send relayer branch #180

feat: Starknet send relayer branch

feat: Starknet send relayer branch #180

Workflow file for this run

name: test
on:
# Triggers the workflow on pushes to main branch
push:
branches: [main]
# Triggers on pull requests
pull_request:
branches:
- '*'
merge_group:
workflow_dispatch:
concurrency:
group: e2e-${{ github.ref }}
cancel-in-progress: ${{ github.ref_name != 'main' }}
env:
LOG_LEVEL: DEBUG
LOG_FORMAT: PRETTY
CARGO_TERM_COLOR: always
RUST_BACKTRACE: full
RUSTC_WRAPPER: sccache
jobs:
yarn-install:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
ref: ${{ github.event.pull_request.head.sha || github.sha }}
submodules: recursive
- uses: actions/setup-node@v4
with:
node-version-file: .nvmrc
- name: yarn-cache
uses: buildjet/cache@v4
with:
path: |
**/node_modules
.yarn
key: ${{ runner.os }}-yarn-4.5.1-cache-${{ hashFiles('./yarn.lock') }}
restore-keys: |
${{ runner.os }}-yarn-4.5.1-cache-
- name: yarn-install
run: |
yarn install
CHANGES=$(git status -s --ignore-submodules)
if [[ ! -z $CHANGES ]]; then
echo "Changes found: $CHANGES"
git diff
exit 1
fi
# Check for mismatched dep versions across the monorepo
- name: syncpack
run: yarn syncpack list-mismatches
lint-prettier:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
ref: ${{ github.event.pull_request.head.sha || github.sha }}
- uses: actions/setup-node@v4
with:
node-version-file: .nvmrc
# Build required before linting or the intra-monorepo package cycle checking won't work
- name: yarn-build
uses: ./.github/actions/yarn-build-with-cache
with:
ref: ${{ github.event.pull_request.head.sha || github.sha }}
- name: lint
run: yarn lint
- name: Get changed PR files
if: github.event_name == 'pull_request'
run: |
gh pr view ${{ github.event.pull_request.number }} --json files -q '.files[] | select (.status != "removed") | .path' > changed_files.txt
echo "Changed files: $(cat changed_files.txt)"
env:
GH_TOKEN: ${{ github.token }}
- name: Run prettier (changed files)
if: github.event_name == 'pull_request'
run: >-
cat changed_files.txt |
xargs -r yarn exec prettier --check --ignore-unknown --no-error-on-unmatched-pattern
- name: Run prettier (all files)
if: github.event_name != 'pull_request'
run: >-
yarn exec prettier --check --ignore-unknown --no-error-on-unmatched-pattern .
continue-on-error: true
- name: Clean up
if: always()
run: |
rm -f changed_files.txt
set-base-sha:
runs-on: ubuntu-latest
outputs:
base_sha: ${{ steps.determine-base-sha.outputs.base_sha }}
current_sha: ${{ steps.determine-base-sha.outputs.current_sha }}
steps:
- name: Checkout code
uses: actions/checkout@v4
with:
ref: ${{ github.event.pull_request.head.sha || github.sha }}
- name: Determine BASE_SHA
id: determine-base-sha
run: |
if [ "${{ github.event_name }}" == "pull_request" ]; then
echo "base_sha=${{ github.event.pull_request.base.sha }}" >> $GITHUB_OUTPUT
echo "current_sha=${{ github.event.pull_request.head.sha }}" >> $GITHUB_OUTPUT
elif [ "${{ github.event_name }}" == "merge_group" ]; then
echo "base_sha=${{ github.event.merge_group.base_sha }}" >> $GITHUB_OUTPUT
echo "current_sha=${{ github.event.merge_group.head_sha }}" >> $GITHUB_OUTPUT
elif [ "${{ github.event_name }}" == "push" ]; then
echo "base_sha=$${{ github.event.push.before }}" >> $GITHUB_OUTPUT
echo "current_sha=${{ github.event.push.after }}" >> $GITHUB_OUTPUT
else
echo "base_sha=$(git rev-parse HEAD^)" >> $GITHUB_OUTPUT
echo "current_sha=$(git rev-parse HEAD)" >> $GITHUB_OUTPUT
fi
rust-only:
needs: [set-base-sha]
outputs:
only_rust: ${{ steps.check-rust-only.outputs.only_rust }}
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
ref: ${{ github.event.pull_request.head.sha || github.sha }}
fetch-depth: 0
# Check if changes are ONLY rust
- name: Check if changes are ONLY rust
id: check-rust-only
run: |
# Check for Rust changes
if git diff ${{ needs.set-base-sha.outputs.base_sha }}..${{ needs.set-base-sha.outputs.current_sha }} --name-only | grep -qE '^rust/'; then
# Check if there are only Rust changes
if ! git diff ${{ needs.set-base-sha.outputs.base_sha }}..${{ needs.set-base-sha.outputs.current_sha }} --name-only | grep -qvE '^rust/'; then
echo "only_rust=true" >> $GITHUB_OUTPUT
echo "Only Rust changes detected."
else
echo "only_rust=false" >> $GITHUB_OUTPUT
fi
else
echo "only_rust=false" >> $GITHUB_OUTPUT
fi
# If the push event is to main, fallback to rust_only as false.
- name: Check if push event to main
id: check-push-main
if: github.event_name == 'push' && github.ref == 'refs/heads/main'
run: |
echo "only_rust=false" >> $GITHUB_OUTPUT
echo "Push event to main detected. Setting only_rust to false."
yarn-test-run:
runs-on: ubuntu-latest
needs: [rust-only]
timeout-minutes: 10
if: needs.rust-only.outputs.only_rust == 'false'
steps:
- uses: actions/checkout@v4
with:
ref: ${{ github.event.pull_request.head.sha || github.sha }}
submodules: recursive
fetch-depth: 0
- name: foundry-install
uses: foundry-rs/foundry-toolchain@v1
- name: yarn-build
uses: ./.github/actions/yarn-build-with-cache
with:
ref: ${{ github.event.pull_request.head.sha || github.sha }}
- name: Checkout registry
uses: ./.github/actions/checkout-registry
- name: Unit Tests
run: yarn test:ci
yarn-test:
runs-on: ubuntu-latest
needs: [yarn-test-run]
if: always()
steps:
- uses: actions/checkout@v4
- name: Check yarn-test status
uses: ./.github/actions/check-job-status
with:
job_name: 'Yarn Test'
result: ${{ needs.yarn-test-run.result }}
infra-test:
runs-on: ubuntu-latest
needs: [yarn-install, set-base-sha]
env:
GRAFANA_SERVICE_ACCOUNT_TOKEN: ${{ secrets.GRAFANA_SERVICE_ACCOUNT_TOKEN }}
BALANCE_CHANGES: false
WARP_CONFIG_CHANGES: false
steps:
- uses: actions/checkout@v4
with:
ref: ${{ github.event.pull_request.head.sha || github.sha }}
submodules: recursive
fetch-depth: 0
- name: Check for balance/config changes
run: |
if git diff ${{ needs.set-base-sha.outputs.base_sha }}..${{ needs.set-base-sha.outputs.current_sha }} --name-only | grep -qE '^typescript/infra/config/environments/mainnet3/balances|^.registryrc$'; then
echo "BALANCE_CHANGES=true" >> $GITHUB_ENV
fi
if git diff ${{ needs.set-base-sha.outputs.base_sha }}..${{ needs.set-base-sha.outputs.current_sha }} --name-only | grep -qE '^typescript/infra/|^.registryrc$'; then
echo "WARP_CONFIG_CHANGES=true" >> $GITHUB_ENV
fi
- name: yarn-build
uses: ./.github/actions/yarn-build-with-cache
if: env.BALANCE_CHANGES == 'true' || env.WARP_CONFIG_CHANGES == 'true'
with:
ref: ${{ github.event.pull_request.head.sha || github.sha }}
- name: Checkout registry
if: env.BALANCE_CHANGES == 'true' || env.WARP_CONFIG_CHANGES == 'true'
uses: ./.github/actions/checkout-registry
- name: Balance Tests
if: env.BALANCE_CHANGES == 'true'
run: yarn --cwd typescript/infra test:balance
- name: Warp Config Tests
if: env.WARP_CONFIG_CHANGES == 'true'
run: yarn --cwd typescript/infra test:warp
cli-install-test-run:
runs-on: ubuntu-latest
needs: [rust-only]
if: needs.rust-only.outputs.only_rust == 'false'
steps:
- uses: actions/checkout@v4
with:
ref: ${{ github.event.pull_request.head.sha || github.sha }}
- name: install-hyperlane-cli
id: install-hyperlane-cli
uses: ./.github/actions/install-cli
with:
ref: ${{ github.event.pull_request.head.sha || github.sha }}
- name: Test run the CLI
run: hyperlane --version
cli-install-test:
runs-on: ubuntu-latest
needs: [cli-install-test-run]
if: always()
steps:
- uses: actions/checkout@v4
- name: Check cli-install-test status
uses: ./.github/actions/check-job-status
with:
job_name: 'CLI Install Test'
result: ${{ needs.cli-install-test-run.result }}
cli-e2e-matrix:
runs-on: ubuntu-latest
needs: [rust-only]
if: needs.rust-only.outputs.only_rust == 'false'
strategy:
fail-fast: false
matrix:
test:
# Core Commands
- core-apply
- core-check
- core-deploy
- core-init
- core-read
# Other commands
- relay
# Warp Commands
- warp-apply
- warp-bridge-1
- warp-bridge-2
- warp-check
- warp-extend-basic
- warp-extend-config
- warp-extend-recovery
- warp-init
- warp-read
- warp-send
steps:
- uses: actions/checkout@v4
with:
ref: ${{ github.event.pull_request.head.sha || github.sha }}
submodules: recursive
fetch-depth: 0
- name: foundry-install
uses: foundry-rs/foundry-toolchain@v1
- name: yarn-build
uses: ./.github/actions/yarn-build-with-cache
with:
ref: ${{ github.event.pull_request.head.sha || github.sha }}
- name: install-hyperlane-cli
id: install-hyperlane-cli
uses: ./.github/actions/install-cli
with:
ref: ${{ github.event.pull_request.head.sha || github.sha }}
- name: Checkout registry
uses: ./.github/actions/checkout-registry
- name: CLI e2e tests (${{ matrix.test }})
run: yarn --cwd typescript/cli test:e2e
env:
CLI_E2E_TEST: ${{ matrix.test }}
cli-e2e:
runs-on: ubuntu-latest
needs: [cli-e2e-matrix]
if: always()
steps:
- uses: actions/checkout@v4
- name: Check cli-e2e matrix status
uses: ./.github/actions/check-job-status
with:
job_name: 'CLI E2E'
result: ${{ needs.cli-e2e-matrix.result }}
cosmos-sdk-e2e-run:
runs-on: ubuntu-latest
needs: [rust-only]
if: needs.rust-only.outputs.only_rust == 'false'
steps:
- uses: actions/checkout@v4
with:
ref: ${{ github.event.pull_request.head.sha || github.sha }}
submodules: recursive
fetch-depth: 0
- name: yarn-build
uses: ./.github/actions/yarn-build-with-cache
with:
ref: ${{ github.event.pull_request.head.sha || github.sha }}
- name: Cosmos SDK e2e tests
run: yarn --cwd typescript/cosmos-sdk test:e2e
cosmos-sdk-e2e:
runs-on: ubuntu-latest
needs: [cosmos-sdk-e2e-run]
if: always()
steps:
- uses: actions/checkout@v4
- name: Check cosmos-sdk-e2e status
uses: ./.github/actions/check-job-status
with:
job_name: 'Cosmos SDK E2E'
result: ${{ needs.cosmos-sdk-e2e-run.result }}
agent-configs:
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
environment: [mainnet3, testnet4]
steps:
- uses: actions/checkout@v4
with:
ref: ${{ github.event.pull_request.head.sha || github.sha }}
fetch-depth: 0
- name: yarn-build
uses: ./.github/actions/yarn-build-with-cache
with:
ref: ${{ github.event.pull_request.head.sha || github.sha }}
- name: Checkout registry
uses: ./.github/actions/checkout-registry
- name: Generate ${{ matrix.environment }} agent config
run: |
cd typescript/infra
yarn tsx ./scripts/agents/update-agent-config.ts -e ${{ matrix.environment }}
CHANGES=$(git status -s . :/rust/main/config)
if [[ ! -z $CHANGES ]]; then
echo "Changes found in agent config: $CHANGES"
exit 1
fi
e2e-matrix:
runs-on: depot-ubuntu-24.04-8
if: github.event_name == 'push' || (github.event_name == 'pull_request' && github.base_ref == 'main' || github.base_ref == 'cli-2.0') || github.event_name == 'merge_group'
strategy:
fail-fast: false
matrix:
e2e-type: [cosmwasm, cosmosnative, evm, sealevel]
steps:
- uses: actions/checkout@v4
with:
ref: ${{ github.event.pull_request.head.sha || github.sha }}
submodules: recursive
fetch-depth: 0
- uses: actions/setup-node@v4
with:
node-version-file: .nvmrc
# Set rust_changes to true if:
# - on the main branch
# - PR with changes to ./rust
# - PR with changes to this workflow
- name: Check for Rust file changes
id: check-rust-changes
env:
GH_TOKEN: ${{ github.token }}
run: |
if [[ "${{ github.ref }}" == "refs/heads/main" ]]; then
# For main branch, check changes in the current commit
PARENT_SHA=$(git rev-parse HEAD^)
CHANGES=$(git diff --name-only $PARENT_SHA HEAD -- ./rust ./.github/workflows/test.yml)
if [[ -n "$CHANGES" ]]; then
echo "rust_changes=true" >> $GITHUB_OUTPUT
echo "Changes detected in Rust files or workflow on main branch:"
echo "$CHANGES"
else
echo "rust_changes=false" >> $GITHUB_OUTPUT
fi
elif [[ "${{ github.event_name }}" == "pull_request" ]]; then
# For PRs, use GitHub CLI to check changes
PR_NUMBER=${{ github.event.pull_request.number }}
CHANGES=$(gh pr view $PR_NUMBER --json files -q '.files[].path | select(startswith("rust/") or . == ".github/workflows/test.yml")')
if [[ -n "$CHANGES" ]]; then
echo "rust_changes=true" >> $GITHUB_OUTPUT
echo "Changes detected in Rust files or workflow in PR:"
echo "$CHANGES"
else
echo "rust_changes=false" >> $GITHUB_OUTPUT
fi
else
echo "rust_changes=false" >> $GITHUB_OUTPUT
fi
# If there are no rust changes and the e2e-type is not evm,
# then we want to skip this e2e test to save billing time.
- name: Check rust and e2e conditions
id: check-conditions
run: |
if [[ "${{ steps.check-rust-changes.outputs.rust_changes }}" == "false" && "${{ matrix.e2e-type }}" != "evm" ]]; then
echo "skip-e2e=true" >> $GITHUB_OUTPUT
echo "No rust changes detected and e2e-type is not evm. Will skip remaining steps."
else
echo "skip-e2e=false" >> $GITHUB_OUTPUT
fi
- name: foundry-install
if: steps.check-conditions.outputs.skip-e2e != 'true'
uses: foundry-rs/foundry-toolchain@v1
- name: setup rust
if: steps.check-conditions.outputs.skip-e2e != 'true'
uses: dtolnay/rust-toolchain@stable
- name: rust cache
if: steps.check-conditions.outputs.skip-e2e != 'true'
uses: Swatinem/rust-cache@v2
with:
prefix-key: 'v3-rust-e2e'
shared-key: ${{ matrix.e2e-type }}
cache-provider: 'github'
save-if: ${{ !startsWith(github.ref, 'refs/heads/gh-readonly-queue') }}
workspaces: |
./rust/main
${{ matrix.e2e-type == 'sealevel' && './rust/sealevel' || '' }}
- name: Free disk space
if: steps.check-conditions.outputs.skip-e2e != 'true'
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
if: steps.check-conditions.outputs.skip-e2e != 'true'
uses: rui314/setup-mold@v1
with:
mold-version: 2.0.0
make-default: true
- name: yarn-build
if: steps.check-conditions.outputs.skip-e2e != 'true'
uses: ./.github/actions/yarn-build-with-cache
with:
ref: ${{ github.event.pull_request.head.sha || github.sha }}
cache-provider: github
- name: Install system dependencies
if: steps.check-conditions.outputs.skip-e2e != 'true'
run: |
sudo apt-get update -qq
sudo apt-get install -qq -y libudev-dev pkg-config protobuf-compiler
- name: Install OpenSSL 1.1 for Solana toolchain
if: steps.check-conditions.outputs.skip-e2e != 'true'
run: |
wget -O libssl1.1.deb https://archive.ubuntu.com/ubuntu/pool/main/o/openssl/libssl1.1_1.1.1f-1ubuntu2.24_amd64.deb
sudo dpkg -i libssl1.1.deb
- name: Checkout registry
if: steps.check-conditions.outputs.skip-e2e != 'true'
uses: ./.github/actions/checkout-registry
- name: Run sccache-cache
if: steps.check-conditions.outputs.skip-e2e != 'true'
uses: mozilla-actions/sccache-action@v0.0.8
- name: agent tests (CosmWasm)
if: ${{ matrix.e2e-type == 'cosmwasm' && steps.check-conditions.outputs.skip-e2e != 'true' }}
run: cargo test --release --package run-locally --bin run-locally --features cosmos -- cosmos::test --nocapture
working-directory: ./rust/main
env:
RUST_BACKTRACE: 'full'
- name: agent tests (CosmosNative)
run: cargo test --release --package run-locally --bin run-locally --features cosmosnative -- cosmosnative::test --nocapture
if: ${{ matrix.e2e-type == 'cosmosnative' && steps.check-rust-changes.outputs.rust_changes == 'true' }}
working-directory: ./rust/main
env:
RUST_BACKTRACE: 'full'
- name: agent tests (EVM)
if: ${{ matrix.e2e-type == 'evm' && steps.check-conditions.outputs.skip-e2e != 'true' }}
run: cargo run --release --bin run-locally --features test-utils
working-directory: ./rust/main
env:
E2E_CI_MODE: 'true'
E2E_CI_TIMEOUT_SEC: '600'
E2E_KATHY_MESSAGES: '20'
RUST_BACKTRACE: 'full'
- name: agent tests (Sealevel)
if: ${{ matrix.e2e-type == 'sealevel' && steps.check-conditions.outputs.skip-e2e != 'true' }}
run: cargo test --release --package run-locally --bin run-locally --features sealevel -- sealevel::test --nocapture
working-directory: ./rust/main
env:
E2E_CI_MODE: 'true'
E2E_CI_TIMEOUT_SEC: '600'
RUST_BACKTRACE: 'full'
e2e:
runs-on: ubuntu-latest
needs: e2e-matrix
if: always()
steps:
- name: Check e2e matrix status
if: ${{ needs.e2e-matrix.result != 'success' }}
run: |
echo "E2E tests failed"
exit 1
env-test-matrix:
runs-on: ubuntu-latest
needs: [rust-only]
if: needs.rust-only.outputs.only_rust == 'false'
env:
MAINNET3_ARBITRUM_RPC_URLS: ${{ secrets.MAINNET3_ARBITRUM_RPC_URLS }}
MAINNET3_OPTIMISM_RPC_URLS: ${{ secrets.MAINNET3_OPTIMISM_RPC_URLS }}
MAINNET3_ETHEREUM_RPC_URLS: ${{ secrets.MAINNET3_ETHEREUM_RPC_URLS }}
TESTNET4_SEPOLIA_RPC_URLS: ${{ secrets.TESTNET4_SEPOLIA_RPC_URLS }}
timeout-minutes: 10
strategy:
fail-fast: false
matrix:
environment: [mainnet3]
chain: [ethereum, arbitrum, optimism, inevm]
module: [core, igp]
include:
- environment: testnet4
chain: sepolia
module: core
steps:
- uses: actions/checkout@v4
with:
ref: ${{ github.event.pull_request.head.sha || github.sha }}
- name: foundry-install
uses: foundry-rs/foundry-toolchain@v1
- name: yarn-build
uses: ./.github/actions/yarn-build-with-cache
with:
ref: ${{ github.event.pull_request.head.sha || github.sha }}
- name: Checkout registry
uses: ./.github/actions/checkout-registry
- name: Fork test ${{ matrix.environment }} ${{ matrix.module }} ${{ matrix.chain }} deployment with retries
uses: nick-fields/retry@v3
with:
timeout_minutes: 8
max_attempts: 3
retry_wait_seconds: 30
command: cd typescript/infra && ./fork.sh ${{ matrix.environment }} ${{ matrix.module }} ${{ matrix.chain }}
on_retry_command: |
echo "Test failed, waiting before retry..."
env-test:
runs-on: ubuntu-latest
needs: env-test-matrix
if: always()
steps:
- uses: actions/checkout@v4
- name: Check env-test matrix status
uses: ./.github/actions/check-job-status
with:
job_name: 'Env Test'
result: ${{ needs.env-test-matrix.result }}
coverage-run:
runs-on: ubuntu-latest
needs: [rust-only]
if: needs.rust-only.outputs.only_rust == 'false'
steps:
- uses: actions/checkout@v4
with:
ref: ${{ github.event.pull_request.head.sha || github.sha }}
fetch-depth: 0
- name: yarn-build
uses: ./.github/actions/yarn-build-with-cache
with:
ref: ${{ github.event.pull_request.head.sha || github.sha }}
- name: foundry-install
uses: foundry-rs/foundry-toolchain@v1
- name: Run tests with coverage
run: yarn coverage
env:
NODE_OPTIONS: --max_old_space_size=4096
- name: Upload coverage reports to Codecov with GitHub Action
uses: codecov/codecov-action@v4
with:
token: ${{ secrets.CODECOV_TOKEN }}
coverage:
runs-on: ubuntu-latest
needs: [coverage-run]
if: always()
steps:
- uses: actions/checkout@v4
- name: Check coverage status
uses: ./.github/actions/check-job-status
with:
job_name: 'Coverage'
result: ${{ needs.coverage-run.result }}