Skip to content

Commit 4d2508a

Browse files
authored
Merge branch 'main' into 24623-xts-speedup-memory-profiling
2 parents db759fc + 3d9574f commit 4d2508a

File tree

169 files changed

+10735
-4868
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

169 files changed

+10735
-4868
lines changed

.github/flaky-test-managers.yml

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
# SPDX-License-Identifier: Apache-2.0
2+
#
3+
# Maps test categories to the manager(s) responsible for flaky tests.
4+
# `artifact-pattern` is a glob matched against the downloaded artifact directory name.
5+
# Use GitHub usernames (without @).
6+
categories:
7+
unit-tests:
8+
artifact-pattern: "Unit Test Report"
9+
managers: [Jeffrey-morgan34]
10+
integration-tests:
11+
artifact-pattern: "Integration Test Report"
12+
managers: [Jeffrey-morgan34]
13+
smart-contract-hapi-tests:
14+
artifact-pattern: "HAPI Test (Smart Contract) Report"
15+
managers: [Jeffrey-morgan34]
16+
hapi-tests:
17+
artifact-pattern: "HAPI Test*"
18+
managers: [Jeffrey-morgan34]
19+
otter-tests:
20+
artifact-pattern: "Otter Tests*"
21+
managers: [Jeffrey-morgan34]
22+
chaos-otter-tests:
23+
artifact-pattern: "Chaos Otter*"
24+
managers: [Jeffrey-morgan34]
25+
timing-sensitive-tests:
26+
artifact-pattern: "*Timing Sensitive*"
27+
managers: [Jeffrey-morgan34]
28+
hammer-tests:
29+
artifact-pattern: "Hammer Test*"
30+
managers: [Jeffrey-morgan34]
31+
catch-all:
32+
default: true
33+
managers: [Jeffrey-morgan34]
Lines changed: 158 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,158 @@
1+
# SPDX-License-Identifier: Apache-2.0
2+
name: "800: [CALL] Report Flaky Tests"
3+
on:
4+
workflow_call:
5+
inputs:
6+
workflow-context:
7+
description: "Context: pr-checks, dry-run, or main-scheduled"
8+
type: string
9+
required: true
10+
secrets:
11+
access-token:
12+
required: true
13+
outputs:
14+
flaky-count:
15+
description: "Number of flaky tests detected"
16+
value: ${{ jobs.report.outputs.flaky-count }}
17+
flaky-tests-json:
18+
description: "JSON array of flaky tests with issue info"
19+
value: ${{ jobs.report.outputs.flaky-tests-json }}
20+
has-new-issues:
21+
description: "Whether any new issues were created"
22+
value: ${{ jobs.report.outputs.has-new-issues }}
23+
24+
permissions:
25+
issues: write
26+
contents: read
27+
pull-requests: write
28+
29+
defaults:
30+
run:
31+
shell: bash
32+
33+
concurrency:
34+
group: report-flaky-tests
35+
cancel-in-progress: false
36+
37+
jobs:
38+
report:
39+
name: Report Flaky Tests
40+
runs-on: hl-cn-default-lin-sm
41+
outputs:
42+
flaky-count: ${{ steps.set-outputs.outputs.flaky-count }}
43+
flaky-tests-json: ${{ steps.set-outputs.outputs.flaky-tests-json }}
44+
has-new-issues: ${{ steps.set-outputs.outputs.has-new-issues }}
45+
steps:
46+
- name: Harden Runner
47+
uses: step-security/harden-runner@ec9f2d5744a09debf3a187a3f4f675c53b671911 # v2.13.0
48+
with:
49+
egress-policy: audit
50+
51+
- name: Checkout Code
52+
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
53+
with:
54+
fetch-depth: "1"
55+
ref: ${{ github.sha }}
56+
57+
- name: Download Test Report Artifacts
58+
id: download-test-reports
59+
uses: actions/download-artifact@d3f86a106a0bac45b974a628896c90dbdf5c8093 # v4.3.0
60+
continue-on-error: true
61+
with:
62+
pattern: "*Test*Report*"
63+
path: test-reports/
64+
65+
- name: Install xmlstarlet
66+
run: |
67+
sudo apt-get update && sudo apt-get install -y xmlstarlet
68+
69+
- name: Collect Flaky Tests
70+
id: collect-flaky-tests
71+
if: ${{ steps.download-test-reports.outcome == 'success' }}
72+
run: |
73+
bash "${{ github.workspace }}/.github/workflows/support/scripts/collect-flaky-tests.sh" \
74+
"test-reports" \
75+
"flaky-tests.json"
76+
FLAKY_COUNT=$(jq 'length' flaky-tests.json)
77+
echo "flaky-count=${FLAKY_COUNT}" >> "${GITHUB_OUTPUT}"
78+
79+
- name: Process Flaky Issues
80+
id: process-flaky-issues
81+
if: ${{ steps.collect-flaky-tests.outputs.flaky-count > 0 && inputs.workflow-context != 'dry-run' }}
82+
env:
83+
GH_TOKEN: ${{ secrets.access-token }}
84+
run: |
85+
# Determine PR number if available
86+
PR_NUMBER=""
87+
if [[ "${{ inputs.workflow-context }}" == "pr-checks" ]]; then
88+
PR_NUMBER="${{ github.event.pull_request.number }}"
89+
elif [[ "${{ inputs.workflow-context }}" == "dry-run" ]]; then
90+
BRANCH="${{ github.head_ref || github.ref_name }}"
91+
PR_NUMBER=$(gh pr list --head "${BRANCH}" --state open --json number --jq '.[0].number' 2>/dev/null || echo "")
92+
fi
93+
94+
bash "${{ github.workspace }}/.github/workflows/support/scripts/report-flaky-issues.sh" \
95+
"flaky-tests.json" \
96+
"${{ github.workspace }}/.github/flaky-test-managers.yml" \
97+
"${{ github.workflow }}" \
98+
"${{ github.run_number }}" \
99+
"${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}" \
100+
"${PR_NUMBER}"
101+
102+
- name: Post PR Comment
103+
if: ${{ steps.collect-flaky-tests.outputs.flaky-count > 0 && inputs.workflow-context == 'pr-checks' }}
104+
uses: actions/github-script@d7906e4ad0b1822421a7e6a35d5ca353c962f410 # v6.4.1
105+
env:
106+
WORKFLOW_CONTEXT: ${{ inputs.workflow-context }}
107+
BRANCH_NAME: ${{ github.head_ref || github.ref_name }}
108+
with:
109+
github-token: ${{ secrets.access-token }}
110+
script: |
111+
const script = require('.github/workflows/support/scripts/post-flaky-pr-comment.js');
112+
await script({ github, context, core });
113+
114+
- name: Write Step Summary
115+
if: ${{ steps.collect-flaky-tests.outputs.flaky-count > 0 }}
116+
run: |
117+
{
118+
echo "## Flaky Tests Detected"
119+
echo ""
120+
echo "The following tests were flaky in this CI run (failed initially but passed on retry):"
121+
echo ""
122+
123+
if [[ -f "flaky-issues.json" ]]; then
124+
echo "| Test | Ticket |"
125+
echo "|------|--------|"
126+
jq -r '.[] | "| `\(.class)#\(.method)` | #\(.issue_number) |"' flaky-issues.json
127+
else
128+
echo "| Test |"
129+
echo "|------|"
130+
jq -r '.[] | "| `\(.class)#\(.method)` |"' flaky-tests.json
131+
fi
132+
echo ""
133+
echo "> **Note:** Flaky tests are informational only and did not fail the build."
134+
} >> "${GITHUB_STEP_SUMMARY}"
135+
136+
- name: Write No Flaky Tests Summary
137+
if: ${{ steps.download-test-reports.outcome == 'success' && (steps.collect-flaky-tests.outputs.flaky-count == 0 || steps.collect-flaky-tests.outputs.flaky-count == '') }}
138+
run: |
139+
echo "## No Flaky Tests Detected" >> "${GITHUB_STEP_SUMMARY}"
140+
141+
- name: Set Outputs
142+
id: set-outputs
143+
run: |
144+
FLAKY_COUNT="${{ steps.collect-flaky-tests.outputs.flaky-count }}"
145+
FLAKY_COUNT="${FLAKY_COUNT:-0}"
146+
echo "flaky-count=${FLAKY_COUNT}" >> "${GITHUB_OUTPUT}"
147+
148+
if [[ -f "flaky-issues.json" ]]; then
149+
# Use jq -c for compact JSON output suitable for workflow outputs
150+
FLAKY_JSON=$(jq -c '.' flaky-issues.json)
151+
echo "flaky-tests-json=${FLAKY_JSON}" >> "${GITHUB_OUTPUT}"
152+
153+
HAS_NEW=$(jq 'any(.is_new == true)' flaky-issues.json)
154+
echo "has-new-issues=${HAS_NEW}" >> "${GITHUB_OUTPUT}"
155+
else
156+
echo "flaky-tests-json=[]" >> "${GITHUB_OUTPUT}"
157+
echo "has-new-issues=false" >> "${GITHUB_OUTPUT}"
158+
fi

.github/workflows/flow-dry-run-extended-test-suite.yaml

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,7 @@ on:
6363
permissions:
6464
id-token: write
6565
actions: write
66+
issues: write
6667
pull-requests: write
6768
statuses: write
6869
checks: write
@@ -156,3 +157,14 @@ jobs:
156157
slack-api-token: ${{ secrets.PLATFORM_SLACK_API_TOKEN }}
157158
slack-citr-details-token: ${{ secrets.SLACK_CITR_DETAILED_REPORTS_WEBHOOK }}
158159
slack-tck-report-webhook: ${{ secrets.SLACK_TCK_MONITOR_WEBHOOK }}
160+
161+
report-flaky-tests:
162+
name: Report Flaky Tests
163+
needs:
164+
- xts-execution
165+
if: ${{ !cancelled() && always() }}
166+
uses: ./.github/workflows/800-call-report-flaky-test.yaml
167+
with:
168+
workflow-context: dry-run
169+
secrets:
170+
access-token: ${{ secrets.GITHUB_TOKEN }}

.github/workflows/flow-dry-run-mats-suite.yaml

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,7 @@ on:
6161
permissions:
6262
id-token: write
6363
actions: read
64+
issues: write
6465
pull-requests: write
6566
statuses: write
6667
checks: write
@@ -102,3 +103,14 @@ jobs:
102103
gradle-cache-username: ${{ secrets.GRADLE_CACHE_USERNAME }}
103104
gradle-cache-password: ${{ secrets.GRADLE_CACHE_PASSWORD }}
104105
snyk-token: ${{ secrets.SNYK_TOKEN }}
106+
107+
report-flaky-tests:
108+
name: Report Flaky Tests
109+
needs:
110+
- mats-tests
111+
if: ${{ !cancelled() && always() }}
112+
uses: ./.github/workflows/800-call-report-flaky-test.yaml
113+
with:
114+
workflow-context: dry-run
115+
secrets:
116+
access-token: ${{ secrets.GITHUB_TOKEN }}

0 commit comments

Comments
 (0)