|
50 | 50 | default: '[\"thingy91x\"]' |
51 | 51 |
|
52 | 52 | jobs: |
53 | | - set-matrix: |
54 | | - runs-on: ubuntu-latest |
55 | | - outputs: |
56 | | - device_matrix: ${{ steps.set-matrix.outputs.device_matrix }} |
57 | | - pytest_marker: ${{ steps.set-matrix.outputs.pytest_marker }} |
58 | | - steps: |
59 | | - - id: set-matrix |
60 | | - run: | |
61 | | - if [[ ${{ github.event_name == 'schedule' }} == true ]]; then |
62 | | - marker='' |
63 | | - matrix='["thingy91x","nrf9151dk","ppk_thingy91x"]' |
64 | | - elif [[ ${{ inputs.test_all }} == true ]]; then |
65 | | - marker='' |
66 | | - matrix='["thingy91x","nrf9151dk","ppk_thingy91x"]' |
67 | | - elif [[ ${{ github.event_name == 'push' }} == true ]]; then |
68 | | - marker='-m "not slow"' |
69 | | - matrix='["thingy91x"]' |
70 | | - else |
71 | | - marker='-m "not slow"' |
72 | | - matrix='["thingy91x"]' |
73 | | - fi |
74 | | -
|
75 | | - echo Matrix as string: $matrix |
76 | | - echo Pytest marker as string: $marker |
77 | | - echo "device_matrix=$matrix" >> $GITHUB_OUTPUT |
78 | | - echo "pytest_marker=$marker" >> $GITHUB_OUTPUT |
79 | | -
|
80 | 53 | target_test: |
81 | 54 | # This will create multiple jobs, one for each target defined in the matrix |
82 | | - needs: set-matrix |
83 | 55 | strategy: |
84 | 56 | fail-fast: false # Don't fail all jobs if one fails |
85 | 57 | matrix: |
86 | | - device: ${{ fromJson(needs.set-matrix.outputs.device_matrix) }} |
| 58 | + device: ${{ fromJson(inputs.devices) }} |
87 | 59 |
|
88 | 60 | # Self-hosted runner is labeled according to the device it is linked with |
89 | 61 | runs-on: cia-trd-${{ matrix.device }} |
@@ -155,14 +127,19 @@ jobs: |
155 | 127 | working-directory: asset-tracker-template/tests/on_target |
156 | 128 | run: | |
157 | 129 | mkdir -p results |
| 130 | + if [[ ${{ inputs.test_all }} == true ]]; then |
| 131 | + pytest_marker='-m "not slow"' |
| 132 | + else |
| 133 | + pytest_marker='' |
| 134 | + fi |
158 | 135 | if [[ '${{ matrix.device }}' == 'ppk_thingy91x' ]]; then |
159 | 136 | # For PPK device, only run tests/test_ppk |
160 | | - pytest -v ${{ needs.set-matrix.outputs.pytest_marker }} \ |
| 137 | + pytest -v $pytest_marker \ |
161 | 138 | --junit-xml=results/test-results.xml \ |
162 | 139 | --html=results/test-results.html --self-contained-html \ |
163 | 140 | tests/test_ppk |
164 | 141 | else |
165 | | - pytest -v ${{ needs.set-matrix.outputs.pytest_marker }} \ |
| 142 | + pytest -v $pytest_marker \ |
166 | 143 | --junit-xml=results/test-results.xml \ |
167 | 144 | --html=results/test-results.html --self-contained-html \ |
168 | 145 | --ignore=tests/test_ppk \ |
|
0 commit comments