Skip to content

Commit af1f56e

Browse files
authored
Merge branch 'main' into PRED-865-filter-out-more-markets-events-from-the-feed
2 parents 30386b4 + e6caa4c commit af1f56e

199 files changed

Lines changed: 6721 additions & 2107 deletions

File tree

Some content is hidden

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

.github/CODEOWNERS

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -206,7 +206,7 @@ app/components/Views/Homepage/Sections/Perpetuals/ @MetaMask/perps
206206
# Social & AI Team
207207
app/components/Views/SocialLeaderboard/ @MetaMask/social-ai
208208
app/components/UI/MarketInsights/ @MetaMask/social-ai
209-
app/components/Views/Homepage/Sections/WhatsHappening/ @MetaMask/social-ai
209+
app/components/UI/WhatsHappening/ @MetaMask/social-ai
210210
app/components/Views/Homepage/Sections/TopTraders/ @MetaMask/social-ai
211211
app/core/Engine/controllers/social-controller-init* @MetaMask/social-ai
212212
app/core/Engine/controllers/social-service-init* @MetaMask/social-ai

.github/actions/setup-e2e-env/action.yml

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -161,9 +161,9 @@ runs:
161161
sudo chown -R "$(id -u):$(id -g)" "$CACHE_PATH" /opt/android-sdk/.temp
162162
shell: bash
163163

164-
# Restore exact system image from cache
164+
# Restore exact system image from cache (GitHub only — Namespace uses nscloud-cache-action in callers)
165165
- name: Restore Android system image from cache
166-
if: ${{ inputs.platform == 'android' && inputs.setup-simulator == 'true' }}
166+
if: ${{ inputs.platform == 'android' && inputs.setup-simulator == 'true' && inputs.runner_provider != 'namespace' }}
167167
id: android-system-image-cache
168168
uses: actions/cache/restore@v4
169169
with:
@@ -215,6 +215,7 @@ runs:
215215
${{
216216
inputs.platform == 'android' &&
217217
inputs.setup-simulator == 'true' &&
218+
inputs.runner_provider != 'namespace' &&
218219
steps.android-system-image-cache.outputs.cache-hit != 'true' &&
219220
github.event_name != 'pull_request' &&
220221
github.event_name != 'pull_request_target' &&
@@ -295,6 +296,7 @@ runs:
295296
command: ${{ steps.get-corepack-command.outputs.COREPACK_COMMAND }}
296297

297298
- name: Restore Yarn cache
299+
if: ${{ inputs.runner_provider != 'namespace' }}
298300
uses: actions/cache@v4
299301
with:
300302
path: |
@@ -342,7 +344,7 @@ runs:
342344
shell: bash
343345

344346
- name: Restore Bundler cache
345-
if: ${{ inputs.platform == 'ios' }}
347+
if: ${{ inputs.platform == 'ios' && inputs.runner_provider != 'namespace' }}
346348
uses: actions/cache@v4
347349
with:
348350
path: ios/vendor/bundle
@@ -399,7 +401,7 @@ runs:
399401
shell: bash
400402

401403
- name: Restore CocoaPods specs cache
402-
if: ${{ inputs.platform == 'ios' }}
404+
if: ${{ inputs.platform == 'ios' && inputs.runner_provider != 'namespace' }}
403405
id: cocoapods-specs-cache
404406
uses: actions/cache@v4
405407
with:

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

Lines changed: 94 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,13 +64,29 @@ jobs:
6464
if: ${{ inputs.runner_provider == 'namespace' }}
6565
uses: namespacelabs/nscloud-cache-action@15799a6b54e5765f85b2aac25b3f0df43ed571c0 # v1
6666
with:
67+
cache: |
68+
gradle
69+
maven
6770
path: |
6871
~/.cache/yarn
6972
.metamask
7073
node_modules
7174
.yarn/cache
7275
${{ env.GRADLE_USER_HOME }}/caches
7376
${{ env.GRADLE_USER_HOME }}/wrapper
77+
${{ env.GRADLE_USER_HOME }}/apk-cache
78+
79+
- name: Configure Gradle remote build cache
80+
if: ${{ inputs.runner_provider == 'namespace' }}
81+
run: |
82+
mkdir -p "$GRADLE_USER_HOME/init.d"
83+
REF="${GITHUB_REF_NAME}"
84+
PUSH=true
85+
if [[ "$REF" != "main" && "$REF" != release/* && "$REF" != stable/* ]]; then
86+
PUSH=false
87+
fi
88+
nsc cache gradle setup --push="$PUSH" --init-gradle "$GRADLE_USER_HOME/init.d/namespace-cache.init.gradle"
89+
echo "Gradle remote build cache configured (push=$PUSH) at $GRADLE_USER_HOME/init.d/namespace-cache.init.gradle"
7490
7591
- name: Report source fingerprint
7692
run: |
@@ -102,6 +118,50 @@ jobs:
102118
exit 1
103119
fi
104120
121+
- name: Check Namespace E2E APK cache
122+
id: namespace-apk-cache
123+
if: ${{ inputs.runner_provider == 'namespace' && steps.force-builds.outputs.force != 'true' && inputs.source-fingerprint != '' }}
124+
shell: bash
125+
env:
126+
APK_TARGET: ${{ steps.determine-target-paths.outputs.apk-target-path }}
127+
TEST_APK_TARGET: ${{ steps.determine-target-paths.outputs.test-apk-target-path }}
128+
ARTIFACT_NAME: ${{ steps.determine-target-paths.outputs.artifact_name }}
129+
FINGERPRINT: ${{ inputs.source-fingerprint }}
130+
CACHE_GENERATION: ${{ env.CACHE_GENERATION }}
131+
GRADLE_FILES_HASH: ${{ hashFiles('**/*.gradle*', '**/gradle-wrapper.properties') }}
132+
REF_NAME: ${{ github.ref_name }}
133+
BUILD_TYPE: ${{ inputs.build_type }}
134+
run: |
135+
MARKER="${GRADLE_USER_HOME}/apk-cache/.e2e-apk-cache-marker"
136+
APK_CACHED="${GRADLE_USER_HOME}/apk-cache/${ARTIFACT_NAME}.apk"
137+
TEST_APK_CACHED="${GRADLE_USER_HOME}/apk-cache/${ARTIFACT_NAME}-androidTest.apk"
138+
EXPECTED="${REF_NAME}"$'\n'"${BUILD_TYPE}"$'\n'"${CACHE_GENERATION}"$'\n'"${FINGERPRINT}"$'\n'"${GRADLE_FILES_HASH}"
139+
echo "--- Debug: APK cache marker diagnostics ---"
140+
echo "MARKER=$MARKER"
141+
echo "APK_CACHED=$APK_CACHED"
142+
echo "TEST_APK_CACHED=$TEST_APK_CACHED"
143+
echo "marker exists: $([[ -f "${MARKER}" ]] && echo yes || echo NO)"
144+
echo "apk exists: $([[ -f "${APK_CACHED}" ]] && echo yes || echo NO)"
145+
echo "test-apk exists: $([[ -f "${TEST_APK_CACHED}" ]] && echo yes || echo NO)"
146+
ls -la "${GRADLE_USER_HOME}/apk-cache/" 2>&1 || echo "apk-cache dir not found"
147+
if [[ -f "${MARKER}" ]]; then
148+
echo "--- marker contents ---"
149+
cat "${MARKER}"
150+
echo "--- expected ---"
151+
echo "${EXPECTED}"
152+
echo "--- match: $([[ "$(<"${MARKER}")" == "${EXPECTED}" ]] && echo YES || echo NO) ---"
153+
fi
154+
if [[ -f "${MARKER}" ]] && [[ -f "${APK_CACHED}" ]] && [[ -f "${TEST_APK_CACHED}" ]] && [[ "$(<"${MARKER}")" == "${EXPECTED}" ]]; then
155+
echo "cache-hit=true" >> "${GITHUB_OUTPUT}"
156+
echo "Namespace APK cache hit — restoring APKs to build output dirs."
157+
mkdir -p "${APK_TARGET}" "${TEST_APK_TARGET}"
158+
cp "${APK_CACHED}" "${APK_TARGET}/"
159+
cp "${TEST_APK_CACHED}" "${TEST_APK_TARGET}/"
160+
else
161+
echo "cache-hit=false" >> "${GITHUB_OUTPUT}"
162+
echo "Namespace APK cache miss — full build required."
163+
fi
164+
105165
- name: Find reusable build from prior run
106166
id: find-reusable-build
107167
if: ${{ inputs.runner_provider != 'namespace' && steps.force-builds.outputs.force != 'true' && inputs.source-fingerprint != '' }}
@@ -167,7 +227,10 @@ jobs:
167227
- name: Compute native-build gate
168228
id: gate
169229
run: |
170-
if [[ "${{ steps.find-reusable-build.outputs.found }}" == "true" \
230+
if [[ "${{ steps.namespace-apk-cache.outputs.cache-hit }}" == "true" ]]; then
231+
echo "needs-native-build=false" >> "$GITHUB_OUTPUT"
232+
echo "Namespace APK cache hit; heavy Android setup + Gradle restore will be skipped."
233+
elif [[ "${{ steps.find-reusable-build.outputs.found }}" == "true" \
171234
&& "${{ steps.download-reusable-apk.outcome }}" == "success" \
172235
&& "${{ steps.download-reusable-test-apk.outcome }}" == "success" ]]; then
173236
echo "needs-native-build=false" >> "$GITHUB_OUTPUT"
@@ -266,6 +329,14 @@ jobs:
266329
# sibling "Restore Gradle dependencies from branch cache" step above.
267330
key: gradle-main-${{ env.GRADLE_CACHE_VERSION }}-${{ runner.os }}-${{ hashFiles('**/*.gradle*', '**/gradle-wrapper.properties') }}
268331

332+
- name: Configure Namespace Gradle remote cache
333+
id: namespace-gradle-cache
334+
if: ${{ inputs.runner_provider == 'namespace' && steps.gate.outputs.needs-native-build == 'true' }}
335+
run: |
336+
nsc cache gradle setup --init-gradle "$RUNNER_TEMP/namespace-gradle-init.gradle"
337+
echo "init-script=$RUNNER_TEMP/namespace-gradle-init.gradle" >> "$GITHUB_OUTPUT"
338+
shell: bash
339+
269340
- name: Build Android E2E APKs
270341
if: ${{ steps.gate.outputs.needs-native-build == 'true' }}
271342
run: |
@@ -283,6 +354,7 @@ jobs:
283354
IGNORE_BOXLOGS_DEVELOPMENT: true
284355
GITHUB_CI: 'true'
285356
CI: 'true'
357+
GRADLE_INIT_SCRIPT: ${{ steps.namespace-gradle-cache.outputs.init-script }}
286358
NODE_OPTIONS: '--max-old-space-size=4096'
287359
# Limit Metro workers to prevent OOM (each worker uses ~3GB)
288360
METRO_MAX_WORKERS: '4'
@@ -315,6 +387,27 @@ jobs:
315387
MM_INFURA_PROJECT_ID: ${{ secrets.MM_INFURA_PROJECT_ID }}
316388
MM_PREDICT_GTM_MODAL_ENABLED: 'false'
317389

390+
- name: Record Namespace E2E APK cache marker
391+
if: ${{ inputs.runner_provider == 'namespace' && steps.gate.outputs.needs-native-build == 'true' && inputs.source-fingerprint != '' }}
392+
shell: bash
393+
env:
394+
APK_SOURCE: ${{ steps.determine-target-paths.outputs.apk-target-path }}/${{ steps.determine-target-paths.outputs.artifact_name }}.apk
395+
TEST_APK_SOURCE: ${{ steps.determine-target-paths.outputs.test-apk-target-path }}/${{ steps.determine-target-paths.outputs.artifact_name }}-androidTest.apk
396+
ARTIFACT_NAME: ${{ steps.determine-target-paths.outputs.artifact_name }}
397+
FINGERPRINT: ${{ inputs.source-fingerprint }}
398+
CACHE_GENERATION: ${{ env.CACHE_GENERATION }}
399+
GRADLE_FILES_HASH: ${{ hashFiles('**/*.gradle*', '**/gradle-wrapper.properties') }}
400+
REF_NAME: ${{ github.ref_name }}
401+
BUILD_TYPE: ${{ inputs.build_type }}
402+
run: |
403+
CACHE_DIR="${GRADLE_USER_HOME}/apk-cache"
404+
mkdir -p "${CACHE_DIR}"
405+
cp "${APK_SOURCE}" "${CACHE_DIR}/${ARTIFACT_NAME}.apk"
406+
cp "${TEST_APK_SOURCE}" "${CACHE_DIR}/${ARTIFACT_NAME}-androidTest.apk"
407+
EXPECTED="${REF_NAME}"$'\n'"${BUILD_TYPE}"$'\n'"${CACHE_GENERATION}"$'\n'"${FINGERPRINT}"$'\n'"${GRADLE_FILES_HASH}"
408+
printf '%s\n' "${EXPECTED}" > "${CACHE_DIR}/.e2e-apk-cache-marker"
409+
echo "Namespace APK cache marker + APKs written to ${CACHE_DIR}."
410+
318411
- name: Repack APK with JS updates using @expo/repack-app
319412
if: ${{ steps.gate.outputs.needs-native-build != 'true' }}
320413
run: |

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

Lines changed: 16 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -78,6 +78,18 @@ jobs:
7878
- name: Checkout repo
7979
uses: actions/checkout@v6
8080

81+
- name: Configure Namespace cache
82+
if: ${{ inputs.runner_provider == 'namespace' }}
83+
uses: namespacelabs/nscloud-cache-action@15799a6b54e5765f85b2aac25b3f0df43ed571c0 # v1
84+
with:
85+
cache: |
86+
cocoapods
87+
xcode
88+
path: |
89+
~/.cache/yarn
90+
.metamask
91+
.yarn/cache
92+
8193
- name: Check force-builds override
8294
id: force-builds
8395
uses: ./.github/actions/check-force-builds
@@ -145,7 +157,7 @@ jobs:
145157

146158
- name: Restore Xcode derived data from branch cache
147159
id: xcode-restore-cache
148-
if: ${{ steps.gate.outputs.needs-native-build == 'true' && inputs.runner_provider != 'namespace' }}
160+
if: ${{ inputs.runner_provider != 'namespace' && steps.gate.outputs.needs-native-build == 'true' }}
149161
# This action automatically updates the cache at the end of the workflow
150162
uses: cirruslabs/cache@bba69c6578b863ad0398ad40567bd2ef70290fe0 # v4
151163
with:
@@ -155,9 +167,8 @@ jobs:
155167
key: ${{ runner.os }}-xcode-${{ github.ref_name }}-${{ env.XCODE_CACHE_VERSION }}-${{ hashFiles('ios/**/*.{h,m,mm,swift}', 'ios/**/Podfile.lock', 'yarn.lock') }}
156168

157169
- name: Restore Xcode derived data from main cache
158-
if: ${{ steps.gate.outputs.needs-native-build == 'true' && steps.xcode-restore-cache.outputs.cache-hit != 'true' && github.ref_name != 'main' && inputs.runner_provider != 'namespace' }}
170+
if: ${{ inputs.runner_provider != 'namespace' && steps.gate.outputs.needs-native-build == 'true' && steps.xcode-restore-cache.outputs.cache-hit != 'true' && github.ref_name != 'main' }}
159171
id: xcode-restore-cache-main
160-
# This will only restore the cache, not update it
161172
uses: cirruslabs/cache/restore@bba69c6578b863ad0398ad40567bd2ef70290fe0 # v4
162173
with:
163174
path: |
@@ -205,7 +216,7 @@ jobs:
205216
run: find ios -name "*.plist" -exec xattr -c {} \;
206217

207218
- name: Restore .metamask folder
208-
if: ${{ steps.gate.outputs.needs-native-build == 'true' }}
219+
if: ${{ inputs.runner_provider != 'namespace' && steps.gate.outputs.needs-native-build == 'true' }}
209220
id: restore-metamask
210221
uses: actions/cache@v4
211222
with:
@@ -258,7 +269,7 @@ jobs:
258269
YARN_ENABLE_GLOBAL_CACHE: 'true'
259270

260271
- name: Restore .metamask folder (reuse-hit path)
261-
if: ${{ steps.gate.outputs.needs-native-build != 'true' }}
272+
if: ${{ inputs.runner_provider != 'namespace' && steps.gate.outputs.needs-native-build != 'true' }}
262273
id: restore-metamask-lean
263274
uses: actions/cache@v4
264275
with:

.github/workflows/ci.yml

Lines changed: 15 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -96,10 +96,14 @@ jobs:
9696
outputs:
9797
fingerprint: ${{ steps.publish.outputs.fingerprint }}
9898
steps:
99-
- uses: actions/checkout@v4
100-
with:
101-
ref: ${{ github.event.pull_request.head.sha || github.sha }}
102-
- uses: actions/setup-node@v4
99+
# Use the default ref (refs/pull/N/merge on pull_request, github.sha otherwise) so the
100+
# fingerprint is computed against the SAME working tree that `build-android-e2e.yml`,
101+
# `build-ios-e2e.yml`, and `run-e2e-workflow.yml` check out and build/test against.
102+
# Posting on `pull_request.head.sha` while fingerprinting the PR head tree would let
103+
# two PRs with identical heads but different merges collide on the cache key — and the
104+
# native build then runs against a different (merge) tree than the one we fingerprinted.
105+
- uses: actions/checkout@v6
106+
- uses: actions/setup-node@v6
103107
with:
104108
node-version-file: '.nvmrc'
105109
cache: yarn
@@ -115,8 +119,11 @@ jobs:
115119
uses: ./.github/actions/post-build-source-hash
116120
with:
117121
github-token: ${{ github.token }}
118-
# .head.sha = PR head (pull_request events); github.sha fallback = pushed/scheduled commit
119-
# (push to main, merge_group, schedule) where no PR payload exists.
122+
# Commit statuses must be posted on a real commit SHA (not the merge ref).
123+
# `find-reusable-build` looks up the status via `run.head_sha` from
124+
# `listWorkflowRuns`, which GitHub reports as the PR head SHA for pull_request
125+
# events and as the pushed/scheduled commit SHA otherwise — so this is the same
126+
# SHA the lookup queries against.
120127
target-sha: ${{ github.event.pull_request.head.sha || github.sha }}
121128

122129
dedupe:
@@ -564,7 +571,8 @@ jobs:
564571
run: mkdir -p tests/results
565572
# The "10" in this command is the total number of shards. It must be kept
566573
# in sync with the length of matrix.shard
567-
- run: yarn test:unit --shard=${{ matrix.shard }}/10 --forceExit --silent --coverageReporters=json --json --outputFile=tests/results/unit-test-results-${{ matrix.shard }}.json
574+
# Namespace Linux: cap Jest workers to reduce cgroup OOM SIGKILL without tuning heap.
575+
- run: yarn test:unit --shard=${{ matrix.shard }}/10${{ inputs.runner_provider == 'namespace' && ' --maxWorkers=50%' || '' }} --forceExit --silent --coverageReporters=json --json --outputFile=tests/results/unit-test-results-${{ matrix.shard }}.json
568576
env:
569577
NODE_OPTIONS: ${{ inputs.runner_provider == 'namespace' && '--max_old_space_size=12288' || '--max_old_space_size=20480' }}
570578
- name: Rename coverage report and extract test count for this shard

.github/workflows/release-branch-sync.yml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -23,11 +23,11 @@ jobs:
2323
env:
2424
BRANCH: ${{ github.event.pull_request.head.ref }}
2525
run: |
26-
if [[ "$BRANCH" =~ ^release/[0-9]+\.[0-9]+\.[0-9]+$ ]]; then
27-
echo "Branch '$BRANCH' matches release/X.Y.Z format"
26+
if [[ "$BRANCH" =~ ^release/[0-9]+\.[0-9]+\.[0-9]+ ]]; then
27+
echo "Branch '$BRANCH' starts with release/X.Y.Z"
2828
echo "is-valid=true" >> "$GITHUB_OUTPUT"
2929
else
30-
echo "Branch '$BRANCH' does not match release/X.Y.Z format. Skipping."
30+
echo "Branch '$BRANCH' does not start with release/X.Y.Z. Skipping."
3131
echo "is-valid=false" >> "$GITHUB_OUTPUT"
3232
fi
3333
@@ -38,7 +38,7 @@ jobs:
3838
runs-on: ubuntu-latest
3939
steps:
4040
- name: Sync release branches with stable
41-
uses: metamask/github-tools/.github/actions/release-branch-sync@v1.2.0
41+
uses: metamask/github-tools/.github/actions/release-branch-sync@v1
4242
with:
4343
merged-release-branch: ${{ github.event.pull_request.head.ref }}
4444
github-token: ${{ secrets.STABLE_SYNC_TOKEN }}

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

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,36 @@ jobs:
103103
- name: Checkout
104104
uses: actions/checkout@v6
105105

106+
- name: Configure Namespace cache (Android)
107+
if: ${{ inputs.runner_provider == 'namespace' && inputs.platform == 'android' }}
108+
uses: namespacelabs/nscloud-cache-action@15799a6b54e5765f85b2aac25b3f0df43ed571c0 # v1
109+
with:
110+
cache: |
111+
gradle
112+
maven
113+
path: |
114+
~/.cache/yarn
115+
.metamask
116+
node_modules
117+
.yarn/cache
118+
/home/runner/_work/.gradle/caches
119+
/home/runner/_work/.gradle/wrapper
120+
/home/runner/_work/.gradle/apk-cache
121+
122+
- name: Configure Namespace cache (iOS)
123+
if: ${{ inputs.runner_provider == 'namespace' && inputs.platform == 'ios' }}
124+
uses: namespacelabs/nscloud-cache-action@15799a6b54e5765f85b2aac25b3f0df43ed571c0 # v1
125+
with:
126+
cache: |
127+
cocoapods
128+
path: |
129+
~/.cache/yarn
130+
.metamask
131+
.yarn/cache
132+
~/Library/Detox
133+
106134
- name: Restore .metamask folder
135+
if: ${{ inputs.runner_provider != 'namespace' }}
107136
uses: actions/cache@v4
108137
with:
109138
path: .metamask

0 commit comments

Comments
 (0)