Skip to content

Commit 285a8a4

Browse files
committed
ci: Only run MQTT test on nighty (slow)
This commit modifies the GitHub Actions workflow to only run the MQTT test on the nightly build. This is done to reduce the time taken for the CI pipeline, as the MQTT test is slow and not needed for every commit. The test will still be run on the nightly build to ensure that it is functioning correctly. Signed-off-by: Simen S. Røstad <simen.rostad@nordicsemi.no>
1 parent 77b29ed commit 285a8a4

File tree

3 files changed

+20
-25
lines changed

3 files changed

+20
-25
lines changed

.github/workflows/target-test.yml

Lines changed: 0 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -170,7 +170,6 @@ jobs:
170170
--junit-xml=results/test-results.xml \
171171
--html=results/test-results.html --self-contained-html \
172172
--ignore=tests/test_ppk \
173-
--ignore=tests/test_functional/test_mqtt.py \
174173
${{ inputs.pytest_path }}
175174
fi
176175
shell: bash
@@ -186,27 +185,6 @@ jobs:
186185
MEMFAULT_PROJECT_SLUG: ${{ vars.MEMFAULT_PROJECT_SLUG }}
187186
APP_BUNDLEID: ${{ env.APP_BUNDLEID }}
188187

189-
- name: Test MQTT Firmware
190-
if: ${{ matrix.device == 'thingy91x' && endsWith(inputs.artifact_fw_version, '-mqtt') }}
191-
working-directory: asset-tracker-template/tests/on_target
192-
run: |
193-
pytest -v \
194-
--junit-xml=results/test-results-mqtt.xml \
195-
--html=results/test-results-mqtt.html --self-contained-html \
196-
tests/test_functional/test_mqtt.py
197-
shell: bash
198-
env:
199-
SEGGER: ${{ env.RUNNER_SERIAL_NUMBER }}
200-
DUT_DEVICE_TYPE: ${{ vars.DUT_DEVICE_TYPE }}
201-
UUID: ${{ env.UUID }}
202-
NRFCLOUD_API_KEY: ${{ secrets.NRF_CLOUD_API_KEY }}
203-
LOG_FILENAME: att_test_log_mqtt
204-
TEST_REPORT_NAME: ATT MQTT Firmware Test Report
205-
MEMFAULT_ORGANIZATION_TOKEN: ${{ secrets.MEMFAULT_ORGANIZATION_TOKEN }}
206-
MEMFAULT_ORGANIZATION_SLUG: ${{ vars.MEMFAULT_ORGANIZATION_SLUG }}
207-
MEMFAULT_PROJECT_SLUG: ${{ vars.MEMFAULT_PROJECT_SLUG }}
208-
APP_BUNDLEID: ${{ env.APP_BUNDLEID }}
209-
210188
- name: Generate and Push Power Badge
211189
if: ${{ matrix.device }} == ppk_thingy91x
212190
continue-on-error: true

tests/on_target/tests/conftest.py

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -183,3 +183,19 @@ def hex_file_patched():
183183
return os.path.join(artifacts_dir, file)
184184

185185
pytest.fail("No matching firmware .hex file found in the artifacts directory")
186+
187+
@pytest.fixture(scope="session")
188+
def hex_file_mqtt():
189+
# Skip if not thingy91x since MQTT build is only available for thingy91x
190+
if DUT_DEVICE_TYPE != 'thingy91x':
191+
pytest.skip("mqtt build is only available for thingy91x")
192+
193+
# Search for the firmware hex file in the artifacts folder
194+
artifacts_dir = "artifacts/"
195+
hex_pattern = f"asset-tracker-template-{r"[0-9a-z\.]+"}-mqtt-{DUT_DEVICE_TYPE}-nrf91.hex"
196+
197+
for file in os.listdir(artifacts_dir):
198+
if re.match(hex_pattern, file):
199+
return os.path.join(artifacts_dir, file)
200+
201+
pytest.fail("No matching firmware .hex file found in the artifacts directory")

tests/on_target/tests/test_functional/test_mqtt.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,15 +13,16 @@
1313

1414
logger = get_logger()
1515

16-
def test_mqtt_firmware(dut_board, hex_file):
17-
"""Test the MQTT firmware with magnetometer functionality."""
16+
@pytest.mark.slow
17+
def test_mqtt_firmware(dut_board, hex_file_mqtt):
18+
"""Test the firmware with cloud MQTT module."""
1819
# Only run this test for thingy91x devices
1920
devicetype = os.getenv("DUT_DEVICE_TYPE")
2021
if devicetype != "thingy91x":
2122
pytest.skip("This test is only for thingy91x devices")
2223

2324
# Flash the firmware
24-
flash_device(os.path.abspath(hex_file))
25+
flash_device(os.path.abspath(hex_file_mqtt))
2526
dut_board.uart.xfactoryreset()
2627

2728
# Log patterns to check

0 commit comments

Comments
 (0)