| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318 |
- name: Functional Verification Tests
- on:
- push:
- tags:
- - v*
- - e*
- pull_request:
- jobs:
- docker_test:
- runs-on: ubuntu-20.04
- steps:
- - uses: actions/checkout@v1
- - uses: gleam-lang/setup-erlang@v1.1.2
- id: install_erlang
- with:
- otp-version: 23.2
- - name: make docker
- run: |
- 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 "${{ secrets.CI_GIT_TOKEN }}" >> scripts/git-token
- make deps-emqx-ee
- echo "TARGET=emqx/emqx-ee" >> $GITHUB_ENV
- echo "EMQX_TAG=$(./pkg-vsn.sh)" >> $GITHUB_ENV
- make emqx-ee-docker
- else
- echo "TARGET=emqx/emqx" >> $GITHUB_ENV
- echo "EMQX_TAG=$(./pkg-vsn.sh)" >> $GITHUB_ENV
- make emqx-docker
- fi
- - name: run emqx
- timeout-minutes: 5
- run: |
- set -e -u -x
- echo "CUTTLEFISH_ENV_OVERRIDE_PREFIX=EMQX_" >> .ci/docker-compose-file/conf.cluster.env
- echo "EMQX_ZONE__EXTERNAL__RETRY_INTERVAL=2s" >> .ci/docker-compose-file/conf.cluster.env
- echo "EMQX_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: verify EMQX_LOADED_PLUGINS override working
- run: |
- expected="{emqx_sn, true}."
- output=$(docker exec -i node1.emqx.io bash -c "cat data/loaded_plugins" | tail -n1)
- if [ "$expected" != "$output" ]; then
- exit 1
- fi
- - name: make paho tests
- run: |
- if ! docker exec -i python /scripts/pytest.sh; then
- docker logs node1.emqx.io
- docker logs node2.emqx.io
- exit 1
- fi
- helm_test:
- runs-on: ubuntu-20.04
- steps:
- - uses: actions/checkout@v1
- - uses: gleam-lang/setup-erlang@v1.1.2
- id: install_erlang
- with:
- otp-version: 23.2
- - name: prepare
- run: |
- 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 "${{ secrets.CI_GIT_TOKEN }}" >> scripts/git-token
- make deps-emqx-ee
- echo "TARGET=emqx/emqx-ee" >> $GITHUB_ENV
- make emqx-ee-docker
- else
- echo "TARGET=emqx/emqx" >> $GITHUB_ENV
- make emqx-docker
- fi
- - name: install k3s
- env:
- KUBECONFIG: "/etc/rancher/k3s/k3s.yaml"
- run: |
- sudo sh -c "echo \"127.0.0.1 $(hostname)\" >> /etc/hosts"
- curl -sfL https://get.k3s.io | sh -
- sudo chmod 644 /etc/rancher/k3s/k3s.yaml
- kubectl cluster-info
- - name: install helm
- env:
- KUBECONFIG: "/etc/rancher/k3s/k3s.yaml"
- run: |
- curl -fsSL -o get_helm.sh https://raw.githubusercontent.com/helm/helm/master/scripts/get-helm-3
- sudo chmod 700 get_helm.sh
- sudo ./get_helm.sh
- helm version
- - name: run emqx on chart
- env:
- KUBECONFIG: "/etc/rancher/k3s/k3s.yaml"
- timeout-minutes: 5
- run: |
- version=$(./pkg-vsn.sh)
- sudo docker save ${TARGET}:$version -o emqx.tar.gz
- sudo k3s ctr image import emqx.tar.gz
- sed -i -r "s/^appVersion: .*$/appVersion: \"${version}\"/g" deploy/charts/emqx/Chart.yaml
- sed -i '/emqx_telemetry/d' deploy/charts/emqx/values.yaml
- helm install emqx \
- --set image.repository=${TARGET} \
- --set image.pullPolicy=Never \
- --set emqxAclConfig="" \
- --set image.pullPolicy=Never \
- --set emqxConfig.EMQX_ZONE__EXTERNAL__RETRY_INTERVAL=2s \
- --set emqxConfig.EMQX_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()
- env:
- KUBECONFIG: "/etc/rancher/k3s/k3s.yaml"
- run: |
- kubectl describe pods emqx-0
- kubectl logs emqx-0
- - name: get emqx-1 pods log
- if: failure()
- env:
- KUBECONFIG: "/etc/rancher/k3s/k3s.yaml"
- run: |
- kubectl describe pods emqx-1
- kubectl logs emqx-1
- - name: get emqx-2 pods log
- if: failure()
- env:
- KUBECONFIG: "/etc/rancher/k3s/k3s.yaml"
- 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
- env:
- KUBECONFIG: "/etc/rancher/k3s/k3s.yaml"
- run: |
- emqx_svc=$(kubectl get svc --namespace default emqx -o jsonpath="{.spec.clusterIP}")
- emqx1=$(kubectl get pods emqx-1 -o jsonpath='{.status.podIP}')
- emqx2=$(kubectl get pods emqx-2 -o jsonpath='{.status.podIP}')
- pytest -v paho.mqtt.testing/interoperability/test_client/V5/test_connect.py -k test_basic --host $emqx_svc
- RESULT=$?
- pytest -v paho.mqtt.testing/interoperability/test_cluster --host1 $emqx1 --host2 $emqx2
- RESULT=$((RESULT + $?))
- if [ 0 -ne $RESULT ]; then
- kubectl logs emqx-1
- kubectl logs emqx-2
- fi
- exit $RESULT
- relup_test_plan:
- runs-on: ubuntu-20.04
- container: emqx/build-env:erl23.2.7.2-emqx-3-ubuntu20.04
- outputs:
- profile: ${{ steps.profile-and-versions.outputs.profile }}
- vsn: ${{ steps.profile-and-versions.outputs.vsn }}
- old_vsns: ${{ steps.profile-and-versions.outputs.old_vsns }}
- broker: ${{ steps.profile-and-versions.outputs.broker }}
- matrix: ${{ steps.generate-matrix.outputs.matrix }}
- defaults:
- run:
- shell: bash
- steps:
- - uses: actions/checkout@v2
- name: Checkout
- with:
- path: emqx
- fetch-depth: 0
- - name: Get profile and version list
- id: profile-and-versions
- run: |
- cd emqx
- vsn="$(./pkg-vsn.sh)"
- if make emqx-ee --dry-run > /dev/null 2>&1; then
- profile="emqx-ee"
- old_vsns="$(./scripts/relup-base-vsns.sh enterprise | xargs)"
- broker="emqx-ee"
- else
- profile="emqx"
- old_vsns="$(./scripts/relup-base-vsns.sh community | xargs)"
- broker="emqx-ce"
- fi
- echo "OLD_VSNS=$old_vsns" >> $GITHUB_ENV
- echo "::set-output name=vsn::$vsn"
- echo "::set-output name=profile::$profile"
- echo "::set-output name=broker::$broker"
- echo "::set-output name=old_vsns::$old_vsns"
- - name: Generate matrix
- id: generate-matrix
- run: |
- matrix=$(echo -n "$OLD_VSNS" | sed 's/ $//g' | jq -R -s -c 'split(" ")')
- echo "::set-output name=matrix::$matrix"
- relup_test_build:
- needs: relup_test_plan
- runs-on: ubuntu-20.04
- container: emqx/build-env:erl23.2.7.2-emqx-3-ubuntu20.04
- defaults:
- run:
- shell: bash
- env:
- OLD_VSNS: "${{ needs.relup_test_plan.outputs.old_vsns }}"
- PROFILE: "${{ needs.relup_test_plan.outputs.profile }}"
- BROKER: "${{ needs.relup_test_plan.outputs.broker }}"
- steps:
- - uses: actions/checkout@v2
- name: Checkout
- with:
- path: emqx
- fetch-depth: 0
- - name: Prepare credentials
- run: |
- if [ "$PROFILE" = "emqx-ee" ]; then
- echo "https://ci%40emqx.io:${{ secrets.CI_GIT_TOKEN }}@github.com" > $HOME/.git-credentials
- git config --global credential.helper store
- echo "${{ secrets.CI_GIT_TOKEN }}" >> emqx/scripts/git-token
- fi
- - name: Build emqx
- run: make -C emqx ${PROFILE}-zip
- - uses: actions/upload-artifact@v2
- name: Upload built emqx and test scenario
- with:
- name: emqx_built
- path: |
- emqx/_packages/*/*.zip
- emqx/.ci/fvt_tests
- relup_test_run:
- needs:
- - relup_test_plan
- - relup_test_build
- runs-on: ubuntu-20.04
- container: emqx/relup-test-env:erl23.2.7.2-emqx-3-ubuntu20.04
- strategy:
- fail-fast: false
- matrix:
- old_vsn: ${{ fromJson(needs.relup_test_plan.outputs.matrix) }}
- env:
- OLD_VSN: "${{ matrix.old_vsn }}"
- PROFILE: "${{ needs.relup_test_plan.outputs.profile }}"
- VSN: "${{ needs.relup_test_plan.outputs.vsn }}"
- BROKER: "${{ needs.relup_test_plan.outputs.broker }}"
- defaults:
- run:
- shell: bash
- steps:
- - uses: actions/download-artifact@v2
- name: Download built emqx and test scenario
- with:
- name: emqx_built
- path: emqx_built
- - uses: actions/checkout@v2
- name: Checkout one_more_emqx
- with:
- repository: terry-xiaoyu/one_more_emqx
- ref: master
- path: one_more_emqx
- - name: Prepare packages
- run: |
- set -e -x -u
- mkdir -p packages
- cp emqx_built/_packages/*/*.zip packages
- cd packages
- wget --no-verbose https://s3-us-west-2.amazonaws.com/packages.emqx/$BROKER/$OLD_VSN/$PROFILE-ubuntu20.04-${OLD_VSN#[e|v]}-amd64.zip
- - name: Run relup test scenario
- timeout-minutes: 5
- run: |
- lux \
- --progress verbose \
- --case_timeout infinity \
- --var PROFILE=$PROFILE \
- --var PACKAGE_PATH=$(pwd)/packages \
- --var ONE_MORE_EMQX_PATH=$(pwd)/one_more_emqx \
- --var VSN="$VSN" \
- --var OLD_VSN="$OLD_VSN" \
- emqx_built/.ci/fvt_tests/relup.lux
- - uses: actions/upload-artifact@v2
- name: Save debug data
- if: failure()
- with:
- name: debug_data
- path: |
- packages/emqx/log/emqx.log.1
- packages/emqx2/log/emqx.log.1
- packages/*.zip
- lux_logs
|