1010 target : esp32
1111 idf_version : latest
1212 app_name : publish_connect_test
13- app_path : $IDF_PATH/tools/test_apps/protocols/mqtt /publish_connect_test
13+ app_path : test /publish_connect_test
1414
1515jobs :
1616 build :
17+ if : false
1718 name : Build Test App
1819 runs-on : ubuntu-22.04
1920 env :
20- EXAMPLE_MQTT_BROKER_SSL : " mqtt.eclipseprojects.io:1883"
21- EXAMPLE_MQTT_BROKER_TCP : " mqtt.eclipseprojects.io:8883"
22- EXAMPLE_MQTT_BROKER_WS : " mqtt.eclipseprojects.io"
23- EXAMPLE_MQTT_BROKER_WSS : " mqtt.eclipseprojects.io"
21+ EXAMPLE_MQTT_BROKER_TCP : " mqtt.eclipseprojects.io:1883"
22+ EXAMPLE_MQTT_BROKER_SSL : " mqtt.eclipseprojects.io:8883"
23+ EXAMPLE_MQTT_BROKER_WS : " mqtt.eclipseprojects.io:80 "
24+ EXAMPLE_MQTT_BROKER_WSS : " mqtt.eclipseprojects.io:443 "
2425 outputs :
2526 build_path : ${{steps.build.outputs.artifacts_path}}
2627 container : espressif/idf:latest
@@ -52,10 +53,39 @@ jobs:
5253 ${{steps.build.outputs.artifacts_path}}/build_*/*.bin
5354 ${{steps.build.outputs.artifacts_path}}/build_*/flasher_args.json
5455 ${{steps.build.outputs.artifacts_path}}/build_*/config/sdkconfig.json
55- ${{steps.build.outputs.artifacts_path}}/*.py
5656 if-no-files-found : error
57+ - name : Output env
58+ shell : bash
59+ run : |
60+ echo ${EXAMPLE_MQTT_BROKER_TCP}
61+ echo ${EXAMPLE_MQTT_BROKER_SSL}
62+ echo ${EXAMPLE_MQTT_BROKER_WS}
63+ echo ${EXAMPLE_MQTT_BROKER_WSS}
64+
65+ get_ip :
66+ # if: github.repository == 'espressif/esp-mqtt'
67+ name : Get Ip
68+ runs-on : [self-hosted, linux, docker, ESP32-ETHERNET-KIT]
69+ steps :
70+ # - name: Add node for local tests
71+ # if: ${{ env.ACT }}
72+ # shell: bash
73+ # run: |
74+ # curl -fsSL https://deb.nodesource.com/setup_18.x | bash -
75+ # apt-get install -y nodejs
76+ - name : Install iproute2
77+ shell : bash
78+ run : apt-get update && apt-get install -y iproute2
79+ - name : Get runner IP
80+ id : get_ip
81+ shell : bash
82+ run : |
83+ IP=$(ip route get 1| awk '{print $7; exit}')
84+ echo $IP
85+ echo "RUNNER_IP=$IP" >> $GITHUB_ENV
5786
5887 run-on-target :
88+ if : false
5989 # if: github.repository == 'espressif/esp-mqtt'
6090 name : Publish and Connect target test
6191 needs : build
@@ -84,10 +114,23 @@ jobs:
84114 # TEST_RESULT_NAME: test_results_${{ matrix.runner.target }}_${{ matrix.runner.marker }}_${{ matrix.idf_ver }}
85115 # TEST_RESULT_FILE: test_results_${{ matrix.runner.target }}_${{ matrix.runner.marker }}_${{ matrix.idf_ver }}.xml
86116 # runs-on: [self-hosted, linux, docker, "${{ matrix.runner.runs-on }}"]
87- container :
88- image : python:3.11-bookworm
89- options : --privileged # Privileged mode has access to serial ports
90- runs-on : [self-hosted, linux, docker, ESP32-ETHERNET-KIT]
117+ # container:
118+ # image: python:3.11-bookworm
119+ # options: --privileged # Privileged mode has access to serial ports
120+ # runs-on: [self-hosted, linux, docker, ESP32-ETHERNET-KIT]
121+ runs-on : ubuntu-22.04
122+ services :
123+ mqtt-test-broker :
124+ image : eclipse-mosquitto:latest
125+ ports :
126+ - 42351:42351
127+ - 42352:42352
128+ - 42353:42353
129+ - 42354:42354
130+ volumes :
131+ - ${{ github.workspace }}/ci/broker/config:/mosquitto/config
132+ - ${{ github.workspace }}/ci/broker/certs:/mosquitto/certfiles
133+ - ${{ github.workspace }}/ci/broker/.mosquitto.log:/var/log/mosquitto.log
91134
92135 strategy :
93136 matrix :
@@ -107,22 +150,76 @@ jobs:
107150 run : |
108151 curl -fsSL https://deb.nodesource.com/setup_18.x | bash -
109152 apt-get install -y nodejs
153+ - name : Install Python packages
154+ shell : bash
155+ env :
156+ PIP_EXTRA_INDEX_URL : " https://dl.espressif.com/pypi/"
157+ run : pip install --prefer-binary paho-mqtt
158+ - name : Install dependencies
159+ shell : bash
160+ run : apt-get update && apt-get install -y iproute2
110161 - uses : actions/checkout@v4
111162 - name : Download artifacts
112163 uses : actions/download-artifact@v4
113164 id : artifacts
114165 with :
115166 name : mqtt_bin_${{env.target}}_${{ env.idf_version }}_${{ env.app_name }}
116- path : test
117- - name : Check artifacts
167+ path : test/publish_connect_test
168+ - name : Get runner IP
169+ id : get_ip
118170 shell : bash
119- run : ls test/
120- # - name: Checkout IDF ${{inputs.idf_version}}
121- # uses: actions/checkout@v4
122- # with:
123- # repository: espressif/esp-idf
124- # path: idf
125- # ref: master
171+ run : |
172+ IP=$(ip route get 1| awk '{print $7; exit}')
173+ echo "RUNNER_IP=$IP" >> $GITHUB_ENV
174+ - name : Run app in Docker
175+ shell : bash
176+ env :
177+ RUNNER_IP : ${{ env.RUNNER_IP }}
178+ run : |
179+ docker run --rm \
180+ -v "${{ github.workspace }}:/workspace" \
181+ -w /workspace \
182+ -e RUNNER_IP="${RUNNER_IP}" \
183+ python:3.11-bookworm \
184+ bash -c "
185+ pip install --prefer-binary cryptography pytest-embedded pytest-embedded-serial-esp pytest-embedded-idf pytest-custom_exit_code &&
186+ pytest test/publish_connect_test --target=esp32
187+ "
188+ - name : Cleanup workspace
189+ if : always()
190+ shell : bash
191+ run : |
192+ rm -rf test/publish_connect_test
193+ - name : Add node for local tests
194+ if : ${{ env.ACT }}
195+ shell : bash
196+ run : |
197+ curl -fsSL https://deb.nodesource.com/setup_18.x | bash -
198+ apt-get install -y nodejs
199+ - name : Install Python packages
200+ shell : bash
201+ env :
202+ PIP_EXTRA_INDEX_URL : " https://dl.espressif.com/pypi/"
203+ run : pip install --prefer-binary paho-mqtt
204+ - name : Install dependencies
205+ shell : bash
206+ run : apt-get update && apt-get install -y iproute2
207+ - uses : actions/checkout@v4
208+ - name : Download artifacts
209+ uses : actions/download-artifact@v4
210+ id : artifacts
211+ with :
212+ name : mqtt_bin_${{env.target}}_${{ env.idf_version }}_${{ env.app_name }}
213+ path : test/publish_connect_test
214+ # - name: Run mosquitto
215+ # shell: bash
216+ # run: mosquitto -c ci/broker/mosquitto.conf &
217+ - name : Get runner IP
218+ id : get_ip
219+ shell : bash
220+ run : |
221+ IP=$(ip route get 1| awk '{print $7; exit}')
222+ echo "RUNNER_IP=$IP" >> $GITHUB_ENV
126223 # - name: Install Python packages
127224 # shell: bash
128225 # env:
@@ -139,4 +236,6 @@ jobs:
139236 with :
140237 target : esp32
141238 app_name : publish_connnect_test
142- app_path : test
239+ app_path : test/publish_connect_test
240+ env :
241+ RUNNER_IP : ${{ env.RUNNER_IP }}
0 commit comments