|
20 | 20 | devices: |
21 | 21 | description: JSON array of devices. e.g. [\"thingy91x\",\"nrf9151dk\"] |
22 | 22 | type: string |
23 | | - required: false |
| 23 | + required: true |
24 | 24 | default: '[\"thingy91x\"]' |
25 | 25 |
|
26 | 26 | workflow_dispatch: |
|
46 | 46 | devices: |
47 | 47 | description: JSON array of devices. e.g. [\"thingy91x\",\"nrf9151dk\"] |
48 | 48 | type: string |
49 | | - required: false |
| 49 | + required: true |
50 | 50 | default: '[\"thingy91x\"]' |
51 | 51 |
|
52 | 52 | jobs: |
53 | | - set-matrix: |
| 53 | + debug: |
54 | 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 | 55 | steps: |
59 | | - - id: set-matrix |
| 56 | + - name: Test |
60 | 57 | 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 | | -
|
| 58 | + echo ${{ inputs.devices }} |
| 59 | + echo ${{ inputs.boards }} |
| 60 | + echo ${{ fromJson(inputs.devices) }} |
80 | 61 | target_test: |
81 | 62 | # This will create multiple jobs, one for each target defined in the matrix |
82 | | - needs: set-matrix |
83 | 63 | strategy: |
84 | 64 | fail-fast: false # Don't fail all jobs if one fails |
85 | 65 | matrix: |
86 | | - device: ${{ fromJson(needs.set-matrix.outputs.device_matrix) }} |
| 66 | + device: ${{ fromJson(inputs.devices) }} |
87 | 67 |
|
88 | 68 | # Self-hosted runner is labeled according to the device it is linked with |
89 | 69 | runs-on: cia-trd-${{ matrix.device }} |
@@ -155,14 +135,19 @@ jobs: |
155 | 135 | working-directory: asset-tracker-template/tests/on_target |
156 | 136 | run: | |
157 | 137 | mkdir -p results |
| 138 | + if [[ ${{ inputs.test_all }} == true ]]; then |
| 139 | + pytest_marker='' |
| 140 | + else |
| 141 | + pytest_marker='-m "not slow"' |
| 142 | + fi |
158 | 143 | if [[ '${{ matrix.device }}' == 'ppk_thingy91x' ]]; then |
159 | 144 | # For PPK device, only run tests/test_ppk |
160 | | - pytest -v ${{ needs.set-matrix.outputs.pytest_marker }} \ |
| 145 | + pytest -v $pytest_marker \ |
161 | 146 | --junit-xml=results/test-results.xml \ |
162 | 147 | --html=results/test-results.html --self-contained-html \ |
163 | 148 | tests/test_ppk |
164 | 149 | else |
165 | | - pytest -v ${{ needs.set-matrix.outputs.pytest_marker }} \ |
| 150 | + pytest -v $pytest_marker \ |
166 | 151 | --junit-xml=results/test-results.xml \ |
167 | 152 | --html=results/test-results.html --self-contained-html \ |
168 | 153 | --ignore=tests/test_ppk \ |
|
0 commit comments