- Secure tests on master branch after merge. - Improve build cache hit rates Due to security reason, github only allow reuse cache from - same branch - base branch - default branch Branch Feature-A could not reuse the cache from Feature-B - Developers could run the workflow in their own forked repo before make the PR, this could relieve the runners on upstream repo
154 lines
4.7 KiB
YAML
154 lines
4.7 KiB
YAML
name: API Test Suite
|
|
|
|
concurrency:
|
|
group: apt-${{ github.event_name }}-${{ github.ref }}
|
|
cancel-in-progress: true
|
|
|
|
on:
|
|
push:
|
|
branch:
|
|
- *
|
|
tags:
|
|
- e*
|
|
- v*
|
|
pull_request:
|
|
|
|
jobs:
|
|
build:
|
|
strategy:
|
|
matrix:
|
|
otp:
|
|
- 24.1.5-4
|
|
elixir:
|
|
- 1.13.2
|
|
os:
|
|
- ubuntu20.04
|
|
arch:
|
|
- amd64
|
|
runs-on: ubuntu-latest
|
|
container: ghcr.io/emqx/emqx-builder/5.0-5:${{ matrix.elixir }}-${{ matrix.otp }}-${{ matrix.os }}
|
|
|
|
steps:
|
|
- uses: actions/checkout@v2
|
|
|
|
- name: Get deps git refs for cache
|
|
id: deps-refs
|
|
run: |
|
|
scripts/get-dep-refs.sh
|
|
make clean-all
|
|
- name: load rocksdb cache
|
|
uses: actions/cache@v2
|
|
with:
|
|
path: source/_build/default/lib/rocksdb/
|
|
key: ${{ matrix.os }}-${{ matrix.otp }}-${{ matrix.arch }}-${{ steps.deps-refs.outputs.DEP_ROCKSDB_REF }}
|
|
- name: load quicer cache
|
|
uses: actions/cache@v2
|
|
with:
|
|
path: source/_build/default/lib/quicer/
|
|
key: ${{ matrix.os }}-${{ matrix.otp }}-${{ matrix.arch }}-${{ steps.deps-refs.outputs.DEP_QUICER_REF }}
|
|
|
|
- name: build EMQ X CE and EE tgz package
|
|
if: endsWith(github.repository, 'emqx')
|
|
run: |
|
|
make emqx-tgz
|
|
make emqx-enterprise-tgz
|
|
- uses: actions/upload-artifact@v2
|
|
with:
|
|
name: emqx-community
|
|
path: _packages/emqx/*.tar.gz
|
|
- uses: actions/upload-artifact@v2
|
|
with:
|
|
name: emqx-enterprise
|
|
path: _packages/emqx-enterprise/*.tar.gz
|
|
api-test:
|
|
needs: build
|
|
runs-on: ubuntu-latest
|
|
strategy:
|
|
fail-fast: false
|
|
matrix:
|
|
script_name:
|
|
- api_metrics
|
|
- api_subscriptions
|
|
- api_clients
|
|
- api_routes
|
|
- api_publish
|
|
- api_user
|
|
- api_login
|
|
- api_banned
|
|
- api_alarms
|
|
- api_nodes
|
|
- api_topic_metrics
|
|
- api_retainer
|
|
- api_auto_subscribe
|
|
- api_delayed_publish
|
|
- api_topic_rewrite
|
|
- api_event_message
|
|
- api_stats
|
|
edition:
|
|
- emqx-community
|
|
#TODO: add emqx-enterprise
|
|
steps:
|
|
- uses: actions/checkout@v2
|
|
with:
|
|
repository: emqx/emqx-fvt
|
|
ref: 1.0.4-dev2
|
|
path: .
|
|
- uses: actions/setup-java@v1
|
|
with:
|
|
java-version: '8.0.282' # The JDK version to make available on the path.
|
|
java-package: jdk # (jre, jdk, or jdk+fx) - defaults to jdk
|
|
architecture: x64 # (x64 or x86) - defaults to x64
|
|
- uses: actions/download-artifact@v2
|
|
with:
|
|
name: ${{ matrix.edition }}
|
|
path: .
|
|
- name: start EMQ X service
|
|
env:
|
|
EMQX_LISTENERS__WSS__DEFAULT__BIND: "0.0.0.0:8085"
|
|
run: |
|
|
tar -zxf ./*.tar.gz
|
|
./emqx/bin/emqx start
|
|
- name: install jmeter
|
|
timeout-minutes: 10
|
|
env:
|
|
JMETER_VERSION: 5.3
|
|
run: |
|
|
wget --no-verbose --no-check-certificate -O /tmp/apache-jmeter.tgz https://downloads.apache.org/jmeter/binaries/apache-jmeter-$JMETER_VERSION.tgz
|
|
cd /tmp && tar -xvf apache-jmeter.tgz
|
|
echo "jmeter.save.saveservice.output_format=xml" >> /tmp/apache-jmeter-$JMETER_VERSION/user.properties
|
|
echo "jmeter.save.saveservice.response_data.on_error=true" >> /tmp/apache-jmeter-$JMETER_VERSION/user.properties
|
|
wget --no-verbose -O /tmp/apache-jmeter-$JMETER_VERSION/lib/ext/mqtt-xmeter-fuse-2.0.2-jar-with-dependencies.jar https://raw.githubusercontent.com/xmeter-net/mqtt-jmeter/master/Download/v2.0.2/mqtt-xmeter-fuse-2.0.2-jar-with-dependencies.jar
|
|
ln -s /tmp/apache-jmeter-$JMETER_VERSION /opt/jmeter
|
|
- name: run ${{ matrix.script_name }}
|
|
run: |
|
|
/opt/jmeter/bin/jmeter.sh \
|
|
-Jjmeter.save.saveservice.output_format=xml -n \
|
|
-t api-test-suite/${{ matrix.script_name }}.jmx \
|
|
-Demqx_ip="127.0.0.1" \
|
|
-l jmeter_logs/${{ matrix.script_name }}.jtl \
|
|
-j jmeter_logs/logs/${{ matrix.script_name }}.log
|
|
- name: check test logs
|
|
run: |
|
|
if cat jmeter_logs/${{ matrix.script_name }}.jtl | grep -e '<failure>true</failure>' > /dev/null 2>&1; then
|
|
grep -A 5 -B 3 '<failure>true</failure>' jmeter_logs/${{ matrix.script_name }}.jtl > jmeter_logs/${{ matrix.script_name }}_err_api.txt
|
|
echo "check logs failed"
|
|
exit 1
|
|
fi
|
|
- uses: actions/upload-artifact@v1
|
|
if: failure()
|
|
with:
|
|
name: jmeter_logs
|
|
path: ./jmeter_logs
|
|
|
|
delete-package:
|
|
runs-on: ubuntu-20.04
|
|
needs: api-test
|
|
if: always()
|
|
steps:
|
|
- uses: geekyeggo/delete-artifact@v1
|
|
with:
|
|
name: emqx-community
|
|
- uses: geekyeggo/delete-artifact@v1
|
|
with:
|
|
name: emqx-enterprise
|