Skip to content

Commit

Permalink
GHA tests
Browse files Browse the repository at this point in the history
  • Loading branch information
evan-gray committed Jan 29, 2024
1 parent 5ab5a66 commit e8d9ea8
Show file tree
Hide file tree
Showing 2 changed files with 59 additions and 2 deletions.
32 changes: 30 additions & 2 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -1,12 +1,17 @@
name: test

on: workflow_dispatch
on:
workflow_dispatch:
pull_request:
push:
branches:
- main

env:
FOUNDRY_PROFILE: ci

jobs:
check:
unit:
strategy:
fail-fast: true

Expand All @@ -32,3 +37,26 @@ jobs:
run: |
forge test -vvv
id: test
integration:
name: Anvil fork and mock test
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
submodules: recursive

- name: Install Foundry
uses: foundry-rs/foundry-toolchain@v1
with:
version: nightly

- name: Setup Node
uses: actions/setup-node@v4
with:
node-version: "20"

- name: Run Integration Test
run: |
npm ci
./integration-test.sh
id: test
29 changes: 29 additions & 0 deletions integration-test.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
#!/bin/bash

set -euo pipefail

# Generate bindings
forge build
npx [email protected] --target=ethers-v6 ./out/**/*.json

# Fork mainnet
ANVIL_PID=""
function clean_up () {
ARG=$?
[ -n "$ANVIL_PID" ] && kill "$ANVIL_PID"
exit $ARG
}
trap clean_up SIGINT SIGTERM EXIT

echo "🍴 Forking mainnet for Ethereum ..."
anvil --fork-url https://ethereum.publicnode.com > /dev/null &
ANVIL_PID=$!

# Sleep for 10 seconds here to give some time for the fork to complete.
sleep 10

# Override guardian set
npx @wormhole-foundation/[email protected] evm hijack -a 0x98f3c9e6E3fAce36bAAd05FE09d375Ef1464288B -g 0xbeFA429d57cD18b7F8A4d91A2da9AB4AF05d0FBe

# Run integration tests
npx [email protected] ./ts-test/mock.ts

0 comments on commit e8d9ea8

Please sign in to comment.