65 lines
2.0 KiB
YAML
65 lines
2.0 KiB
YAML
name: Build docker image for test
|
|
|
|
concurrency:
|
|
group: docker-test-build-${{ github.event_name }}-${{ github.ref }}
|
|
cancel-in-progress: true
|
|
|
|
on:
|
|
workflow_call:
|
|
inputs:
|
|
otp_vsn:
|
|
required: true
|
|
type: string
|
|
elixir_vsn:
|
|
required: true
|
|
type: string
|
|
version-emqx:
|
|
required: true
|
|
type: string
|
|
version-emqx-enterprise:
|
|
required: true
|
|
type: string
|
|
|
|
permissions:
|
|
contents: read
|
|
|
|
jobs:
|
|
docker:
|
|
runs-on: ${{ endsWith(github.repository, '/emqx') && 'ubuntu-22.04' || fromJSON('["self-hosted","ephemeral","linux","x64"]') }}
|
|
env:
|
|
EMQX_NAME: ${{ matrix.profile }}
|
|
PKG_VSN: ${{ matrix.profile == 'emqx-enterprise' && inputs.version-emqx-enterprise || inputs.version-emqx }}
|
|
OTP_VSN: ${{ inputs.otp_vsn }}
|
|
ELIXIR_VSN: ${{ inputs.elixir_vsn }}
|
|
|
|
strategy:
|
|
fail-fast: false
|
|
matrix:
|
|
profile:
|
|
- emqx
|
|
- emqx-enterprise
|
|
- emqx-elixir
|
|
- emqx-enterprise-elixir
|
|
|
|
steps:
|
|
- uses: actions/checkout@a5ac7e51b41094c92402da3b24376905380afc29 # v4.1.6
|
|
- name: build and export to Docker
|
|
id: build
|
|
run: |
|
|
make ${EMQX_NAME}-docker
|
|
echo "_EMQX_DOCKER_IMAGE_TAG=$(head -n 1 .emqx_docker_image_tags)" >> $GITHUB_ENV
|
|
- name: smoke test
|
|
run: |
|
|
CID=$(docker run -d --rm -P $_EMQX_DOCKER_IMAGE_TAG)
|
|
HTTP_PORT=$(docker inspect --format='{{(index (index .NetworkSettings.Ports "18083/tcp") 0).HostPort}}' $CID)
|
|
./scripts/test/emqx-smoke-test.sh localhost $HTTP_PORT
|
|
docker stop $CID
|
|
- name: export docker image
|
|
run: |
|
|
docker save $_EMQX_DOCKER_IMAGE_TAG | gzip > $EMQX_NAME-docker-$PKG_VSN.tar.gz
|
|
- uses: actions/upload-artifact@65462800fd760344b1a7b4382951275a0abb4808 # v4.3.3
|
|
with:
|
|
name: "${{ env.EMQX_NAME }}-docker"
|
|
path: "${{ env.EMQX_NAME }}-docker-${{ env.PKG_VSN }}.tar.gz"
|
|
retention-days: 3
|