Skip to content

Commit e4aab26

Browse files
committed
Inline script in action + resolve deprecation warnings.
1 parent 3f53827 commit e4aab26

File tree

2 files changed

+31
-81
lines changed

2 files changed

+31
-81
lines changed

action.yml

Lines changed: 31 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -37,19 +37,46 @@ runs:
3737
id: docker-image
3838
shell: bash
3939
run: |
40-
echo "::set-output name=value::${{ inputs.repository }}:${{ inputs.version }}-${{ inputs.network }}"
40+
echo "image=${{ inputs.repository }}:${{ inputs.version }}-${{ inputs.network }}" >> $GITHUB_OUTPUT
4141
4242
- name: 📥 Pull Image
4343
run: |
44-
docker pull ${{ steps.docker-image.outputs.value }}
44+
docker pull ${{ steps.docker-image.outputs.image }}
4545
shell: bash
4646

4747
- name: ⟲ Sync
48+
shell: bash
49+
env:
50+
OGMIOS_PORT: ${{ inputs.ogmios-port }}
51+
THRESHOLD: ${{ inputs.synchronization-level }}
4852
run: |
53+
set -eo pipefail
4954
docker run -d --name ${{ inputs.container-name }} -p ${{ inputs.ogmios-port }}:1337 -v ${{ inputs.db-dir }}:/db ${{ steps.docker-image.outputs.value }}
5055
sleep 3
51-
./scripts/wait-for-sync.sh ${{ inputs.ogmios-port }} ${{ inputs.synchronization-level }}
52-
shell: bash
56+
URL=http://localhost:$OGMIOS_PORT/health
57+
echo "Begin synchronization, target: $THRESHOLD"
58+
echo ""
59+
for (( ;; ))
60+
do
61+
HEALTH=$(curl -sS $URL)
62+
NETWORK_SYNCHRONIZATION=$(sed 's/.*"networkSynchronization":\([0-9]\+\.\?[0-9]*\).*/\1/' <<< $HEALTH)
63+
64+
RE='^[0-9]+\.?[0-9]*$'
65+
if ! [[ $NETWORK_SYNCHRONIZATION =~ $RE ]] ; then
66+
echo "error: unexpected response from /health endpoint: $HEALTH"
67+
exit 1
68+
fi
69+
70+
echo -e "\rnetwork synchronization: $NETWORK_SYNCHRONIZATION"
71+
PREDICATE=$(bc <<< "$NETWORK_SYNCHRONIZATION >= $THRESHOLD")
72+
73+
if [ "$PREDICATE" -eq 1 ]; then
74+
exit 0
75+
else
76+
sleep 5
77+
fi
78+
done
79+
echo -e "\rDone."
5380
5481
- name: 🧹 Cleanup
5582
run: |

scripts/wait-for-sync.sh

Lines changed: 0 additions & 77 deletions
This file was deleted.

0 commit comments

Comments
 (0)