Skip to content

Commit

Permalink
add l3-node option to nitro node action (#18)
Browse files Browse the repository at this point in the history
* add optional port argument to waitForNitro

* add wait for l3 startup and l3-node input

* explicit port
  • Loading branch information
godzillaba authored Nov 28, 2023
1 parent 4249123 commit e3b7f5b
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 3 deletions.
13 changes: 11 additions & 2 deletions run-nitro-test-node/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,10 @@ inputs:
required: false
default: 'release'
description: 'The nitro-testnode branch to use'
l3-node:
required: false
default: 'false'
description: 'Whether to start an L3 node in addition to the L2 node'
runs:
using: 'composite'
steps:
Expand All @@ -31,11 +35,16 @@ runs:
# See https://stackoverflow.com/a/72203688 for more info
run: |
cd nitro-testnode
./test-node.bash --init ${{ inputs.no-token-bridge == 'true' && '--no-tokenbridge' || '' }} ${{ inputs.args }} &
./test-node.bash --init ${{ inputs.l3-node == 'true' && '--l3node' || '' }} ${{ inputs.no-token-bridge == 'true' && '--no-tokenbridge' || '' }} ${{ inputs.args }} &
- name: Wait for nitro startup
shell: bash
run: ${{ github.action_path }}/waitForNitro.sh
run: ${{ github.action_path }}/waitForNitro.sh 8547

- name: Wait for L3 startup
if: ${{ inputs.l3-node == 'true' }}
shell: bash
run: ${{ github.action_path }}/waitForNitro.sh 3347

- name: Wait for token bridge deployment
if: ${{ inputs.no-token-bridge != 'true' }}
Expand Down
5 changes: 4 additions & 1 deletion run-nitro-test-node/waitForNitro.sh
Original file line number Diff line number Diff line change
@@ -1,7 +1,10 @@
# poll the nitro endpoint until we get a 0 return code

PORT=${1:-8547}

while true
do
curl -X POST -H 'Content-Type: application/json' -d '{"jsonrpc":"2.0","id":45678,"method":"eth_chainId","params":[]}' 'http://localhost:8547'
curl -X POST -H 'Content-Type: application/json' -d '{"jsonrpc":"2.0","id":45678,"method":"eth_chainId","params":[]}' "http://localhost:$PORT"
if [ "$?" -eq "0" ]; then
exit 0
else
Expand Down

0 comments on commit e3b7f5b

Please sign in to comment.