-
Notifications
You must be signed in to change notification settings - Fork 74
70 lines (58 loc) · 2 KB
/
image-build.yml
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
name: Build Image Test
on:
pull_request:
branches: [main, release/**]
env:
OWNER: hashgraph
permissions:
contents: read
jobs:
build:
runs-on: smart-contracts-linux-medium
steps:
- name: Harden Runner
uses: step-security/harden-runner@63c24ba6bd7ba022e95695ff85de572c04a18142 # v2.7.0
with:
egress-policy: audit
- name: Checkout repository
uses: actions/checkout@a5ac7e51b41094c92402da3b24376905380afc29 # v4.1.6
- name: Set up Docker Qemu
uses: docker/setup-qemu-action@68827325e0b33c7199eb31dd4e31fbe9023e06e3 # v3.0.0
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@d70bba72b1f3fd22344832f00baa16ece964efeb # v3.3.0
with:
driver-opts: network=host
- name: Build image
uses: docker/build-push-action@2cdde995de11925a030ce8070c3d77a52ffcf1c0 # v5.3.0
with:
cache-from: type=gha
cache-to: type=gha,mode=max
platforms: linux/amd64
push: false
load: true
tags: relay:latest
- name: Start server
run: |
docker run \
-e CHAIN_ID='0x12a' \
-e HEDERA_NETWORK='{"127.0.0.1:50211":"0.0.3"}' \
-e MIRROR_NODE_URL='http://127.0.0.1:5551' \
-e OPERATOR_ID_MAIN='0.0.1002' \
-e OPERATOR_KEY_MAIN='302e020100300506032b65700422042077d69b53642d0000000000000000000000000000000000000000000000000000' \
-d -p 7546:7546 --name relay relay:latest
- name: Test server
run: |
sleep 15 # Wait for the server to start
response=$(curl -s http://localhost:7546/health/liveness)
if [ "$response" = "OK" ]; then
echo "Server responded with 'OK'. Test passed!"
exit 0
else
echo "Server responded with '$response'. Test failed!"
exit 1
fi
- name: Stop server
if: always()
run: |
docker stop relay
docker rm relay