Skip to content

Commit 4f82ca7

Browse files
committed
chore: Various improvements
1 parent f2a9e76 commit 4f82ca7

File tree

1 file changed

+6
-142
lines changed

1 file changed

+6
-142
lines changed

.github/workflows/run-tests.yml

Lines changed: 6 additions & 142 deletions
Original file line numberDiff line numberDiff line change
@@ -701,7 +701,7 @@ jobs:
701701
test_passed=true
702702
else
703703
echo "✗ Test failed in repo '$REPO_TAG' with conclusion: $run_conclusion"
704-
echo "::warning::test failure: ${{ steps.pipeline-name.outputs.name }} - pipeline: $run_url"
704+
echo "::error::test failure: ${{ steps.pipeline-name.outputs.name }} - pipeline: $run_url"
705705
gh run view $run_id --repo "$GITHUB_REPO" --log-failed || true
706706
test_passed=false
707707
fi
@@ -728,25 +728,10 @@ jobs:
728728
729729
if [ $elapsed -ge $timeout ]; then
730730
echo "✗ Test timed out after $timeout seconds in repo '$REPO_TAG'"
731-
echo "::warning::test failure: ${{ steps.pipeline-name.outputs.name }} - pipeline: $run_url (timeout)"
731+
echo "::error::test failure: ${{ steps.pipeline-name.outputs.name }} - pipeline: $run_url (timeout)"
732732
test_passed=false
733733
fi
734734
735-
# Create artifact
736-
mkdir -p pipeline-info
737-
jq -n \
738-
--arg platform "github" \
739-
--arg repo_tag "$REPO_TAG" \
740-
--arg version "${{ matrix.version }}" \
741-
--arg component "${{ matrix.component }}" \
742-
--arg product "${{ matrix.product }}" \
743-
--arg source_dir "${{ matrix.source_dir }}" \
744-
--arg os "${{ matrix.os }}" \
745-
--arg pipeline_url "$run_url" \
746-
--arg status "$([ "$test_passed" = true ] && echo "passed" || echo "failed")" \
747-
'{platform: $platform, repo_tag: $repo_tag, version: $version, component: $component, product: $product, source_dir: $source_dir, os: $os, pipeline_url: $pipeline_url, status: $status}' \
748-
> "pipeline-info/result.json"
749-
750735
# Fail the job if test failed
751736
if [ "$test_passed" != "true" ]; then
752737
echo "ERROR: Test failed"
@@ -854,7 +839,7 @@ jobs:
854839
;;
855840
failed|canceled|skipped)
856841
echo "✗ Test failed in repo '$REPO_TAG' with status: $pipeline_status"
857-
echo "::warning::test failure: ${{ steps.pipeline-name.outputs.name }} - pipeline: $pipeline_url"
842+
echo "::error::test failure: ${{ steps.pipeline-name.outputs.name }} - pipeline: $pipeline_url"
858843
curl -f -s \
859844
"https://gitlab.com/api/v4/projects/$GITLAB_PROJECT_ID/pipelines/$pipeline_id/jobs" \
860845
-H "PRIVATE-TOKEN: $GITLAB_TOKEN" | jq '.[] | select(.status == "failed") | {name, stage, status}' || true
@@ -891,25 +876,10 @@ jobs:
891876
892877
if [ $elapsed -ge $timeout ]; then
893878
echo "✗ Test timed out after $timeout seconds in repo '$REPO_TAG'"
894-
echo "::warning::test failure: ${{ steps.pipeline-name.outputs.name }} - pipeline: $pipeline_url (timeout)"
879+
echo "::error::test failure: ${{ steps.pipeline-name.outputs.name }} - pipeline: $pipeline_url (timeout)"
895880
test_passed=false
896881
fi
897882
898-
# Create artifact
899-
mkdir -p pipeline-info
900-
jq -n \
901-
--arg platform "gitlab" \
902-
--arg repo_tag "$REPO_TAG" \
903-
--arg version "${{ matrix.version }}" \
904-
--arg component "${{ matrix.component }}" \
905-
--arg product "${{ matrix.product }}" \
906-
--arg source_dir "${{ matrix.source_dir }}" \
907-
--arg os "${{ matrix.os }}" \
908-
--arg pipeline_url "$pipeline_url" \
909-
--arg status "$([ "$test_passed" = true ] && echo "passed" || echo "failed")" \
910-
'{platform: $platform, repo_tag: $repo_tag, version: $version, component: $component, product: $product, source_dir: $source_dir, os: $os, pipeline_url: $pipeline_url, status: $status}' \
911-
> "pipeline-info/result.json"
912-
913883
# Fail the job if test failed
914884
if [ "$test_passed" != "true" ]; then
915885
echo "ERROR: Test failed"
@@ -1062,7 +1032,7 @@ jobs:
10621032
test_passed=true
10631033
else
10641034
echo "✗ Test failed in repo '$REPO_TAG' with result: $build_result"
1065-
echo "::warning::test failure: ${{ steps.pipeline-name.outputs.name }} - pipeline: $build_url"
1035+
echo "::error::test failure: ${{ steps.pipeline-name.outputs.name }} - pipeline: $build_url"
10661036
# Get failed job logs
10671037
curl -s \
10681038
"https://dev.azure.com/$ADO_ORG/$ADO_PROJ/_apis/build/builds/$build_id/timeline?api-version=7.1-preview.2" \
@@ -1093,118 +1063,12 @@ jobs:
10931063
10941064
if [ $elapsed -ge $timeout ]; then
10951065
echo "✗ Test timed out after $timeout seconds in repo '$REPO_TAG'"
1096-
echo "::warning::test failure: ${{ steps.pipeline-name.outputs.name }} - pipeline: $build_url (timeout)"
1066+
echo "::error::test failure: ${{ steps.pipeline-name.outputs.name }} - pipeline: $build_url (timeout)"
10971067
test_passed=false
10981068
fi
10991069
1100-
# Create artifact
1101-
mkdir -p pipeline-info
1102-
jq -n \
1103-
--arg platform "ado" \
1104-
--arg repo_tag "$REPO_TAG" \
1105-
--arg version "${{ matrix.version }}" \
1106-
--arg component "${{ matrix.component }}" \
1107-
--arg product "${{ matrix.product }}" \
1108-
--arg source_dir "${{ matrix.source_dir }}" \
1109-
--arg os "${{ matrix.os }}" \
1110-
--arg pipeline_url "$build_url" \
1111-
--arg status "$([ "$test_passed" = true ] && echo "passed" || echo "failed")" \
1112-
'{platform: $platform, repo_tag: $repo_tag, version: $version, component: $component, product: $product, source_dir: $source_dir, os: $os, pipeline_url: $pipeline_url, status: $status}' \
1113-
> "pipeline-info/result.json"
1114-
11151070
# Fail the job if test failed
11161071
if [ "$test_passed" != "true" ]; then
11171072
echo "ERROR: Test failed"
11181073
exit 1
11191074
fi
1120-
1121-
- name: Generate artifact name
1122-
id: artifact-name
1123-
if: always()
1124-
run: |
1125-
# Sanitize artifact name by replacing invalid characters
1126-
artifact_name="pipeline-info-${{ matrix.platform }}-${{ matrix.repo_tag }}-${{ matrix.version }}-${{ matrix.product }}-${{ matrix.component }}-${{ matrix.source_dir }}-${{ matrix.os }}"
1127-
# Replace invalid characters: / : < > | * ? \ " with -
1128-
artifact_name=$(echo "$artifact_name" | sed 's/[\/:<>|*?\\"'\'']/-/g')
1129-
echo "name=$artifact_name" >> $GITHUB_OUTPUT
1130-
1131-
- name: Upload pipeline info
1132-
if: always() && hashFiles('pipeline-info/result.json') != ''
1133-
uses: actions/upload-artifact@v4
1134-
with:
1135-
name: ${{ steps.artifact-name.outputs.name }}
1136-
path: pipeline-info/
1137-
retention-days: 1
1138-
summary:
1139-
name: Test Summary
1140-
needs: [prepare-matrix, test]
1141-
runs-on: ubuntu-latest
1142-
if: always()
1143-
steps:
1144-
- name: Download all pipeline info
1145-
if: needs.test.result != 'skipped'
1146-
uses: actions/download-artifact@v4
1147-
with:
1148-
pattern: pipeline-info-*
1149-
path: pipeline-info
1150-
merge-multiple: true
1151-
continue-on-error: true
1152-
1153-
- name: Create summary
1154-
run: |
1155-
echo "## Integration Test Results" >> $GITHUB_STEP_SUMMARY
1156-
echo "" >> $GITHUB_STEP_SUMMARY
1157-
echo "**Overall Status:** ${{ needs.test.result }}" >> $GITHUB_STEP_SUMMARY
1158-
echo "" >> $GITHUB_STEP_SUMMARY
1159-
1160-
# Add pipeline links if available
1161-
if [ -d "pipeline-info" ] && [ "$(ls -A pipeline-info 2>/dev/null)" ]; then
1162-
echo "### Test Results" >> $GITHUB_STEP_SUMMARY
1163-
echo "" >> $GITHUB_STEP_SUMMARY
1164-
1165-
# Create table header
1166-
echo "| CI System | Repo | Version | Component | Product | Source | OS | Status |" >> $GITHUB_STEP_SUMMARY
1167-
echo "|-----------|------|---------|-----------|---------|--------|----|---------|" >> $GITHUB_STEP_SUMMARY
1168-
1169-
# Count pass/fail
1170-
pass_count=0
1171-
fail_count=0
1172-
1173-
# Process JSON files
1174-
for file in pipeline-info/*.json; do
1175-
if [ -f "$file" ]; then
1176-
platform=$(jq -r '.platform' "$file")
1177-
repo_tag=$(jq -r '.repo_tag' "$file")
1178-
version=$(jq -r '.version' "$file")
1179-
component=$(jq -r '.component' "$file")
1180-
product=$(jq -r '.product' "$file")
1181-
source_dir=$(jq -r '.source_dir' "$file")
1182-
os=$(jq -r '.os' "$file")
1183-
pipeline_url=$(jq -r '.pipeline_url' "$file")
1184-
status=$(jq -r '.status' "$file")
1185-
1186-
# Format CI system name
1187-
case "$platform" in
1188-
github) ci_name="GitHub" ;;
1189-
gitlab) ci_name="GitLab" ;;
1190-
ado) ci_name="Azure DevOps" ;;
1191-
*) ci_name="$platform" ;;
1192-
esac
1193-
1194-
# Format status
1195-
if [ "$status" = "passed" ]; then
1196-
status_icon="✅ PASS"
1197-
pass_count=$((pass_count + 1))
1198-
else
1199-
status_icon="❌ FAIL"
1200-
fail_count=$((fail_count + 1))
1201-
fi
1202-
1203-
# Add table row with link to pipeline
1204-
echo "| $ci_name | $repo_tag | $version | $component | $product | $source_dir | $os | [$status_icon]($pipeline_url) |" >> $GITHUB_STEP_SUMMARY
1205-
fi
1206-
done
1207-
1208-
echo "" >> $GITHUB_STEP_SUMMARY
1209-
echo "**Summary:** $pass_count passed, $fail_count failed" >> $GITHUB_STEP_SUMMARY
1210-
fi

0 commit comments

Comments
 (0)