Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: Add docker ready script to makefile #83

Merged
merged 8 commits into from
May 21, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion contract/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,8 @@ build-proposal: bundles/bundle-list
bundles/bundle-list $(SCRIPT) $(PERMIT):
./scripts/build-proposal.sh


clean:
@rm -rf $(SCRIPT) $(PERMIT) bundles/

wait-for-blocks:
TARGET_HEIGHT=1111 ./scripts/wait-for-blocks.sh
3 changes: 2 additions & 1 deletion contract/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,8 @@
"build": "agoric run scripts/build-contract-deployer.js",
"test": "ava --verbose",
"lint": "eslint '**/*.js'",
"lint:fix": "eslint --fix '**/*.js'"
"lint:fix": "eslint --fix '**/*.js'",
"make:waitForBlocks": "make wait-for-blocks"
},
"devDependencies": {
"@agoric/deploy-script-support": "^0.10.4-u12.0",
Expand Down
27 changes: 27 additions & 0 deletions contract/scripts/wait-for-blocks.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
#!/bin/bash

# # Borrowed from https://github.com/DCFoundation/cosmos-proposal-builder/blob/main/.github/workflows/pr.yml#L43-L61
# # This script waits for the Agoric service to be fully ready before running the tests.
# # It does so by polling the `/abci_info` endpoint of the Agoric service until the last block height is greater than or equal to the target height.
# # The target height is set to 1111 by default, but can be overridden by setting the `TARGET_HEIGHT` environment variable.


TARGET_HEIGHT=${TARGET_HEIGHT:1111}

timeout 300 bash -c '
TARGET_HEIGHT='$TARGET_HEIGHT'
SLEEP=10
echo "Waiting for the Agoric service to be fully ready..."
echo "Target block height: $TARGET_HEIGHT"
while true; do
response=$(curl --silent http://localhost:26657/abci_info)
height=$(echo $response | jq -r ".result.response.last_block_height | tonumber")
if [ "$height" -ge $TARGET_HEIGHT ]; then
echo "Service is ready! Last block height: $height"
break
else
echo "Waiting for last block height to reach $TARGET_HEIGHT. Current height: $height"
fi
sleep $SLEEP
done
'
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,8 @@
"lint": "yarn workspaces run lint",
"test": "yarn workspaces run test",
"test:e2e": "yarn workspace offer-up-ui test:e2e",
"build": "yarn workspaces run build"
"build": "yarn workspaces run build",
"runWaitForBlocks": "cd contract && yarn make:waitForBlocks"
},
"devDependencies": {
"@agoric/synpress": "^3.8.1",
Expand Down
Loading