Skip to content

Commit

Permalink
Add MQTT-SN CI tests
Browse files Browse the repository at this point in the history
  • Loading branch information
embhorn committed Nov 28, 2023
1 parent 3b93bdb commit 6f99095
Showing 1 changed file with 97 additions and 0 deletions.
97 changes: 97 additions & 0 deletions .github/workflows/mqtt-sn-check.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,97 @@
name: MQTT-SN Build Test

on:
push:
branches: [ 'master', 'main', 'release/**' ]
pull_request:
branches: [ '*' ]

jobs:
build:

runs-on: ubuntu-latest
timeout-minutes: 5

steps:
- name: Install dependencies
run: |
# Don't prompt for anything
export DEBIAN_FRONTEND=noninteractive
sudo apt-get update
# Install mosquitto
sudo apt-get install -y mosquitto bubblewrap
- name: Setup mosquitto broker
run: |
# Disable default broker daemon
sleep 1
- uses: actions/checkout@master
with:
repository: eclipse/paho.mqtt-sn.embedded-c
path: gateway
- name: Build gateway
working-directory: ./gateway/MQTTSNGateway
run: ./build.sh udp -DDEBUG -DDEBUG_NW
- name: Write config to change broker
working-directory: ./gateway/MQTTSNGateway/bin
run: |
printf "GatewayID=1\nGatewayName=PahoGateway-01\nMaxNumberOfClients=30\nKeepAlive=60\nBrokerName=localhost\nBrokerPortNo=1883\nAggregatingGateway=NO\nQoS-1=NO\nForwarder=NO\nPredefinedTopic=NO\nClientAuthentication=NO\nGatewayPortNo=10000\nMulticastPortNo=1883\nMulticastIP=225.1.1.1\nMulticastTTL=1\n" > gateway.conf
- name: Display gateway config
working-directory: ./gateway/MQTTSNGateway/bin
run: more gateway.conf
- name: Run gateway
working-directory: ./gateway/MQTTSNGateway/bin
run: sudo ./MQTT-SNGateway &> ~/gateway.log &
sleep 1

# This is some debug info useful if something goes wrong
- name: Show network status
run: |
sudo ifconfig
sudo route
sudo netstat -tulpan
- uses: actions/checkout@master
with:
repository: wolfssl/wolfssl
path: wolfssl
- name: wolfssl autogen
working-directory: ./wolfssl
run: ./autogen.sh
- name: wolfssl configure
working-directory: ./wolfssl
run: ./configure --enable-enckeys
- name: wolfssl make
working-directory: ./wolfssl
run: make
- name: wolfssl make install
working-directory: ./wolfssl
run: sudo make install

- uses: actions/checkout@master
- name: wolfmqtt autogen
run: ./autogen.sh

- name: wolfmqtt configure with SN Enabled
run: |
export WOLFMQTT_NO_EXTERNAL_BROKER_TESTS=1
./configure --enable-sn
- name: wolfmqtt make
run: make
- name: test SN Client
run: ./examples/sn-client/sn-client $1
RESULT=$?
[ $RESULT -ne 0 ] && echo -e "\n\nMQTT-SN Client failed!" && exit 1

# Cleanup
# - name: Stop gateway
# run: |
# sudo kill -2 $(pgrep -f "MQTT-SNGateway")

# capture logs on failure
- name: Show logs on failure
if: failure() || cancelled()
run: |
sudo kill -2 $(pgrep -f "MQTT-SNGateway")
sudo cat ~/gateway.log

0 comments on commit 6f99095

Please sign in to comment.