Skip to content

Commit

Permalink
Initial Build.yml for actions, fix shellcheck lint
Browse files Browse the repository at this point in the history
Signed-off-by: Will Hoy <[email protected]>
Signed-off-by: Will Hoy <[email protected]>
  • Loading branch information
willhoy committed Oct 19, 2023
1 parent cd117d6 commit 21f346e
Show file tree
Hide file tree
Showing 6 changed files with 86 additions and 32 deletions.
66 changes: 66 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
name: Tests

on:
push:
branches:
- main
pull_request:
branches:
- main

concurrency:
group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }}
cancel-in-progress: true

jobs:
Docker:
name: "Check whether docker setup, build, test work correctly."
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Docker Setup
run: make docker-setup
- name: Docker Tests
run: make docker-test

Documentation:
name: Doxygenize
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Doxygenize
uses: langroodi/[email protected]
with:
# Doxygen configuration file path
doxygenconf: ./docs/Doxyfile
# Generated HTML documents output folder
htmloutput: ./docs
# GitHub Pages branch name
ghpagesbranch: gh-pages
# GitHub Pages directory path
ghpagesdir: ./

Formatting:
name: Clang Format
runs-on: ubuntu-latest
strategy:
matrix:
path:
- 'src'
- 'examples'
steps:
- uses: actions/checkout@v3
- name: Run clang-format style check for C/C++/Protobuf programs.
uses: jidicula/[email protected]
with:
clang-format-version: '14'
check-path: ${{ matrix.path }}

Linting:
name: Shellcheck
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Run ShellCheck
uses: ludeeus/action-shellcheck@master

20 changes: 10 additions & 10 deletions dockerfiles/start_proxy.sh
Original file line number Diff line number Diff line change
Expand Up @@ -11,23 +11,23 @@ if [ -z "${VHOST}" ]; then
exit 1
fi

if [ -S ${AMQPPROX_SOCK} ]; then
if [ -S "${AMQPPROX_SOCK}" ]; then
echo "Cleaning up ${AMQPPROX_SOCK} from previous run"
rm ${AMQPPROX_SOCK} || echo "rm ${AMQPPROX_SOCK} failed"
rm "${AMQPPROX_SOCK}" || echo "rm ${AMQPPROX_SOCK} failed"
fi

echo "Starting proxy"
${AMQPPROX_DIR}/bin/amqpprox &
"${AMQPPROX_DIR}"/bin/amqpprox &

# wait until the control socket file exists before setting config
while ! [ -S ${AMQPPROX_SOCK} ]
while ! [ -S "${AMQPPROX_SOCK}" ]
do
sleep 1
done

${AMQPPROX_DIR}/bin/amqpprox_ctl /tmp/amqpprox log console 3 #info
${AMQPPROX_DIR}/bin/amqpprox_ctl /tmp/amqpprox datacenter set DC_1
${AMQPPROX_DIR}/bin/amqpprox_ctl /tmp/amqpprox backend add rabbit DC_1 rabbit 5672
${AMQPPROX_DIR}/bin/amqpprox_ctl /tmp/amqpprox map backend "${VHOST}" rabbit
${AMQPPROX_DIR}/bin/amqpprox_ctl /tmp/amqpprox listen start 5672
socat TCP-LISTEN:5700,fork UNIX-CONNECT:${AMQPPROX_SOCK}
"${AMQPPROX_DIR}"/bin/amqpprox_ctl /tmp/amqpprox log console 3 #info
"${AMQPPROX_DIR}"/bin/amqpprox_ctl /tmp/amqpprox datacenter set DC_1
"${AMQPPROX_DIR}"/bin/amqpprox_ctl /tmp/amqpprox backend add rabbit DC_1 rabbit 5672
"${AMQPPROX_DIR}"/bin/amqpprox_ctl /tmp/amqpprox map backend "${VHOST}" rabbit
"${AMQPPROX_DIR}"/bin/amqpprox_ctl /tmp/amqpprox listen start 5672
socat TCP-LISTEN:5700,fork UNIX-CONNECT:"${AMQPPROX_SOCK}"
4 changes: 2 additions & 2 deletions src/tests/performance/loop_test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,9 @@ for tracing in with without; do
for ((i=1;i<=3;i+=1))
do
result=""
if [ $1 = "producer" ]; then
if [ "$1" = "producer" ]; then
result=$(RABBITMQ_MESSAGE_SIZE=$msg_size TRACING=$tracing ./tests/performance/test_performance_producer.sh | grep "seconds, message rate" | sed 's/.*\, message rate: \([0-9]*\).*/\1/')
elif [ $1 = "consumer" ]; then
elif [ "$1" = "consumer" ]; then
result=$(RABBITMQ_MESSAGE_SIZE=$msg_size TRACING=$tracing ./tests/performance/test_performance_consumer.sh | grep "seconds, rate" | sed 's/.*\, rate: \([0-9]*\).*/\1/')
fi
echo "Result $i: $result"
Expand Down
10 changes: 5 additions & 5 deletions src/tests/performance/test_performance_consumer.sh
Original file line number Diff line number Diff line change
Expand Up @@ -18,14 +18,14 @@ fi

id=$(openssl rand -base64 6)

uri=amqp://${RMQ_VHOST}:${RMQ_VHOST}@${RMQ_HOSTNAME}:${RMQ_PORT}/${RMQ_VHOST}
uri="amqp://${RMQ_VHOST}:${RMQ_VHOST}@${RMQ_HOSTNAME}:${RMQ_PORT}/${RMQ_VHOST}"

${RMQ_PRODUCER} ${RMQ_TRACING} --uri ${uri} -q ${id} -w 0 -l ${RABBITMQ_QOS} -o ERROR -n ${TEST_N} --messageSize ${RABBITMQ_MESSAGE_SIZE} --expires 60000 > /dev/null
"${RMQ_PRODUCER}" "${RMQ_TRACING}" --uri "${uri}" -q "${id}" -w 0 -l "${RABBITMQ_QOS}" -o ERROR -n "${TEST_N}" --messageSize "${RABBITMQ_MESSAGE_SIZE}" --expires 60000 > /dev/null

echo "Running the consumer"
${RMQ_CONSUMER} ${RMQ_TRACING} --uri ${uri} -q ${id} -l ${RABBITMQ_QOS} -o ERROR -n ${TEST_N} --expires 60000
"${RMQ_CONSUMER}" "${RMQ_TRACING}" --uri "${uri}" -q "${id}" -l "${RABBITMQ_QOS}" -o ERROR -n "${TEST_N}" --expires 60000

curl -su ${RMQ_VHOST}:${RMQ_VHOST} -H "content-type:application/json" \
-XDELETE http://${RMQ_MGMT}/api/queues/${RMQ_VHOST}/${id}
curl -su "${RMQ_VHOST}:${RMQ_VHOST}" -H "content-type:application/json" \
-XDELETE "http://${RMQ_MGMT}/api/queues/${RMQ_VHOST}/${id}"

exit 0
6 changes: 3 additions & 3 deletions src/tests/performance/test_performance_producer.sh
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ uri=amqp://${RMQ_VHOST}:${RMQ_VHOST}@${RMQ_HOSTNAME}:${RMQ_PORT}/${RMQ_VHOST}
if $ENABLE_PERF
then
echo "Running the producer (with perf record)..."
${RMQ_PRODUCER} ${RMQ_TRACING} --uri ${uri} -q "test_producer_performance_${id}" -o ERROR -n ${TEST_N} -w 0 -l ${RABBITMQ_QOS} --messageSize ${RABBITMQ_MESSAGE_SIZE} &
"${RMQ_PRODUCER}" "${RMQ_TRACING}" --uri "${uri}" -q "test_producer_performance_${id}" -o ERROR -n "${TEST_N}" -w 0 -l "${RABBITMQ_QOS}" --messageSize "${RABBITMQ_MESSAGE_SIZE}" &
TASK_PID=$!
echo -e "\nEstablishing connection..."
sleep 3
Expand All @@ -32,8 +32,8 @@ then
echo -e "\nWaiting for the producer to complete..."
wait $TASK_PID
else
echo "Running the producer with args: ${RMQ_PRODUCER} ${RMQ_TRACING} --uri ${uri} -q "test_producer_performance_${id}" -o ERROR -n ${TEST_N} -w 0 -l ${RABBITMQ_QOS} --messageSize ${RABBITMQ_MESSAGE_SIZE} --expires 60000 --messageTTL 5"
${RMQ_PRODUCER} ${RMQ_TRACING} --uri ${uri} -q "test_producer_performance_${id}" -o ERROR -n ${TEST_N} -w 0 -l ${RABBITMQ_QOS} --messageSize ${RABBITMQ_MESSAGE_SIZE} --expires 60000 --messageTTL 5
echo "Running the producer with args: ${RMQ_PRODUCER} ${RMQ_TRACING} --uri ${uri} -q \"test_producer_performance_${id}\" -o ERROR -n ${TEST_N} -w 0 -l ${RABBITMQ_QOS} --messageSize ${RABBITMQ_MESSAGE_SIZE} --expires 60000 --messageTTL 5"
"${RMQ_PRODUCER}" "${RMQ_TRACING}" --uri "${uri}" -q "test_producer_performance_${id}" -o ERROR -n "${TEST_N}" -w 0 -l "${RABBITMQ_QOS}" --messageSize "${RABBITMQ_MESSAGE_SIZE}" --expires 60000 --messageTTL 5
fi

exit 0
12 changes: 0 additions & 12 deletions start_broker.sh

This file was deleted.

0 comments on commit 21f346e

Please sign in to comment.