e2e-tests.sh 1.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. #!/bin/bash
  2. set -e
  3. if [ -z "$CI" ]; then
  4. MYDIR=$(realpath "$(dirname "$0")")
  5. cd "$MYDIR"
  6. export RPC_URL=http://localhost:8547
  7. export PRIVATE_KEY=0xac0974bec39a17e36ba4a6b4d238ff944bacb478cbed5efcae784d7bf4f2ff80
  8. export WALLET_ADDRESS=0xf39Fd6e51aad88F6F4ce6aB8827279cffFb92266
  9. cd ..
  10. cd "nitro-testnode"
  11. ./test-node.bash script send-l2 --to address_$WALLET_ADDRESS --ethamount 0.1
  12. cd ..
  13. cd "pyth-mock-solidity"
  14. deployed_to=$(
  15. forge script ./script/MockPyth.s.sol:MockPythScript \
  16. --rpc-url "$RPC_URL" \
  17. --private-key "$PRIVATE_KEY" \
  18. --broadcast \
  19. | grep -oP '(?<=Pyth contract address: )0x[a-fA-F0-9]{40}' | tail -n 1
  20. )
  21. export MOCK_PYTH_ADDRESS=$deployed_to
  22. cd ..
  23. else
  24. echo "Skipping MockPyth deployment in CI"
  25. fi
  26. env
  27. # Navigate to project root
  28. cd "$(dirname "$(realpath "$0")")/.."
  29. cargo build --release --target wasm32-unknown-unknown -Z build-std=std,panic_abort -Z build-std-features=panic_immediate_abort
  30. export RPC_URL=http://localhost:8547
  31. # If any arguments are set, just pass them as-is to the cargo test command
  32. if [[ $# -eq 0 ]]; then
  33. cargo test --features e2e --test "*"
  34. else
  35. cargo test --features e2e "$@"
  36. fi