-
Notifications
You must be signed in to change notification settings - Fork 13
83 lines (79 loc) · 2.49 KB
/
main.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
82
83
name: GitHub CI
on:
pull_request:
push:
branches:
- 'main'
schedule:
- cron: 0 0 * * 0
defaults:
run:
shell: 'bash -Eeuo pipefail {0}'
jobs:
main:
runs-on: ubuntu-22.04
strategy:
matrix:
version:
- '4.4'
- '5.0'
- '5.1'
steps:
- uses: actions/checkout@v3
- uses: docker/setup-buildx-action@v2
- uses: docker/setup-qemu-action@v2
- name: Docker login
uses: docker/login-action@v2
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ github.token }}
- uses: docker/build-push-action@v3
with:
push: true
pull: true
no-cache: true
platforms: linux/amd64,linux/arm64
tags: ghcr.io/${{ github.repository }}:${{ matrix.version }}
file: ${{ matrix.version }}/Dockerfile
context: ${{ matrix.version }}
- name: Check image
if: matrix.version == '4.4'
timeout-minutes: 1
run: |
docker pull ghcr.io/${{ github.repository }}:${{ matrix.version }}
docker run -d -p 8081:8081 --name emqx ghcr.io/${{ github.repository }}:${{ matrix.version }}
while ! curl -fs 127.0.0.1:8081/status > /dev/null; do
echo "waiting for emqx"
sleep 1
done
if ! docker exec -i emqx emqx ping; then
echo "emqx command not working"
exit 1
fi
if ! docker exec -i emqx emqx_ctl status; then
echo "emqx_ctl command not working"
exit 1
fi
echo "================================================================"
echo "emqx is running"
- name: Check image
if: matrix.version != '4.4'
timeout-minutes: 1
run: |
docker pull ghcr.io/${{ github.repository }}:${{ matrix.version }}
docker run -d -p 18083:18083 --name emqx ghcr.io/${{ github.repository }}:${{ matrix.version }}
while ! curl -fs 127.0.0.1:18083/status > /dev/null; do
echo "waiting for emqx"
sleep 1
done
if ! docker exec -i emqx emqx ping; then
echo "emqx command not working"
exit 1
fi
if ! docker exec -i emqx emqx ctl status; then
echo "emqx ctl command not working"
exit 1
fi
echo "================================================================"
echo "emqx is running"