GitHub CI #310
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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-latest | |
strategy: | |
matrix: | |
version: | |
- '5.1' | |
- '5.2' | |
- '5.3' | |
- '5.4' | |
- '5.5' | |
- '5.6' | |
- '5.7' | |
steps: | |
- uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1 | |
- uses: docker/setup-buildx-action@f95db51fddba0c2d1ec667646a06c2ce06100226 # v3.0.0 | |
- uses: docker/setup-qemu-action@68827325e0b33c7199eb31dd4e31fbe9023e06e3 # v3.0.0 | |
- name: Docker login | |
uses: docker/login-action@343f7c4344506bcbf9b4de18042ae17996df046d # v3.0.0 | |
with: | |
registry: ghcr.io | |
username: ${{ github.actor }} | |
password: ${{ github.token }} | |
- uses: docker/build-push-action@4a13e500e55cf31b7a5d59a38ab2040ab0f42f56 # v5.1.0 | |
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 | |
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" |