Skip to content

feat: update Dockerfile and add kurtosis package #119

feat: update Dockerfile and add kurtosis package

feat: update Dockerfile and add kurtosis package #119

Workflow file for this run

name: Test
# trigger on each push against any branch and any PR
on:
push:
branches:
- '*'
pull_request:
branches:
- '*'
jobs:
check_logs_job:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Install yq
run: |
wget https://github.com/mikefarah/yq/releases/latest/download/yq_linux_amd64 -O yq &&\
chmod +x yq
- name: Install bc
run: |
sudo apt-get update
sudo apt-get install bc
- name: Build container
run: |
docker build -t docker-gm:latest .
# change FROM statement in docker/Dockerfile to docker-gm:latest
sed -i 's/FROM ghcr.io\/rollkit\/gm:.*/FROM docker-gm:latest/g' docker/Dockerfile
docker compose -f docker/docker-compose.yaml build
- name: Start compose
run: docker compose -f docker/docker-compose.yaml up -d
- name: Let the chain run for some time
run: sleep 30
- name: Check if rollup can submit blocks via logs
run: |
# Get logs and remove colorization to compare with a string
logs=$(docker logs docker-gm-1 2>&1 | sed -r "s/\x1B\[([0-9]{1,3}(;[0-9]{1,2};?)?)?[mGK]//g")
line='INF commit synced commit='
if [[ "$logs" == *"$line"* ]]; then
echo "'commit synced commit' reached"
else
echo "$logs"
echo "'commit synced commit' NOT reached"
exit 1
fi
- name: Check if rollup works
run: |
docker compose -f docker/docker-compose.yaml exec gm gmd q gm gm
- name: Check balance of accounts
run: |
amount=42069
genesis=$(docker compose -f docker/docker-compose.yaml exec gm cat .gm/config/genesis.json)
addresses=$(echo $genesis | jq -r '.app_state.auth.accounts[].address')
address1=$(echo $addresses | cut -d' ' -f1)
address2=$(echo $addresses | cut -d' ' -f2)
a1balance_old=$(docker compose -f docker/docker-compose.yaml exec gm gmd query bank balances ${address1} | yq '.balances[0].amount' -)
a2balance_old=$(docker compose -f docker/docker-compose.yaml exec gm gmd query bank balances ${address2} | yq '.balances[0].amount' -)
echo "Sending $amount from $address1 to $address2"
docker compose -f docker/docker-compose.yaml exec gm gmd tx bank send ${address1} ${address2} ${amount}stake --keyring-backend test -y > /dev/null
echo "Waiting for block to be committed"
sleep 60 # TODO: Instead of sleeping, wait for a new block to be committed
a1balance_new=$(docker compose -f docker/docker-compose.yaml exec gm gmd query bank balances ${address1} | yq '.balances[0].amount' -)
a2balance_new=$(docker compose -f docker/docker-compose.yaml exec gm gmd query bank balances ${address2} | yq '.balances[0].amount' -)
a1balance_diff=$(echo "$a1balance_new - $a1balance_old" | bc)
a2balance_diff=$(echo "$a2balance_new - $a2balance_old" | bc)
if [ "$a1balance_diff" -eq "-$amount" ] && [ "$a2balance_diff" -eq "$amount" ]; then
echo "Transfer successful"
else
echo "Transfer failed"
exit 1
fi
- name: Cleanup compose
if: always()
run: docker compose -f docker/docker-compose.yaml down --timeout 0