chore: new bash while loop #38
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: portal-loop | |
on: | |
pull_request: {} | |
push: | |
paths: | |
- misc/loop | |
- .github/workflows/portal-loop.yml | |
branches: | |
- "master" | |
- "ci/portal-loop" | |
tags: | |
- "v*" | |
permissions: | |
contents: read | |
packages: write | |
jobs: | |
portal-loop: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Login to GitHub Container Registry | |
uses: docker/login-action@v3 | |
with: | |
registry: ghcr.io | |
username: ${{ github.repository_owner }} | |
password: ${{ secrets.GITHUB_TOKEN }} | |
- name: Docker metadata portalloopd | |
id: meta | |
uses: docker/metadata-action@v5 | |
with: | |
images: ghcr.io/${{ github.repository }}/portalloopd | |
tags: | | |
type=raw,value=latest | |
type=semver,pattern=v{{version}} | |
- name: Build and push | |
uses: docker/build-push-action@v5 | |
with: | |
context: ./misc/loop | |
target: portalloopd | |
push: ${{ github.event_name != 'pull_request' }} | |
tags: ${{ steps.meta.outputs.tags }} | |
labels: ${{ steps.meta.outputs.labels }} | |
test-portal-loop-docker-compose: | |
runs-on: ubuntu-latest | |
timeout-minutes: 5 | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Setup the images | |
run: | | |
cd misc/loop | |
docker compose build | |
docker compose pull | |
docker compose up -d | |
- name: Test1. Portal loop start gnoland | |
run: | | |
docker ps -a | |
while | |
block_height=$(curl -s localhost:26657/status | jq -r '.result.sync_info.latest_block_height') | |
echo "Current block height: $block_height" | |
[[ "$block_height" -lt 10 ]] | |
do | |
sleep 1 | |
done | |
curl -s localhost:26657/status | jq | |
- name: Buid new gnolang/gno image | |
run: | | |
echo "::set-output name=container_id::$(docker ps --filter "name=portal-loop" --format "{{.ID}}")" | |
docker build -t ghcr.io/gnolang/gno . | |
- name: Wait for new docker image | |
run: | | |
first_id=$(docker ps --filter "ancestor=ghcr.io/gnolang/gno" --format "{{.ID}}") | |
while | |
id=$(docker ps --filter "ancestor=ghcr.io/gnolang/gno" --format "{{.ID}}") | |
echo "${first_id} -> ${id}" | |
docker ps -a | |
[[ "$first_id" == ${id} ]] | |
do | |
sleep 5 | |
done | |
- name: Test2. Wait portalloop start new image | |
run: | | |
while | |
block_height=$(curl -s localhost:26657/status | jq -r '.result.sync_info.latest_block_height') | |
echo "Current block height: $block_height" | |
[[ "$block_height" -lt 10 ]] | |
do | |
sleep 5 | |
done | |
docker ps -a | |
curl -s localhost:26657/status | jq |