194 lines
6.2 KiB
YAML
194 lines
6.2 KiB
YAML
name: Functional Verification Tests
|
|
|
|
on:
|
|
push:
|
|
tags:
|
|
- v*
|
|
- e*
|
|
pull_request:
|
|
|
|
jobs:
|
|
prepare:
|
|
strategy:
|
|
matrix:
|
|
otp:
|
|
- "23.2.7.2-emqx-2"
|
|
- "24.0.5-emqx-1"
|
|
|
|
runs-on: ubuntu-20.04
|
|
container: "ghcr.io/emqx/emqx-builder-helper/5.0:${{ matrix.otp }}-ubuntu20.04"
|
|
|
|
outputs:
|
|
profile: ${{ steps.profile.outputs.profile }}
|
|
|
|
steps:
|
|
- name: get otp version
|
|
id: get_otp_version
|
|
run: |
|
|
otp="$(erl -eval '{ok, Version} = file:read_file(filename:join([code:root_dir(), "releases", erlang:system_info(otp_release), "OTP_VERSION"])), io:fwrite(Version), halt().' -noshell)"
|
|
echo "::set-output name=otp::$otp"
|
|
- uses: actions/checkout@v2
|
|
with:
|
|
path: source
|
|
fetch-depth: 0
|
|
- name: set profile
|
|
id: profile
|
|
shell: bash
|
|
working-directory: source
|
|
run: |
|
|
vsn="$(./pkg-vsn.sh)"
|
|
if make emqx-ee --dry-run > /dev/null 2>&1; then
|
|
echo "https://ci%40emqx.io:${{ secrets.CI_GIT_TOKEN }}@github.com" > $HOME/.git-credentials
|
|
git config --global credential.helper store
|
|
echo "::set-output name=profile::emqx-ee"
|
|
else
|
|
echo "::set-output name=profile::emqx"
|
|
fi
|
|
- name: get deps
|
|
working-directory: source
|
|
run: |
|
|
make ensure-rebar3
|
|
./rebar3 as default get-deps
|
|
rm -rf rebar.lock
|
|
- name: gen zip file
|
|
run: zip -ryq source-${{ steps.get_otp_version.outputs.otp }}.zip source/* source/.[^.]*
|
|
- uses: actions/upload-artifact@v2
|
|
with:
|
|
name: source-${{ steps.get_otp_version.outputs.otp }}
|
|
path: source-${{ steps.get_otp_version.outputs.otp }}.zip
|
|
|
|
docker_test:
|
|
runs-on: ubuntu-20.04
|
|
needs: prepare
|
|
|
|
strategy:
|
|
fail-fast: false
|
|
matrix:
|
|
otp:
|
|
- 23.2.7.2-emqx-2
|
|
- 24.0.5-emqx-1
|
|
|
|
steps:
|
|
- uses: actions/download-artifact@v2
|
|
with:
|
|
name: source-${{ matrix.otp }}
|
|
path: .
|
|
- name: unzip source code
|
|
run: unzip -q source-${{ matrix.otp }}.zip
|
|
- name: make docker image
|
|
working-directory: source
|
|
env:
|
|
OTP: ${{ matrix.otp }}
|
|
run: |
|
|
make ${{ needs.prepare.outputs.profile }}-docker
|
|
echo "TARGET=emqx/${{ needs.prepare.outputs.profile }}" >> $GITHUB_ENV
|
|
echo "EMQX_TAG=$(./pkg-vsn.sh)" >> $GITHUB_ENV
|
|
- name: run emqx
|
|
timeout-minutes: 5
|
|
working-directory: source
|
|
run: |
|
|
set -e -u -x
|
|
echo "HOCON_ENV_OVERRIDE_PREFIX=EMQX_" >> .ci/docker-compose-file/conf.cluster.env
|
|
echo "EMQX_ZONES__DEFAULT__MQTT__RETRY_INTERVAL=2s" >> .ci/docker-compose-file/conf.cluster.env
|
|
echo "EMQX_ZONES__DEFAULT__MQTT__MAX_TOPIC_ALIAS=10" >> .ci/docker-compose-file/conf.cluster.env
|
|
docker-compose \
|
|
-f .ci/docker-compose-file/docker-compose-emqx-cluster.yaml \
|
|
-f .ci/docker-compose-file/docker-compose-python.yaml \
|
|
up -d
|
|
while ! docker exec -i node1.emqx.io bash -c "emqx eval \"['emqx@node1.emqx.io','emqx@node2.emqx.io'] = maps:get(running_nodes, ekka_cluster:info()).\"" > /dev/null 2>&1; do
|
|
echo "['$(date -u +"%Y-%m-%dT%H:%M:%SZ")']:waiting emqx";
|
|
sleep 5;
|
|
done
|
|
- name: make paho tests
|
|
run: |
|
|
if ! docker exec -i python /scripts/pytest.sh; then
|
|
echo "DUMP_CONTAINER_LOGS_BGN"
|
|
docker logs haproxy
|
|
docker logs node1.emqx.io
|
|
docker logs node2.emqx.io
|
|
echo "DUMP_CONTAINER_LOGS_END"
|
|
exit 1
|
|
fi
|
|
|
|
helm_test:
|
|
runs-on: ubuntu-20.04
|
|
needs: prepare
|
|
|
|
strategy:
|
|
fail-fast: false
|
|
matrix:
|
|
otp:
|
|
- 23.2.7.2-emqx-2
|
|
- 24.0.5-emqx-1
|
|
|
|
steps:
|
|
- uses: actions/download-artifact@v2
|
|
with:
|
|
name: source-${{ matrix.otp }}
|
|
path: .
|
|
- name: unzip source code
|
|
run: unzip -q source-${{ matrix.otp }}.zip
|
|
- name: make docker image
|
|
working-directory: source
|
|
env:
|
|
OTP: ${{ matrix.otp }}
|
|
run: |
|
|
make ${{ needs.prepare.outputs.profile }}-docker
|
|
echo "TARGET=emqx/${{ needs.prepare.outputs.profile }}" >> $GITHUB_ENV
|
|
echo "EMQX_TAG=$(./pkg-vsn.sh)" >> $GITHUB_ENV
|
|
- run: minikube start
|
|
- name: run emqx on chart
|
|
timeout-minutes: 5
|
|
working-directory: source
|
|
run: |
|
|
minikube image load $TARGET:$EMQX_TAG
|
|
|
|
sed -i -r "s/^appVersion: .*$/appVersion: \"$EMQX_TAG\"/g" deploy/charts/emqx/Chart.yaml
|
|
|
|
helm install emqx \
|
|
--set image.repository=$TARGET \
|
|
--set image.pullPolicy=Never \
|
|
--set emqxAclConfig="" \
|
|
--set image.pullPolicy=Never \
|
|
--set emqxConfig.EMQX_ZONES__DEFAULT__MQTT__RETRY_INTERVAL=2s \
|
|
--set emqxConfig.EMQX_ZONES__DEFAULT__MQTT__MAX_TOPIC_ALIAS=10 \
|
|
deploy/charts/emqx \
|
|
--debug
|
|
|
|
while [ "$(kubectl get StatefulSet -l app.kubernetes.io/name=emqx -o jsonpath='{.items[0].status.replicas}')" \
|
|
!= "$(kubectl get StatefulSet -l app.kubernetes.io/name=emqx -o jsonpath='{.items[0].status.readyReplicas}')" ]; do
|
|
echo "==============================";
|
|
kubectl get pods;
|
|
echo "==============================";
|
|
echo "waiting emqx started";
|
|
sleep 10;
|
|
done
|
|
- name: get emqx-0 pods log
|
|
if: failure()
|
|
run: |
|
|
kubectl describe pods emqx-0
|
|
kubectl logs emqx-0
|
|
- name: get emqx-1 pods log
|
|
if: failure()
|
|
run: |
|
|
kubectl describe pods emqx-1
|
|
kubectl logs emqx-1
|
|
- name: get emqx-2 pods log
|
|
if: failure()
|
|
run: |
|
|
kubectl describe pods emqx-2
|
|
kubectl logs emqx-2
|
|
- uses: actions/checkout@v2
|
|
with:
|
|
repository: emqx/paho.mqtt.testing
|
|
ref: develop-4.0
|
|
path: paho.mqtt.testing
|
|
- name: install pytest
|
|
run: |
|
|
pip install pytest
|
|
echo "$HOME/.local/bin" >> $GITHUB_PATH
|
|
- name: run paho test
|
|
run: |
|
|
kubectl port-forward service/emqx 1883:1883 > /dev/null &
|
|
pytest -v paho.mqtt.testing/interoperability/test_client/V5/test_connect.py -k test_basic --host "127.0.0.1"
|