-
Notifications
You must be signed in to change notification settings - Fork 0
82 lines (72 loc) · 2.56 KB
/
matrix-docker-test.yaml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
name: matrix-docker-test
on:
workflow_dispatch:
inputs:
tag:
description: 'Image tag of hyperledger/besu'
required: true
default: '24.5.4'
jobs:
verify:
strategy:
matrix:
combination:
- tag: ${{ inputs.tag }}
platform: ''
runner: ubuntu-latest
- tag: ${{ inputs.tag }}-amd64
platform: 'linux/amd64'
runner: ubuntu-latest
- tag: latest
platform: ''
runner: ubuntu-latest
- tag: ${{ inputs.tag }}-amd64
platform: ''
runner: ubuntu-latest
runs-on: ${{ matrix.combination.runner }}
env:
CONTAINER_NAME: besu-check
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Start container
run: |
PLATFORM_OPT=""
[[ x${{ matrix.combination.platform }} != 'x' ]] && PLATFORM_OPT="--platform ${{ matrix.combination.platform }}"
docker run -d $PLATFORM_OPT --name ${{ env.CONTAINER_NAME }} hyperledger/besu:${{ matrix.combination.tag }}
- name: Verify besu container
run: |
run_state=$(docker inspect --type=container -f={{.State.Status}} ${{ env.CONTAINER_NAME }})
if [[ "x$run_state" != "xrunning" ]]
then
echo "::error container in not running"
exit 1
fi
success=false
while [[ $success != "true" && $RETRY -gt 0 ]]
do
docker logs ${{ env.CONTAINER_NAME }} | grep -q "Ethereum main loop is up" && success=true
RETRY=$(expr $RETRY - 1)
echo "Waiting for the container to start. Remaining retries $RETRY ..."
sleep $SLEEP
done
if [[ $success != "true" ]]
then
docker ps -a
docker logs ${{ env.CONTAINER_NAME }}
echo "::error Could not find the log message 'Ethereum main loop is up'"
exit 1
fi
if [[ ${{ matrix.combination.tag }} == "latest" ]]
then
version_in_log=$(docker logs ${{ env.CONTAINER_NAME }} | grep "#" | grep "Besu version" | cut -d " " -f 4 | sed 's/\s//g')
echo "Extracted version [$version_in_log]"
if [[ $version_in_log != ${{ inputs.tag }} ]]
echo "::error version [$version_in_log] extracted from container logs does not match the expected version"
fi
fi
docker stop ${{ env.CONTAINER_NAME }} > /dev/null
exit 0
env:
SLEEP: 5
RETRY: 10