Merge pull request #5407 from zmstone/build-ci-on-otp-24

Build ci on otp 24
This commit is contained in:
Zaiming (Stone) Shi 2021-08-10 12:20:48 +02:00 committed by GitHub
commit 1239eb23b0
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
11 changed files with 102 additions and 21 deletions

View File

@ -1,11 +1,10 @@
#!/bin/bash #!/bin/bash
set -x -e -u set -x -e -u
export DEBUG=1
export CODE_PATH=${CODE_PATH:-"/emqx"} export CODE_PATH=${CODE_PATH:-"/emqx"}
export EMQX_NAME=${EMQX_NAME:-"emqx"} export EMQX_NAME=${EMQX_NAME:-"emqx"}
export PACKAGE_PATH="${CODE_PATH}/_packages/${EMQX_NAME}" export PACKAGE_PATH="${CODE_PATH}/_packages/${EMQX_NAME}"
export RELUP_PACKAGE_PATH="${CODE_PATH}/_upgrade_base" export RELUP_PACKAGE_PATH="${CODE_PATH}/_upgrade_base"
# export EMQX_NODE_NAME="emqx-on-$(uname -m)@127.0.0.1"
# export EMQX_NODE_COOKIE=$(date +%s%N)
case "$(uname -m)" in case "$(uname -m)" in
x86_64) x86_64)
@ -122,6 +121,9 @@ run_test(){
tee -a "$emqx_env_vars" <<EOF tee -a "$emqx_env_vars" <<EOF
export EMQX_ZONE__EXTERNAL__SERVER_KEEPALIVE=60 export EMQX_ZONE__EXTERNAL__SERVER_KEEPALIVE=60
export EMQX_MQTT__MAX_TOPIC_ALIAS=10 export EMQX_MQTT__MAX_TOPIC_ALIAS=10
export EMQX_LOG__CONSOLE_HANDLER__LEVEL=debug
export EMQX_LOG__FILE_HANDLERS__EMQX_LOG__LEVEL=debug
export EMQX_LOG__PRIMARY_LEVEL=debug
EOF EOF
## for ARM, due to CI env issue, skip start of quic listener for the moment ## for ARM, due to CI env issue, skip start of quic listener for the moment
[[ $(arch) == *arm* || $(arch) == aarch64 ]] && tee -a "$emqx_env_vars" <<EOF [[ $(arch) == *arm* || $(arch) == aarch64 ]] && tee -a "$emqx_env_vars" <<EOF
@ -151,6 +153,8 @@ EOF
# shellcheck disable=SC2009 # pgrep does not support Extended Regular Expressions # shellcheck disable=SC2009 # pgrep does not support Extended Regular Expressions
ps -ef | grep -E '\-progname\s.+emqx\s' ps -ef | grep -E '\-progname\s.+emqx\s'
if ! emqx 'stop'; then if ! emqx 'stop'; then
# shellcheck disable=SC2009 # pgrep does not support Extended Regular Expressions
ps -ef | grep -E '\-progname\s.+emqx\s'
echo "ERROR: failed_to_stop_emqx_with_the_stop_command" echo "ERROR: failed_to_stop_emqx_with_the_stop_command"
cat /var/log/emqx/erlang.log.1 || true cat /var/log/emqx/erlang.log.1 || true
cat /var/log/emqx/emqx.log.1 || true cat /var/log/emqx/emqx.log.1 || true

View File

@ -1,8 +1,8 @@
version: '3.9' version: '3.9'
services: services:
erlang: erlang23:
container_name: erlang container_name: erlang23
image: emqx/build-env:erl23.2.7.2-emqx-2-ubuntu20.04 image: emqx/build-env:erl23.2.7.2-emqx-2-ubuntu20.04
env_file: env_file:
- conf.env - conf.env
@ -21,6 +21,26 @@ services:
working_dir: /emqx working_dir: /emqx
tty: true tty: true
erlang24:
container_name: erlang24
image: emqx/build-env:erl24.0.1-emqx-1-ubuntu20.04
env_file:
- conf.env
environment:
GITHUB_ACTIONS: ${GITHUB_ACTIONS}
GITHUB_TOKEN: ${GITHUB_TOKEN}
GITHUB_RUN_ID: ${GITHUB_RUN_ID}
GITHUB_SHA: ${GITHUB_SHA}
GITHUB_RUN_NUMBER: ${GITHUB_RUN_NUMBER}
GITHUB_EVENT_NAME: ${GITHUB_EVENT_NAME}
GITHUB_REF: ${GITHUB_REF}
networks:
- emqx_bridge
volumes:
- ../..:/emqx
working_dir: /emqx
tty: true
networks: networks:
emqx_bridge: emqx_bridge:
driver: bridge driver: bridge

View File

@ -10,8 +10,14 @@ on:
jobs: jobs:
prepare: prepare:
strategy:
matrix:
container:
- "emqx/build-env:erl23.2.7.2-emqx-2-ubuntu20.04"
- "emqx/build-env:erl24.0.1-emqx-1-ubuntu20.04"
runs-on: ubuntu-20.04 runs-on: ubuntu-20.04
container: emqx/build-env:erl23.2.7.2-emqx-2-ubuntu20.04 container: ${{ matrix.container }}
outputs: outputs:
profiles: ${{ steps.set_profile.outputs.profiles}} profiles: ${{ steps.set_profile.outputs.profiles}}
@ -213,6 +219,9 @@ jobs:
fail-fast: false fail-fast: false
matrix: matrix:
profile: ${{fromJSON(needs.prepare.outputs.profiles)}} profile: ${{fromJSON(needs.prepare.outputs.profiles)}}
erl_otp:
- 23.2.7.2-emqx-2
- 24.0.1-emqx-1
arch: arch:
- amd64 - amd64
- arm64 - arm64

View File

@ -16,6 +16,8 @@ jobs:
matrix: matrix:
erl_otp: erl_otp:
- erl23.2.7.2-emqx-2 - erl23.2.7.2-emqx-2
- erl24.0.1-emqx-1
os: os:
- ubuntu20.04 - ubuntu20.04
- centos7 - centos7
@ -43,7 +45,7 @@ jobs:
with: with:
name: rebar3.crashdump name: rebar3.crashdump
path: ./rebar3.crashdump path: ./rebar3.crashdump
- name: pakcages test - name: packages test
run: | run: |
export CODE_PATH=$GITHUB_WORKSPACE export CODE_PATH=$GITHUB_WORKSPACE
.ci/build_packages/tests.sh .ci/build_packages/tests.sh

View File

@ -4,8 +4,14 @@ on: [pull_request]
jobs: jobs:
check_deps_integrity: check_deps_integrity:
strategy:
matrix:
container:
- "emqx/build-env:erl23.2.7.2-emqx-2-ubuntu20.04"
- "emqx/build-env:erl24.0.1-emqx-1-ubuntu20.04"
runs-on: ubuntu-20.04 runs-on: ubuntu-20.04
container: emqx/build-env:erl23.2.7.2-emqx-2-ubuntu20.04 container: ${{ matrix.container }}
steps: steps:
- uses: actions/checkout@v2 - uses: actions/checkout@v2

View File

@ -9,8 +9,14 @@ on:
jobs: jobs:
check_all: check_all:
strategy:
matrix:
container:
- "emqx/build-env:erl23.2.7.2-emqx-2-ubuntu20.04"
- "emqx/build-env:erl24.0.1-emqx-1-ubuntu20.04"
runs-on: ubuntu-20.04 runs-on: ubuntu-20.04
container: emqx/build-env:erl23.2.7.2-emqx-2-ubuntu20.04 container: ${{ matrix.container }}
steps: steps:
- uses: actions/checkout@v2 - uses: actions/checkout@v2

View File

@ -183,8 +183,15 @@ jobs:
exit $RESULT exit $RESULT
relup_test: relup_test:
strategy:
matrix:
container:
- "emqx/build-env:erl23.2.7.2-emqx-2-ubuntu20.04"
- "emqx/build-env:erl24.0.1-emqx-1-ubuntu20.04"
runs-on: ubuntu-20.04 runs-on: ubuntu-20.04
container: emqx/build-env:erl23.2.7.2-emqx-2-ubuntu20.04 container: ${{ matrix.container }}
defaults: defaults:
run: run:
shell: bash shell: bash
@ -295,4 +302,3 @@ jobs:
with: with:
name: lux_logs name: lux_logs
path: lux_logs path: lux_logs

View File

@ -9,8 +9,14 @@ on:
jobs: jobs:
run_static_analysis: run_static_analysis:
strategy:
matrix:
container:
- "emqx/build-env:erl23.2.7.2-emqx-2-ubuntu20.04"
- "emqx/build-env:erl24.0.1-emqx-1-ubuntu20.04"
runs-on: ubuntu-20.04 runs-on: ubuntu-20.04
container: emqx/build-env:erl23.2.7.2-emqx-2-ubuntu20.04 container: ${{ matrix.container }}
steps: steps:
- uses: actions/checkout@v2 - uses: actions/checkout@v2
@ -26,8 +32,14 @@ jobs:
run: make dialyzer run: make dialyzer
run_proper_test: run_proper_test:
strategy:
matrix:
container:
- "emqx/build-env:erl23.2.7.2-emqx-2-ubuntu20.04"
- "emqx/build-env:erl24.0.1-emqx-1-ubuntu20.04"
runs-on: ubuntu-20.04 runs-on: ubuntu-20.04
container: emqx/build-env:erl23.2.7.2-emqx-2-ubuntu20.04 container: ${{ matrix.container }}
steps: steps:
- uses: actions/checkout@v2 - uses: actions/checkout@v2
@ -41,6 +53,12 @@ jobs:
run: make proper run: make proper
run_common_test: run_common_test:
strategy:
matrix:
otp_release:
- "erlang23"
- "erlang24"
runs-on: ubuntu-20.04 runs-on: ubuntu-20.04
steps: steps:
@ -73,15 +91,15 @@ jobs:
up -d --build up -d --build
- name: run eunit - name: run eunit
run: | run: |
docker exec -i erlang bash -c "make eunit" docker exec -i ${{ matrix.otp_release }} bash -c "make eunit"
- name: run common test - name: run common test
run: | run: |
docker exec -i erlang bash -c "make ct" docker exec -i ${{ matrix.otp_release }} bash -c "make ct"
- name: run cover - name: run cover
run: | run: |
printenv > .env printenv > .env
docker exec -i erlang bash -c "make cover" docker exec -i ${{ matrix.otp_release }} bash -c "make cover"
docker exec --env-file .env -i erlang bash -c "make coveralls" docker exec --env-file .env -i ${{ matrix.otp_release }} bash -c "make coveralls"
- name: cat rebar.crashdump - name: cat rebar.crashdump
if: failure() if: failure()
run: if [ -f 'rebar3.crashdump' ];then cat 'rebar3.crashdump'; fi run: if [ -f 'rebar3.crashdump' ];then cat 'rebar3.crashdump'; fi

View File

@ -1 +1 @@
erlang 24.0.1-emqx-1 erlang 24.0.5-emqx-1

View File

@ -19,6 +19,6 @@
[{test, [{test,
[{deps, [{deps,
[ [
{emqtt, {git, "https://github.com/emqx/emqtt", {tag, "1.2.3"}}}]} {emqtt, {git, "https://github.com/emqx/emqtt", {tag, "1.4.0"}}}]}
]} ]}
]}. ]}.

View File

@ -302,9 +302,19 @@ bootstrapd() {
# check if a PID is down # check if a PID is down
is_down() { is_down() {
PID="$1" PID="$1"
if kill -s 0 "$PID" 2>/dev/null; then if ps -p "$PID" >/dev/null; then
# still around
# shellcheck disable=SC2009 # this grep pattern is not a part of the progra names
if ps -p "$PID" | grep -q 'defunct'; then
# zombie state, print parent pid
parent="$(ps -o ppid= -p "$PID" | tr -d ' ')"
echo "WARN: $PID is marked <defunct>, parent:"
ps -p "$parent"
return 0
fi
return 1 return 1
fi fi
# it's gone
return 0 return 0
} }
@ -484,12 +494,12 @@ case "$1" in
exit 1 exit 1
fi fi
WAIT_TIME="${WAIT_FOR_ERLANG_STOP:-60}" WAIT_TIME="${WAIT_FOR_ERLANG_STOP:-60}"
if ! wait_for "$WAIT_TIME" is_down "$PID"; then if ! wait_for "$WAIT_TIME" 'is_down' "$PID"; then
msg="dangling after ${WAIT_TIME} seconds" msg="dangling after ${WAIT_TIME} seconds"
# also log to syslog # also log to syslog
logger -t "${REL_NAME}[${PID}]" "STOP: $msg" logger -t "${REL_NAME}[${PID}]" "STOP: $msg"
# log to user console # log to user console
echoerr "STOP: $msg" echoerr "stop failed, $msg"
exit 1 exit 1
fi fi
logger -t "${REL_NAME}[${PID}]" "STOP: OK" logger -t "${REL_NAME}[${PID}]" "STOP: OK"