Skip to content

Commit bf7ab92

Browse files
authored
Merge branch 'main' into fix/mm-card-zero-balance-assets
2 parents 08641d4 + e3a5282 commit bf7ab92

File tree

105 files changed

+6153
-2656
lines changed

Some content is hidden

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

105 files changed

+6153
-2656
lines changed

.eslintrc.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ module.exports = {
7777
},
7878
},
7979
{
80-
files: ['scripts/**/*.js', 'app.config.js'],
80+
files: ['scripts/**/*.js', 'e2e/tools/**/*.{js,ts}', 'app.config.js'],
8181
rules: {
8282
'no-console': 0,
8383
'import/no-commonjs': 0,

.github/actions/ai-e2e-analysis/action.yml

Lines changed: 0 additions & 151 deletions
This file was deleted.
Lines changed: 197 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,197 @@
1+
name: 'Smart E2E Selection'
2+
description: 'Run AI-powered E2E test selection based on code changes'
3+
inputs:
4+
event-name:
5+
description: 'GitHub event name (pull_request, workflow_dispatch, schedule, etc.)'
6+
required: true
7+
claude-api-key:
8+
description: 'Claude API key for AI analysis'
9+
required: true
10+
github-token:
11+
description: 'GitHub token for PR comments'
12+
required: true
13+
pr-number:
14+
description: 'Pull request number for commenting'
15+
required: true
16+
repository:
17+
description: 'Repository name (owner/repo) for commenting'
18+
required: true
19+
post-comment:
20+
description: 'Whether to post a comment to the PR'
21+
required: false
22+
default: 'false'
23+
24+
outputs:
25+
ai_e2e_test_tags:
26+
description: 'E2E test tags to run (JSON array format)'
27+
value: ${{ steps.ai-analysis.outputs.ai_e2e_test_tags }}
28+
ai_confidence:
29+
description: 'AI confidence score (0-100)'
30+
value: ${{ steps.ai-analysis.outputs.ai_confidence }}
31+
32+
runs:
33+
using: 'composite'
34+
steps:
35+
- name: Checkout for PR analysis
36+
uses: actions/checkout@v4
37+
with:
38+
fetch-depth: 1 # Shallow clone - only need PR commit
39+
40+
- name: Disable sparse checkout and restore all files
41+
shell: bash
42+
run: |
43+
git sparse-checkout disable
44+
git checkout HEAD -- .
45+
46+
- name: Fetch base branch for comparison
47+
shell: bash
48+
run: |
49+
# Fetch base branch with enough depth to compute merge base for git diff
50+
git fetch origin main --depth=100 2>/dev/null || git fetch origin master --depth=100 2>/dev/null || true
51+
52+
- name: Setup Node.js
53+
uses: actions/setup-node@v4
54+
with:
55+
node-version-file: '.nvmrc'
56+
57+
- name: Install minimal dependencies for AI analysis
58+
shell: bash
59+
run: |
60+
echo "📦 Installing only required packages for AI analysis..."
61+
# Install to a separate location that won't be overwritten
62+
mkdir -p /tmp/ai-deps
63+
cd /tmp/ai-deps
64+
npm init -y
65+
npm install @anthropic-ai/sdk@0.68.0 esbuild-register@3.6.0 --no-audit --no-fund
66+
echo "✅ AI analysis dependencies installed in /tmp/ai-deps"
67+
68+
- name: Copy AI dependencies to workspace
69+
shell: bash
70+
run: |
71+
echo "📋 Copying AI dependencies to workspace..."
72+
# Create node_modules if it doesn't exist
73+
mkdir -p node_modules
74+
# Copy our pre-installed dependencies
75+
cp -r /tmp/ai-deps/node_modules/* node_modules/
76+
echo "✅ AI dependencies available in workspace"
77+
78+
- name: Check skip-smart-e2e-selection label
79+
id: check-skip-label
80+
if: inputs.event-name == 'pull_request' && inputs.pr-number != ''
81+
shell: bash
82+
env:
83+
GH_TOKEN: ${{ inputs.github-token }}
84+
run: |
85+
echo "SKIP=false" >> "$GITHUB_OUTPUT"
86+
if gh pr view ${{ inputs.pr-number }} --repo ${{ inputs.repository }} --json labels --jq '.labels[].name' | grep -qx "skip-smart-e2e-selection"; then
87+
echo "SKIP=true" >> "$GITHUB_OUTPUT"
88+
echo "⏭️ SKIP=true due to 'skip-smart-e2e-selection' label on PR"
89+
fi
90+
91+
- name: Run E2E AI analysis
92+
id: ai-analysis
93+
shell: bash
94+
env:
95+
E2E_CLAUDE_API_KEY: ${{ inputs.claude-api-key }}
96+
EVENT_NAME: ${{ inputs.event-name }}
97+
PR_NUMBER: ${{ inputs.pr-number }}
98+
GH_TOKEN: ${{ inputs.github-token }}
99+
GITHUB_REPOSITORY: ${{ inputs.repository }}
100+
GITHUB_RUN_ID: ${{ github.run_id }}
101+
run: |
102+
echo "ai_e2e_test_tags=[\"ALL\"]" >> "$GITHUB_OUTPUT"
103+
echo "ai_confidence=0" >> "$GITHUB_OUTPUT"
104+
SHOULD_SKIP=false
105+
SKIP_REASON=""
106+
107+
if [[ "$EVENT_NAME" != "pull_request" ]]; then
108+
SHOULD_SKIP=true
109+
SKIP_REASON="only runs on PRs"
110+
elif [[ -n "${{ steps.check-skip-label.outputs.SKIP }}" ]] && [[ "${{ steps.check-skip-label.outputs.SKIP }}" == "true" ]]; then
111+
SHOULD_SKIP=true
112+
SKIP_REASON="skip-smart-e2e-selection label found"
113+
fi
114+
115+
if [[ "$SHOULD_SKIP" == "true" ]]; then
116+
echo "⏭️ Skipping AI analysis - $SKIP_REASON"
117+
else
118+
echo "✅ Running AI analysis for PR #$PR_NUMBER"
119+
# The script will generate the GH output variables
120+
node .github/scripts/e2e-smart-selection.mjs
121+
fi
122+
123+
- name: Display AI Analysis Outputs
124+
shell: bash
125+
run: |
126+
echo "📊 Final GitHub Action Outputs:"
127+
echo "================================"
128+
echo "ai_e2e_test_tags: ${{ steps.ai-analysis.outputs.ai_e2e_test_tags }}"
129+
echo "ai_confidence: ${{ steps.ai-analysis.outputs.ai_confidence }}"
130+
echo "================================"
131+
132+
- name: Delete previous comments
133+
if: inputs.post-comment == 'true' && inputs.pr-number != '' && inputs.github-token != ''
134+
shell: bash
135+
env:
136+
GH_TOKEN: ${{ inputs.github-token }}
137+
run: |
138+
echo "🗑️ Deleting all existing Smart E2E selection comments..."
139+
140+
# Get comment IDs using the HTML marker for precise identification
141+
ALL_COMMENT_IDS=$(gh api "repos/${{ inputs.repository }}/issues/${{ inputs.pr-number }}/comments" \
142+
--jq '.[] | select(.body | contains("<!-- smart-e2e-selection -->")) | .id')
143+
144+
COMMENT_COUNT=$(echo "$ALL_COMMENT_IDS" | wc -l | tr -d ' ')
145+
echo "📊 Found $COMMENT_COUNT comments"
146+
147+
if [ -n "$ALL_COMMENT_IDS" ] && [ "$COMMENT_COUNT" -gt 0 ]; then
148+
echo "🗑️ Deleting all $COMMENT_COUNT comments..."
149+
150+
echo "$ALL_COMMENT_IDS" | while read -r COMMENT_ID; do
151+
if [ -n "$COMMENT_ID" ]; then
152+
echo " Deleting comment: $COMMENT_ID"
153+
gh api "repos/${{ inputs.repository }}/issues/comments/$COMMENT_ID" \
154+
--method DELETE > /dev/null 2>&1 || echo " ⚠️ Failed to delete comment $COMMENT_ID"
155+
fi
156+
done
157+
echo "✨ Cleanup completed - deleted all $COMMENT_COUNT comments"
158+
else
159+
echo "📝 No Smart E2E selection comments found"
160+
fi
161+
162+
- name: Create PR comment
163+
if: inputs.post-comment == 'true' && inputs.pr-number != '' && inputs.github-token != ''
164+
shell: bash
165+
env:
166+
GH_TOKEN: ${{ inputs.github-token }}
167+
run: |
168+
# Comment configuration (single source of truth)
169+
COMMENT_FILE="pr_comment.md"
170+
TITLE="## 🔍 Smart E2E Test Selection"
171+
FOOTER="[View GitHub Actions results](https://github.com/${{ inputs.repository }}/actions/runs/${{ github.run_id }})"
172+
MARKER="<!-- smart-e2e-selection -->"
173+
COMMENT_BODY=""
174+
175+
if [[ "${{ steps.check-skip-label.outputs.SKIP }}" == "true" ]]; then
176+
COMMENT_BODY="⏭️ **Smart E2E selection disabled due to \`skip-smart-e2e-selection\` label**
177+
All E2E tests pre-selected."
178+
179+
else
180+
# Read analysis results from file
181+
if [ -f "$COMMENT_FILE" ]; then
182+
COMMENT_BODY=$(cat "$COMMENT_FILE")
183+
else
184+
echo "⚠️ PR comment file not found: $COMMENT_FILE - using default message"
185+
COMMENT_BODY="AI analysis completed but results file was not generated."
186+
fi
187+
fi
188+
189+
# Build and post comment
190+
FULL_COMMENT="${TITLE}
191+
${COMMENT_BODY}
192+
193+
${FOOTER}
194+
${MARKER}"
195+
196+
gh pr comment ${{ inputs.pr-number }} --repo ${{ inputs.repository }} --body "$FULL_COMMENT"
197+
echo "✅ Successfully created comment"

.github/guidelines/LABELING_GUIDELINES.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,11 @@ Using any of these labels should be exceptional in case of CI friction and urgen
2929

3030
- **skip-sonar-cloud**: The PR will be merged without running SonarCloud checks.
3131
- **skip-e2e**: The PR will be merged without running E2E tests.
32+
- **skip-e2e-quality-gate**: This label will disable the default test retries for E2E test files modified in a PR. Useful when making large refactors or when changes don't pose flakiness risk.
33+
34+
### Skip Smart E2E Selection
35+
36+
- **skip-smart-e2e-selection**: This label is used to bypass the Smart E2E Selection (select E2E tests to run depending on the PR changes). Useful when we do want all E2E tests to run for a given PR.
3237

3338
### Block merge if any is present
3439

0 commit comments

Comments
 (0)