@@ -94,11 +94,18 @@ jobs:
94
94
app_repository : ${{ inputs.app_repository }}
95
95
app_branch_name : ${{ inputs.app_branch_name }}
96
96
compatible_devices : ${{ inputs.run_for_devices }}
97
+
98
+ call_get_test_metadata :
99
+ name : Retrieve test metadata
100
+ uses : ./.github/workflows/_get_test_metadata.yml
101
+ with :
102
+ app_repository : ${{ inputs.app_repository }}
103
+ app_branch_name : ${{ inputs.app_branch_name }}
97
104
pytest_directory : ${{ inputs.test_dir }}
98
105
99
106
ragger_tests :
100
107
name : Functional tests with Ragger
101
- needs : call_get_app_metadata
108
+ needs : [ call_get_app_metadata, call_get_test_metadata]
102
109
strategy :
103
110
fail-fast : false
104
111
matrix :
@@ -109,7 +116,7 @@ jobs:
109
116
steps :
110
117
- name : Check metadata
111
118
run : |
112
- if [ '${{ needs.call_get_app_metadata .outputs.pytest_directory }}' = 'None' ]; then
119
+ if [ '${{ needs.call_get_test_metadata .outputs.pytest_directory }}' = 'None' ]; then
113
120
>&2 echo "ERROR: This workflow either needs a 'ledger_app.toml' manifest with a 'tests.pytest_directory' section, or be configured with a valid 'test_dir' parameter"
114
121
exit 1
115
122
fi
@@ -164,32 +171,53 @@ jobs:
164
171
uses : actions/download-artifact@v4
165
172
with :
166
173
name : ${{ inputs.lib_binaries_artifact }}
167
- path : ${{ needs.call_get_app_metadata .outputs.pytest_directory }}/lib_binaries/
174
+ path : ${{ needs.call_get_test_metadata .outputs.pytest_directory }}/lib_binaries/
168
175
169
176
- name : Display structure of downloaded files
170
177
if : ${{ inputs.lib_binaries_artifact != '' }}
171
- run : ls -R ${{ needs.call_get_app_metadata.outputs.pytest_directory }}/lib_binaries/
178
+ run : ls -R ${{ needs.call_get_test_metadata.outputs.pytest_directory }}/lib_binaries/
179
+
180
+ # To be suppressed when ledgered for manifest v2 is released
181
+ - name : Clone ledgered repository
182
+ uses : actions/checkout@v4
183
+ with :
184
+ repository : LedgerHQ/ledgered
185
+ ref : y333/manage_pytest_swap_directory
186
+ path : ledgered
187
+ fetch-tags : true
188
+ fetch-depth : 0
189
+ token : ${{ secrets.token && secrets.token || github.token }}
190
+
191
+ - name : Install local version of ledgered
192
+ run : |
193
+ # Install the local version of ledgered
194
+ cd ledgered
195
+ python -m pip install --upgrade pip
196
+ pip install -e .[dev]
197
+ cd ..
198
+ rm -rf ledgered/tests
199
+ # #######################################################
172
200
173
201
- name : Install tests dependencies
174
202
run : |
175
203
sudo apt-get update && sudo apt-get install -y qemu-user-static tesseract-ocr libtesseract-dev
176
204
pip install -U pip packaging setuptools
177
- pip install -r "${{ needs.call_get_app_metadata .outputs.pytest_directory }}/requirements.txt"
178
- if [ -f ${{ needs.call_get_app_metadata .outputs.pytest_directory }}/setup_script.sh ]; then
179
- ./${{ needs.call_get_app_metadata .outputs.pytest_directory }}/setup_script.sh
205
+ pip install -r "${{ needs.call_get_test_metadata .outputs.pytest_directory }}/requirements.txt"
206
+ if [ -f ${{ needs.call_get_test_metadata .outputs.pytest_directory }}/setup_script.sh ]; then
207
+ ./${{ needs.call_get_test_metadata .outputs.pytest_directory }}/setup_script.sh
180
208
fi
181
209
182
210
- name : Clear legacy snapshots
183
211
if : ${{ inputs.regenerate_snapshots == true }}
184
212
run : |
185
- rm -rf ${{ needs.call_get_app_metadata .outputs.pytest_directory }}/snapshots
213
+ rm -rf ${{ needs.call_get_test_metadata .outputs.pytest_directory }}/snapshots
186
214
187
215
- name : Run test
188
216
env :
189
217
CTEST_OUTPUT_ON_FAILURE : 1
190
218
PROTOCOL_BUFFERS_PYTHON_IMPLEMENTATION : python
191
219
run : |
192
- pytest ${{ needs.call_get_app_metadata .outputs.pytest_directory }}/ \
220
+ pytest ${{ needs.call_get_test_metadata .outputs.pytest_directory }}/ \
193
221
--tb=short -v \
194
222
--device ${{ matrix.device }} \
195
223
-k ${{ inputs.test_filter }} \
@@ -203,14 +231,14 @@ jobs:
203
231
with :
204
232
# Make the artifact name unique to allow running this job in parallel
205
233
name : tests_snapshots${{ inputs.test_options }}-${{ matrix.device }}
206
- path : ${{ needs.call_get_app_metadata .outputs.pytest_directory }}/snapshots-tmp
234
+ path : ${{ needs.call_get_test_metadata .outputs.pytest_directory }}/snapshots-tmp
207
235
208
236
- name : Upload snapshots on success if needed
209
237
if : ${{ inputs.regenerate_snapshots == true }}
210
238
uses : actions/upload-artifact@v4
211
239
with :
212
240
name : tests_snapshots${{ inputs.test_options }}-${{ matrix.device }}
213
- path : ${{ needs.call_get_app_metadata .outputs.pytest_directory }}/snapshots-tmp
241
+ path : ${{ needs.call_get_test_metadata .outputs.pytest_directory }}/snapshots-tmp
214
242
215
243
- name : Set upload flag
216
244
id : upload-flag
@@ -246,4 +274,4 @@ jobs:
246
274
app_repository : ${{ inputs.app_repository }}
247
275
app_branch_name : ${{ inputs.app_branch_name }}
248
276
snapshots_artifact_name : ${{ needs.merge_artifacts_if_needed.outputs.snapshot_artifact_name }}
249
- snapshots_directory : ${{ needs.call_get_app_metadata .outputs.pytest_directory }}/snapshots
277
+ snapshots_directory : ${{ needs.call_get_test_metadata .outputs.pytest_directory }}/snapshots
0 commit comments