|
| 1 | +name: MQTT-SN Build Test |
| 2 | + |
| 3 | +on: |
| 4 | + push: |
| 5 | + branches: [ 'master', 'main', 'release/**' ] |
| 6 | + pull_request: |
| 7 | + branches: [ '*' ] |
| 8 | + |
| 9 | +jobs: |
| 10 | + build: |
| 11 | + |
| 12 | + runs-on: ubuntu-latest |
| 13 | + timeout-minutes: 5 |
| 14 | + |
| 15 | + steps: |
| 16 | + - name: Install dependencies |
| 17 | + run: | |
| 18 | + # Don't prompt for anything |
| 19 | + export DEBIAN_FRONTEND=noninteractive |
| 20 | + sudo apt-get update |
| 21 | + # Install mosquitto |
| 22 | + sudo apt-get install -y mosquitto bubblewrap |
| 23 | +
|
| 24 | + - name: Setup mosquitto broker |
| 25 | + run: | |
| 26 | + # Disable default broker daemon |
| 27 | + sudo service mosquitto stop |
| 28 | + sleep 1 |
| 29 | + mosquitto -v &> ~/broker.log & |
| 30 | + sleep 1 |
| 31 | +
|
| 32 | + - uses: actions/checkout@master |
| 33 | + with: |
| 34 | + repository: eclipse/paho.mqtt-sn.embedded-c |
| 35 | + path: gateway |
| 36 | + - name: Build gateway |
| 37 | + working-directory: ./gateway/MQTTSNGateway |
| 38 | + run: ./build.sh udp -DDEBUG -DDEBUG_NW |
| 39 | + - name: Write config to change broker |
| 40 | + working-directory: ./gateway/MQTTSNGateway/bin |
| 41 | + run: | |
| 42 | + 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 |
| 43 | + - name: Display gateway config |
| 44 | + working-directory: ./gateway/MQTTSNGateway/bin |
| 45 | + run: more gateway.conf |
| 46 | + - name: Run gateway |
| 47 | + working-directory: ./gateway/MQTTSNGateway/bin |
| 48 | + run: sudo ./MQTT-SNGateway &> ~/gateway.log & |
| 49 | + sleep 1 |
| 50 | + |
| 51 | + # This is some debug info useful if something goes wrong |
| 52 | + - name: Show network status |
| 53 | + run: | |
| 54 | + sudo ifconfig |
| 55 | + sudo route |
| 56 | + sudo netstat -tulpan |
| 57 | +
|
| 58 | + - uses: actions/checkout@master |
| 59 | + with: |
| 60 | + repository: wolfssl/wolfssl |
| 61 | + path: wolfssl |
| 62 | + - name: wolfssl autogen |
| 63 | + working-directory: ./wolfssl |
| 64 | + run: ./autogen.sh |
| 65 | + - name: wolfssl configure |
| 66 | + working-directory: ./wolfssl |
| 67 | + run: ./configure --enable-enckeys |
| 68 | + - name: wolfssl make |
| 69 | + working-directory: ./wolfssl |
| 70 | + run: make |
| 71 | + - name: wolfssl make install |
| 72 | + working-directory: ./wolfssl |
| 73 | + run: sudo make install |
| 74 | + |
| 75 | + - uses: actions/checkout@master |
| 76 | + - name: wolfmqtt autogen |
| 77 | + run: ./autogen.sh |
| 78 | + |
| 79 | + - name: wolfmqtt configure with SN Enabled |
| 80 | + run: | |
| 81 | + export WOLFMQTT_NO_EXTERNAL_BROKER_TESTS=1 |
| 82 | + ./configure --enable-sn |
| 83 | + - name: wolfmqtt make |
| 84 | + run: make |
| 85 | + |
| 86 | + - name: test SN Client |
| 87 | + run: ./examples/sn-client/sn-client -T |
| 88 | + |
| 89 | + # Cleanup |
| 90 | + - name: Stop gateway |
| 91 | + if: failure() || cancelled() |
| 92 | + run: | |
| 93 | + sudo kill -2 $(pgrep -f "MQTT-SNGateway") |
| 94 | + sleep 3 |
| 95 | + sudo kill -2 $(pgrep -f "mosquitto") |
| 96 | + sleep 1 |
| 97 | +
|
| 98 | + # capture logs on failure |
| 99 | + - name: Show logs on failure |
| 100 | + if: failure() || cancelled() |
| 101 | + run: | |
| 102 | + sudo cat ~/gateway.log |
| 103 | + sudo cat ~/broker.log |
0 commit comments