Skip to content

Commit 9c42c4c

Browse files
committed
workflows: Fix test selection logic
Signed-off-by: Jorgen Kvalvaag <jorgen.kvalvaag@nordicsemi.no>
1 parent 6c26c63 commit 9c42c4c

File tree

4 files changed

+15
-9
lines changed

4 files changed

+15
-9
lines changed

.github/workflows/build.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -201,7 +201,7 @@ jobs:
201201
working-directory: asset-tracker-template
202202

203203
- name: Build patched thingy91x firmware
204-
if: ${{ github.event_name != 'pull_request' }}
204+
if: ${{ inputs.build_all }}
205205
uses: ./asset-tracker-template/.github/actions/build-step
206206
with:
207207
board: thingy91x/nrf9151/ns

.github/workflows/target-test.yml

Lines changed: 14 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ on:
1212
pytest_marker:
1313
type: string
1414
required: false
15+
default: -m "not slow"
1516
pytest_path:
1617
type: string
1718
required: false
@@ -55,14 +56,21 @@ jobs:
5556
steps:
5657
- id: set-matrix
5758
run: |
58-
if [[ ${{ github.event_name == 'schedule' }} == "true" ]]; then
59-
matrix='["thingy91x","nrf9151dk","ppk_thingy91x"]'
59+
if [[ ${{ github.event_name == 'schedule' }} == true ]]; then
60+
marker=''
61+
matrix='["thingy91x","nrf9151dk","ppk_thingy91x"]'
62+
elif [[ ${{ github.event_name == 'push' }} == true ]]; then
63+
marker='-m "not slow"'
64+
matrix='["thingy91x"]'
6065
else
66+
marker='${{ inputs.pytest_marker }}'
6167
matrix=${{ inputs.devices }}
6268
fi
6369
64-
echo "Matrix as string: $matrix"
70+
echo Matrix as string: $matrix
71+
echo Pytest marker as string: $marker
6572
echo "device_matrix=$matrix" >> $GITHUB_OUTPUT
73+
echo "pytest_marker=$marker" >> $GITHUB_OUTPUT
6674
6775
target_test:
6876
# This will create multiple jobs, one for each target defined in the matrix
@@ -131,7 +139,7 @@ jobs:
131139
asset-tracker-template-${{ inputs.artifact_fw_version }}-debug-${{ vars.DUT_DEVICE_TYPE }}-nrf91.elf
132140
133141
- name: Generate and Push RAM and FLASH Badges
134-
if: ${{ matrix.device == 'thingy91x' && inputs.is_scheduled }}
142+
if: ${{ matrix.device == 'thingy91x' && github.event_name == 'schedule' }}
135143
continue-on-error: true
136144
working-directory: asset-tracker-template
137145
env:
@@ -144,12 +152,12 @@ jobs:
144152
mkdir -p results
145153
if [[ '${{ matrix.device }}' == 'ppk_thingy91x' ]]; then
146154
# For PPK device, only run tests/test_ppk
147-
pytest -v ${{ inputs.pytest_marker }} \
155+
pytest -v ${{ needs.set-matrix.outputs.pytest_marker }} \
148156
--junit-xml=results/test-results.xml \
149157
--html=results/test-results.html --self-contained-html \
150158
tests/test_ppk
151159
else
152-
pytest -v ${{ inputs.pytest_marker }} \
160+
pytest -v ${{ needs.set-matrix.outputs.pytest_marker }} \
153161
--junit-xml=results/test-results.xml \
154162
--html=results/test-results.html --self-contained-html \
155163
--ignore=tests/test_ppk \

tests/on_target/tests/pytest.ini

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
11
[pytest]
22
markers =
33
slow: marks tests as slow (deselect with '-m "not slow"')
4-
mqtt: marks tests that require MQTT functionality

tests/on_target/tests/test_functional/test_mqtt.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@
1313

1414
logger = get_logger()
1515

16-
@pytest.mark.mqtt
1716
@pytest.mark.slow
1817
def test_mqtt_firmware(dut_board, hex_file_mqtt):
1918
"""Test the firmware with cloud MQTT module."""

0 commit comments

Comments
 (0)