Skip to content

Commit 0fd1a8f

Browse files
Copilotwachunei
andauthored
merge: resolve conflicts with main
Co-authored-by: wachunei <1024246+wachunei@users.noreply.github.com>
2 parents db8bfd6 + f8f8c8e commit 0fd1a8f

28 files changed

Lines changed: 793 additions & 118 deletions

.github/workflows/build-android-e2e.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ on:
3434
jobs:
3535
build-android-apks:
3636
name: Build Android E2E APKs
37-
runs-on: ${{ inputs.runner_provider == 'namespace' && 'namespace-profile-metamask-android-build' || 'ghcr.io/cirruslabs/ubuntu-runner-amd64:24.04-lg' }} # Optimized for lg runner (48GB) with conservative memory settings
37+
runs-on: ${{ inputs.runner_provider == 'namespace' && 'namespace-profile-metamask-android-build' || (startsWith(github.base_ref, 'release/') && fromJSON('["ghcr.io/cirruslabs/ubuntu-runner-amd64:24.04-lg"]') || fromJSON('["ghcr.io/cirruslabs/ubuntu-runner-amd64:24.04-lg", "low-priority"]')) }} # Optimized for lg runner (48GB) with conservative memory settings
3838
timeout-minutes: 40
3939
env:
4040
GRADLE_USER_HOME: ${{ inputs.runner_provider == 'namespace' && '/home/runner/_work/.gradle' || '/home/admin/_work/.gradle' }}

.github/workflows/build-ios-e2e.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ permissions:
3030
jobs:
3131
build-ios-apps:
3232
name: Build iOS E2E Apps
33-
runs-on: ${{ inputs.runner_provider == 'namespace' && 'namespace-profile-metamask-ios-build' || 'ghcr.io/cirruslabs/macos-runner:tahoe-xl' }}
33+
runs-on: ${{ inputs.runner_provider == 'namespace' && 'namespace-profile-metamask-ios-build' || (startsWith(github.base_ref, 'release/') && fromJSON('["ghcr.io/cirruslabs/macos-runner:tahoe-xl"]') || fromJSON('["ghcr.io/cirruslabs/macos-runner:tahoe-xl", "low-priority"]')) }}
3434
outputs:
3535
artifacts-url: ${{ steps.set-artifacts-url.outputs.artifacts-url }}
3636
app-uploaded: ${{ steps.upload-app.outcome == 'success' }}

.github/workflows/build.yml

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -190,6 +190,9 @@ jobs:
190190
# Android: Cirrus lg (large) runner for 8GB Gradle heap; iOS: Cirrus macOS Tahoe (has Xcode 26.x)
191191
runs-on: ${{ inputs.runner_provider == 'namespace' && (matrix.platform == 'ios' && 'namespace-profile-metamask-ios-build' || 'namespace-profile-metamask-android-build') || (matrix.platform == 'ios' && 'ghcr.io/cirruslabs/macos-runner:tahoe-xl' || 'ghcr.io/cirruslabs/ubuntu-runner-amd64:24.04-lg') }}
192192
environment: ${{ needs.prepare.outputs.github_environment }}
193+
env:
194+
GRADLE_USER_HOME: /home/admin/_work/.gradle
195+
CACHE_GENERATION: v1
193196
steps:
194197
- name: Validate version-bump commit
195198
if: ${{ !inputs.skip_version_bump }}
@@ -375,6 +378,29 @@ jobs:
375378
java-version: '17'
376379
distribution: 'temurin'
377380

381+
- name: Apply release Gradle config (Android)
382+
if: matrix.platform == 'android'
383+
run: cp android/gradle.properties.release android/gradle.properties
384+
385+
- name: Restore Gradle dependencies from branch cache (Android)
386+
if: matrix.platform == 'android'
387+
id: gradle-cache-restore
388+
uses: cirruslabs/cache@bba69c6578b863ad0398ad40567bd2ef70290fe0 # v4
389+
with:
390+
path: |
391+
~/_work/.gradle/caches
392+
~/_work/.gradle/wrapper
393+
key: gradle-release-${{ github.ref_name }}-${{ env.CACHE_GENERATION }}-${{ runner.os }}-${{ hashFiles('**/*.gradle*', '**/gradle-wrapper.properties') }}
394+
395+
- name: Restore Gradle dependencies from main cache (Android)
396+
if: matrix.platform == 'android' && steps.gradle-cache-restore.outputs.cache-hit != 'true' && github.ref_name != 'main'
397+
uses: cirruslabs/cache/restore@bba69c6578b863ad0398ad40567bd2ef70290fe0 # v4
398+
with:
399+
path: |
400+
~/_work/.gradle/caches
401+
~/_work/.gradle/wrapper
402+
key: gradle-release-main-${{ env.CACHE_GENERATION }}-${{ runner.os }}-${{ hashFiles('**/*.gradle*', '**/gradle-wrapper.properties') }}
403+
378404
# iOS: Clean up any existing keychains from previous runs
379405
- name: Clean up existing keychains
380406
if: matrix.platform == 'ios' && needs.prepare.outputs.signing_aws_role != ''

.github/workflows/run-e2e-workflow.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ on:
6363
jobs:
6464
test-e2e-mobile:
6565
name: ${{ inputs.test-suite-name }}
66-
runs-on: ${{ inputs.runner_provider == 'namespace' && (inputs.platform == 'ios' && 'namespace-profile-metamask-ios-e2e' || 'namespace-profile-metamask-android-build') || (inputs.platform == 'ios' && 'ghcr.io/cirruslabs/macos-runner:tahoe' || 'ghcr.io/cirruslabs/ubuntu-runner-amd64:24.04-lg') }}
66+
runs-on: ${{ inputs.runner_provider == 'namespace' && (inputs.platform == 'ios' && 'namespace-profile-metamask-ios-e2e' || 'namespace-profile-metamask-android-build') || (startsWith(github.base_ref, 'release/') && fromJSON(format('["{0}"]', inputs.platform == 'ios' && 'ghcr.io/cirruslabs/macos-runner:tahoe' || 'ghcr.io/cirruslabs/ubuntu-runner-amd64:24.04-lg')) || fromJSON(format('["{0}", "low-priority"]', inputs.platform == 'ios' && 'ghcr.io/cirruslabs/macos-runner:tahoe' || 'ghcr.io/cirruslabs/ubuntu-runner-amd64:24.04-lg'))) }}
6767
outputs:
6868
apk-target-path: ${{ steps.determine-target-paths.outputs.apk-target-path }}
6969
test-apk-target-path: ${{ steps.determine-target-paths.outputs.test-apk-target-path }}

.github/workflows/update-e2e-fixtures.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -180,7 +180,7 @@ jobs:
180180
update-fixtures:
181181
name: Export & update fixtures
182182
needs: [prepare]
183-
runs-on: ghcr.io/cirruslabs/macos-runner:tahoe
183+
runs-on: ${{ startsWith(github.base_ref, 'release/') && fromJSON('["ghcr.io/cirruslabs/macos-runner:tahoe"]') || fromJSON('["ghcr.io/cirruslabs/macos-runner:tahoe", "low-priority"]') }}
184184
timeout-minutes: 30
185185

186186
env:

android/gradle.properties.release

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
# Gradle settings for GitHub Actions release/production builds (LG runner, 48GB RAM)
2+
3+
# JVM: 8GB heap to leave room for Metro workers + Kotlin daemon
4+
org.gradle.jvmargs=-Xmx8g -XX:MaxMetaspaceSize=512m -XX:+UseG1GC -XX:G1HeapRegionSize=8m -XX:+UseStringDeduplication -XX:+OptimizeStringConcat -XX:+ExitOnOutOfMemoryError -XX:+HeapDumpOnOutOfMemoryError -Dfile.encoding=UTF-8
5+
6+
org.gradle.parallel=true
7+
org.gradle.configureondemand=true
8+
org.gradle.caching=true
9+
# Daemon disabled: ephemeral CI runners are destroyed after each job, so the daemon
10+
# provides zero warm-start benefit and unnecessarily locks JVM memory.
11+
org.gradle.daemon=false
12+
# 4 workers to reduce concurrent memory pressure on 48GB runner
13+
org.gradle.workers.max=4
14+
org.gradle.vfs.watch=false
15+
16+
kotlin.incremental=true
17+
kotlin.incremental.android=true
18+
kotlin.caching.enabled=true
19+
# Kotlin daemon: 2GB cap to prevent memory contention
20+
kotlin.daemon.jvmargs=-Xmx2g -XX:+UseG1GC -XX:+ExitOnOutOfMemoryError
21+
22+
# File system optimizations
23+
org.gradle.vfs.verbose=false
24+
org.gradle.welcome=NEVER
25+
26+
# AndroidX
27+
android.useAndroidX=true
28+
android.enableJetifier=true
29+
30+
# Enable AAPT2 PNG crunching
31+
android.enablePngCrunchInReleaseBuilds=true
32+
33+
# ALL architectures for Play Store distribution (differs from E2E which uses x86_64 only)
34+
reactNativeArchitectures=armeabi-v7a,arm64-v8a,x86,x86_64
35+
36+
# New Architecture + Hermes
37+
newArchEnabled=true
38+
hermesEnabled=true
39+
40+
android.disableResourceValidation=true
41+
42+
# Use legacy packaging to compress native libraries in the resulting APK.
43+
expo.useLegacyPackaging=false

app/components/UI/Rewards/components/Campaigns/CampaignLeaderboard.test.tsx

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,7 @@ jest.mock('./OndoCampaignStatsSummary', () => {
4141
});
4242

4343
const IDS = CAMPAIGN_LEADERBOARD_SHARED_TEST_IDS;
44+
const CrownIcon = 'CrownIcon' as unknown as React.ComponentType;
4445

4546
const baseEntry = {
4647
rank: 7,
@@ -68,6 +69,31 @@ describe('CampaignLeaderboardEntryRow', () => {
6869
expect(isPositivePrimaryMetric).toHaveBeenCalledWith(baseEntry);
6970
});
7071

72+
it('shows crown based only on showCrown', () => {
73+
const { UNSAFE_queryAllByType } = render(
74+
<CampaignLeaderboardEntryRow
75+
entry={baseEntry}
76+
showCrown
77+
formatPrimaryMetric={() => '+12.5%'}
78+
isPositivePrimaryMetric={() => true}
79+
/>,
80+
);
81+
82+
expect(UNSAFE_queryAllByType(CrownIcon)).toHaveLength(1);
83+
});
84+
85+
it('hides crown when showCrown is false', () => {
86+
const { UNSAFE_queryAllByType } = render(
87+
<CampaignLeaderboardEntryRow
88+
entry={{ ...baseEntry, rank: 1 }}
89+
formatPrimaryMetric={() => '+12.5%'}
90+
isPositivePrimaryMetric={() => true}
91+
/>,
92+
);
93+
94+
expect(UNSAFE_queryAllByType(CrownIcon)).toHaveLength(0);
95+
});
96+
7197
it('sets row testID from shared ENTRY_ROW and rank', () => {
7298
const { getByTestId } = render(
7399
<CampaignLeaderboardEntryRow

app/components/UI/Rewards/components/Campaigns/CampaignLeaderboard.tsx

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -92,9 +92,7 @@ export function CampaignLeaderboardEntryRow<
9292
>
9393
{entry.referralCode}
9494
</Text>
95-
{showCrown && entry.rank <= 5 && (
96-
<CrownIcon name="crown" width={14} height={14} />
97-
)}
95+
{showCrown && <CrownIcon name="crown" width={14} height={14} />}
9896
</Box>
9997
{showPendingTag && (
10098
<PendingTag

app/components/UI/Rewards/components/Campaigns/OndoLeaderboard.test.tsx

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ import OndoLeaderboard, {
44
CAMPAIGN_LEADERBOARD_TEST_IDS,
55
} from './OndoLeaderboard';
66
import type { CampaignLeaderboardEntry } from '../../../../../core/Engine/controllers/rewards-controller/types';
7+
import { ONDO_GM_TIER_MAX_WINNERS } from '../../utils/ondoCampaignConstants';
78
import { useAnalytics } from '../../../../hooks/useAnalytics/useAnalytics';
89
import {
910
createMockUseAnalyticsHook,
@@ -32,6 +33,8 @@ jest.mock('@metamask/design-system-twrnc-preset', () => {
3233
return { useTailwind: () => tw };
3334
});
3435

36+
jest.mock('../../../../../images/rewards/crown.svg', () => 'CrownIcon');
37+
3538
jest.mock('../RewardsErrorBanner', () => {
3639
const ReactActual = jest.requireActual('react');
3740
const { View, Text, Pressable } = jest.requireActual('react-native');
@@ -89,6 +92,8 @@ jest.mock('../../../../../../locales/i18n', () => ({
8992
},
9093
}));
9194

95+
const CrownIcon = 'CrownIcon' as unknown as React.ComponentType;
96+
9297
const createMockEntry = (
9398
overrides: Partial<CampaignLeaderboardEntry> = {},
9499
): CampaignLeaderboardEntry => ({
@@ -337,6 +342,40 @@ describe('OndoLeaderboard', () => {
337342

338343
expect(getByText('No entries in this tier')).toBeDefined();
339344
});
345+
346+
it('shows crown in full view for Ondo winner ranks only', () => {
347+
const entries = [
348+
createMockEntry({
349+
rank: ONDO_GM_TIER_MAX_WINNERS,
350+
referralCode: 'WINNER',
351+
}),
352+
createMockEntry({
353+
rank: ONDO_GM_TIER_MAX_WINNERS + 1,
354+
referralCode: 'NEXT',
355+
}),
356+
];
357+
const { UNSAFE_queryAllByType } = render(
358+
<OndoLeaderboard {...defaultProps} entries={entries} />,
359+
);
360+
361+
expect(UNSAFE_queryAllByType(CrownIcon)).toHaveLength(1);
362+
});
363+
364+
it('hides crown in preview mode for Ondo winner ranks', () => {
365+
const entries = [
366+
createMockEntry({ rank: 1, referralCode: 'AAA111' }),
367+
createMockEntry({ rank: 2, referralCode: 'BBB222' }),
368+
];
369+
const { UNSAFE_queryAllByType } = render(
370+
<OndoLeaderboard
371+
{...defaultProps}
372+
entries={entries}
373+
maxEntries={entries.length}
374+
/>,
375+
);
376+
377+
expect(UNSAFE_queryAllByType(CrownIcon)).toHaveLength(0);
378+
});
340379
});
341380

342381
describe('currentUserReferralCode highlighting', () => {

app/components/UI/Rewards/components/Campaigns/OndoLeaderboard.tsx

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ import {
2727
formatRateOfReturn,
2828
formatTierDisplayName,
2929
} from './OndoLeaderboard.utils';
30+
import { ONDO_GM_TIER_MAX_WINNERS } from '../../utils/ondoCampaignConstants';
3031

3132
export const CAMPAIGN_LEADERBOARD_TEST_IDS = {
3233
CONTAINER: 'campaign-leaderboard-container',
@@ -275,7 +276,7 @@ const OndoLeaderboard: React.FC<CampaignLeaderboardProps> = ({
275276
key={`${entry.rank}-${entry.referralCode}`}
276277
entry={entry}
277278
isCurrentUser={isCurrentUser(entry)}
278-
showCrown={!isPreview}
279+
showCrown={!isPreview && entry.rank <= ONDO_GM_TIER_MAX_WINNERS}
279280
isCampaignComplete={isCampaignComplete}
280281
formatPrimaryMetric={(e) => formatRateOfReturn(e.rateOfReturn)}
281282
isPositivePrimaryMetric={(e) => e.rateOfReturn >= 0}
@@ -289,7 +290,9 @@ const OndoLeaderboard: React.FC<CampaignLeaderboardProps> = ({
289290
key={`neighbor-${entry.rank}-${entry.referralCode}`}
290291
entry={entry}
291292
isCurrentUser={isCurrentUser(entry)}
292-
showCrown={!isPreview}
293+
showCrown={
294+
!isPreview && entry.rank <= ONDO_GM_TIER_MAX_WINNERS
295+
}
293296
isCampaignComplete={isCampaignComplete}
294297
formatPrimaryMetric={(e) =>
295298
formatRateOfReturn(e.rateOfReturn)

0 commit comments

Comments
 (0)