Skip to content

Commit 40d27e9

Browse files
committed
Enhance the device management for unit/integration tests
Signed-off-by: Samet Akcay <[email protected]>
1 parent b8455b4 commit 40d27e9

File tree

1 file changed

+12
-13
lines changed

1 file changed

+12
-13
lines changed

.github/actions/pytest/action.yaml

+12-13
Original file line numberDiff line numberDiff line change
@@ -139,7 +139,6 @@ runs:
139139
if [ "${{ inputs.device }}" = "cpu" ]; then
140140
DEVICE_ARGS="--markers='not gpu'"
141141
else
142-
# For GPU runners, no need to skip GPU tests
143142
DEVICE_ARGS=""
144143
fi
145144
@@ -149,33 +148,33 @@ runs:
149148
--durations=10 \
150149
--durations-min=1.0 \
151150
--timeout=${{ inputs.max-test-time }} \
152-
--json-report --json-report-file=pytest.json \
151+
--verbosity=0 \
152+
--durations-only \
153153
$DEVICE_ARGS
154154
155-
# Store test result
156-
echo "success=$?" >> $GITHUB_OUTPUT
155+
# Store test result and duration
156+
exit_code=$?
157+
echo "success=$exit_code" >> $GITHUB_OUTPUT
157158
158-
# Calculate duration
159159
end_time=$(date +%s)
160-
echo "duration=$((end_time - start_time))" >> $GITHUB_OUTPUT
160+
duration=$((end_time - start_time))
161+
echo "duration=$duration" >> $GITHUB_OUTPUT
162+
163+
exit $exit_code
161164
162165
# Fail the workflow if tests failed
163166
- name: Check test results
164167
if: steps.test-execution.outputs.success != '0'
165168
shell: bash
166169
run: exit 1
167170

168-
# Analyze and report test performance
169-
- name: Analyze test performance
170-
if: always() # Run even if tests fail
171+
# Analyze test performance
172+
- name: Check test duration
173+
if: always()
171174
shell: bash
172175
run: |
173176
echo "Test Duration: ${{ steps.test-execution.outputs.duration }} seconds"
174177
175-
# Report slowest tests for optimization
176-
echo "Top 10 slowest tests:"
177-
cat pytest.json | jq -r '.tests[] | select(.duration >= 1) | "\(.duration)s \(.name)"' | sort -rn | head -n 10
178-
179178
# Warn if tests exceed time limit
180179
if [ "${{ steps.test-execution.outputs.duration }}" -gt "${{ inputs.max-test-time }}" ]; then
181180
echo "::warning::Test suite exceeded recommended duration of ${{ inputs.max-test-time }} seconds"

0 commit comments

Comments
 (0)