For Go tests, always upload a success/fail status indicator so that aggregate-result works correctly. (#32065)
Fixes #31994
This commit is contained in:
@@ -317,17 +317,22 @@ jobs:
|
||||
name: ${{ matrix.suite }}-${{ env.MATRIX_MYSQL_ID }}-summary-test-log
|
||||
path: /tmp/summary.txt
|
||||
|
||||
- name: Set fail status
|
||||
if: failure()
|
||||
- name: Set test status
|
||||
if: always()
|
||||
run: |
|
||||
echo "fail" > /tmp/fail
|
||||
if [[ "${{ job.status }}" == "success" ]]; then
|
||||
echo "success" > /tmp/status
|
||||
else
|
||||
echo "fail" > /tmp/status
|
||||
fi
|
||||
|
||||
- name: Upload fail indicator
|
||||
if: failure()
|
||||
- name: Upload status indicator
|
||||
if: always()
|
||||
uses: actions/upload-artifact@834a144ee995460fba8ed112a2fc961b36a5ec5a # v4.3.6
|
||||
with:
|
||||
name: ${{ matrix.suite }}-${{ env.MATRIX_MYSQL_ID }}-fail
|
||||
path: /tmp/fail
|
||||
name: ${{ matrix.suite }}-${{ env.MATRIX_MYSQL_ID }}-status
|
||||
path: /tmp/status
|
||||
overwrite: true
|
||||
|
||||
# Based on https://github.com/micromdm/nanomdm/blob/main/.github/workflows/on-push-pr.yml#L87
|
||||
test-go-nanomdm:
|
||||
@@ -468,13 +473,34 @@ jobs:
|
||||
- name: Download artifacts
|
||||
uses: actions/download-artifact@9c19ed7fe5d278cd354c7dfd5d3b88589c7e2395 # v4.1.6
|
||||
with:
|
||||
pattern: '*-fail'
|
||||
pattern: '*-status'
|
||||
|
||||
- name: Check for failures
|
||||
run: |
|
||||
for dir in $(find ./ -type d -name '*-fail'); do
|
||||
echo "Found $dir"
|
||||
echo "❌ One or more test jobs failed."
|
||||
exit 1
|
||||
failed_tests=""
|
||||
status_count=0
|
||||
# Find all status files (they are in directories like 'fleetctl-mysql8.0.36-status/status')
|
||||
for status_file in $(find ./ -type f -name 'status'); do
|
||||
status_count=$((status_count + 1))
|
||||
# Extract test name from parent directory (e.g., 'fleetctl-mysql8.0.36-status')
|
||||
test_dir=$(basename $(dirname "$status_file"))
|
||||
# Remove '-status' suffix to get the test name
|
||||
test_name="${test_dir%-status}"
|
||||
status_content=$(cat "$status_file")
|
||||
echo "Processing: $status_file (Test: $test_name) with status content: $status_content"
|
||||
if grep -q "fail" "$status_file"; then
|
||||
echo " ❌ Test failed: $test_name"
|
||||
failed_tests="${failed_tests}${test_name}, "
|
||||
else
|
||||
echo " ✅ Test passed: $test_name"
|
||||
fi
|
||||
done
|
||||
if [[ $status_count -eq 0 ]]; then
|
||||
echo "❌ ERROR: No status files found! This indicates a workflow issue."
|
||||
exit 1
|
||||
fi
|
||||
if [[ -n "$failed_tests" ]]; then
|
||||
echo "❌ One or more test jobs failed: ${failed_tests%, }"
|
||||
exit 1
|
||||
fi
|
||||
echo "✅ All test jobs succeeded."
|
||||
|
||||
Reference in New Issue
Block a user