Skip to content

GitHub CI

GitHub CI #238

Workflow file for this run

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"