Skip to content

Commit

Permalink
Smoke test for nitro testnode (#44)
Browse files Browse the repository at this point in the history
* Smoke test for nitro testnode
* check latest confirmation

---------

Co-authored-by: sveitser <[email protected]>
  • Loading branch information
Sneh1999 and sveitser authored Aug 16, 2024
1 parent 9ea0c23 commit 792eaed
Show file tree
Hide file tree
Showing 2 changed files with 88 additions and 0 deletions.
67 changes: 67 additions & 0 deletions .github/workflows/smoke-test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
name: Smoke Test CI
run-name: CI triggered from @${{ github.actor }} of ${{ github.head_ref }}

on:
workflow_dispatch:
merge_group:
push:
schedule:
# Run at the end of every day
- cron: "0 0 * * *"

# Cancel in-progress jobs except for integration branch
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: ${{ !contains(github.ref, 'integration/')}}


jobs:
smoke_test:
runs-on: ubuntu-24.04

steps:
- name: Checkout
uses: actions/checkout@v4
with:
submodules: recursive

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

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
with:
driver-opts: network=host

# Explicitly building the docker images because it's not clear how we can
# use the github acion (gha) cache if we let docker compose build the images.
- uses: docker/build-push-action@v5
with:
context: ./rollupcreator
cache-from: type=gha
cache-to: type=gha,mode=max
# Use default branch from test-node.bash
build-args: |
NITRO_CONTRACTS_BRANCH=develop
- uses: docker/build-push-action@v5
with:
context: ./scripts
cache-from: type=gha
cache-to: type=gha,mode=max

- uses: docker/build-push-action@v5
with:
context: ./tokenbridge
cache-from: type=gha
cache-to: type=gha,mode=max
# Use default branch from test-node.bash
build-args: |
TOKEN_BRIDGE_BRANCH=v1.2.2
- name: Start Smoke Test with Latest Espresso Image
run: |
./smoke-test.bash
timeout-minutes: 30
21 changes: 21 additions & 0 deletions smoke-test.bash
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
#!/usr/bin/env bash
set -euo pipefail

./test-node.bash --espresso --latest-espresso-image --validate --tokenbridge --init --detach

# Sending L2 transaction
./test-node.bash script send-l2 --ethamount 100 --to user_l2user --wait

rollupAddress=$(docker compose run --entrypoint sh poster -c "jq -r '.[0].rollup.rollup' /config/deployed_chain_info.json | tail -n 1 | tr -d '\r\n'")
while true; do
confirmed=$(cast call --rpc-url http://localhost:8545 $rollupAddress 'latestConfirmed()(uint256)')
echo "Number of confirmed staking nodes: $confirmed"
if [ "$confirmed" -gt 0 ]; then
break
else
echo "Waiting for more confirmed nodes ..."
fi
sleep 5
done

echo "Smoke test succeeded"

0 comments on commit 792eaed

Please sign in to comment.