2525 required : false
2626 default : ' qa'
2727 type : string
28+ runner_provider :
29+ description : Runner provider forwarded from the caller
30+ required : false
31+ type : string
32+ default : current
2833
2934jobs :
3035 build-android-apks :
3136 name : Build Android E2E APKs
32- runs-on : 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' || ' ghcr.io/cirruslabs/ubuntu-runner-amd64:24.04-lg' }} # Optimized for lg runner (48GB) with conservative memory settings
3338 timeout-minutes : 40
3439 env :
35- GRADLE_USER_HOME : /home/admin/_work/.gradle
40+ GRADLE_USER_HOME : ${{ inputs.runner_provider == 'namespace' && ' /home/runner/_work/.gradle' || '/home/ admin/_work/.gradle' }}
3641 CACHE_GENERATION : v1 # Increment this to bust the cache (v1, v2, v3, etc.)
3742 YARN_ENABLE_GLOBAL_CACHE : ' true' # Enable Yarn global cache for faster installs
3843 outputs :
4550 - name : Checkout repo
4651 uses : actions/checkout@v6
4752
53+ - name : Configure Namespace cache
54+ if : ${{ inputs.runner_provider == 'namespace' }}
55+ uses : namespacelabs/nscloud-cache-action@15799a6b54e5765f85b2aac25b3f0df43ed571c0 # v1
56+ with :
57+ path : |
58+ ~/.cache/yarn
59+ .metamask
60+ node_modules
61+ .yarn/cache
62+ ${{ env.GRADLE_USER_HOME }}/caches
63+ ${{ env.GRADLE_USER_HOME }}/wrapper
64+
4865 - name : Restore .metamask folder (Foundry download cache for install:foundryup)
66+ if : ${{ inputs.runner_provider != 'namespace' }}
4967 uses : actions/cache@v4
5068 with :
5169 path : .metamask
@@ -100,6 +118,7 @@ jobs:
100118 fi
101119
102120 - name : Restore APKs matching fingerprint from branch cache
121+ if : ${{ inputs.runner_provider != 'namespace' }}
103122 id : apk-cache-restore
104123 # This action automatically updates the cache at the end of the workflow
105124 uses : cirruslabs/cache@bba69c6578b863ad0398ad40567bd2ef70290fe0 # v4
@@ -116,7 +135,7 @@ jobs:
116135 key : android-apk-${{ github.ref_name }}-${{ inputs.build_type }}-${{ env.CACHE_GENERATION }}-${{ steps.generate-fingerprint.outputs.fingerprint }}-${{ hashFiles('**/*.gradle*', '**/gradle-wrapper.properties') }}
117136
118137 - name : Restore APKs matching fingerprint from main cache
119- if : ${{ steps.apk-cache-restore.outputs.cache-hit != 'true' && github.ref_name != 'main' }}
138+ if : ${{ inputs.runner_provider != 'namespace' && steps.apk-cache-restore.outputs.cache-hit != 'true' && github.ref_name != 'main' }}
120139 id : apk-cache-restore-main
121140 # This will only restore the cache, not update it
122141 uses : cirruslabs/cache/restore@bba69c6578b863ad0398ad40567bd2ef70290fe0 # v4
@@ -136,7 +155,7 @@ jobs:
136155 id : gradle-cache-restore
137156 # This action automatically updates the cache at the end of the workflow
138157 uses : cirruslabs/cache@bba69c6578b863ad0398ad40567bd2ef70290fe0 # v4
139- if : ${{ steps.apk-cache-restore.outputs.cache-hit != 'true' && steps.apk-cache-restore-main.outputs.cache-hit != 'true' }}
158+ if : ${{ inputs.runner_provider != 'namespace' && steps.apk-cache-restore.outputs.cache-hit != 'true' && steps.apk-cache-restore-main.outputs.cache-hit != 'true' }}
140159 env :
141160 GRADLE_CACHE_VERSION : 1
142161 with :
@@ -154,7 +173,7 @@ jobs:
154173 - name : Restore Gradle dependencies from main cache
155174 # This will only restore the cache, not update it
156175 uses : cirruslabs/cache/restore@bba69c6578b863ad0398ad40567bd2ef70290fe0 # v4
157- if : ${{ steps.apk-cache-restore.outputs.cache-hit != 'true' && steps.apk-cache-restore-main.outputs.cache-hit != 'true' && steps.gradle-cache-restore.outputs.cache-hit != 'true' && github.ref_name != 'main' }}
176+ if : ${{ inputs.runner_provider != 'namespace' && steps.apk-cache-restore.outputs.cache-hit != 'true' && steps.apk-cache-restore-main.outputs.cache-hit != 'true' && steps.gradle-cache-restore.outputs.cache-hit != 'true' && github.ref_name != 'main' }}
158177 env :
159178 GRADLE_CACHE_VERSION : 1
160179 with :
@@ -170,7 +189,7 @@ jobs:
170189 key : gradle-main-${{ env.GRADLE_CACHE_VERSION }}-${{ runner.os }}-${{ hashFiles('**/*.gradle*', '**/gradle-wrapper.properties') }}
171190
172191 - name : Build Android E2E APKs
173- if : ${{ steps.apk-cache-restore.outputs.cache-hit != 'true' && steps.apk-cache-restore-main.outputs.cache-hit != 'true' }}
192+ if : ${{ inputs.runner_provider == 'namespace' || ( steps.apk-cache-restore.outputs.cache-hit != 'true' && steps.apk-cache-restore-main.outputs.cache-hit != 'true') }}
174193 run : |
175194 echo "🏗 Building Android E2E APKs..."
176195 export NODE_OPTIONS="--max-old-space-size=4096"
@@ -213,7 +232,7 @@ jobs:
213232 MM_PREDICT_GTM_MODAL_ENABLED : ' false'
214233
215234 - name : Repack APK with JS updates using @expo/repack-app
216- if : ${{ steps.apk-cache-restore.outputs.cache-hit == 'true' || steps.apk-cache-restore-main.outputs.cache-hit == 'true' }}
235+ if : ${{ inputs.runner_provider != 'namespace' && ( steps.apk-cache-restore.outputs.cache-hit == 'true' || steps.apk-cache-restore-main.outputs.cache-hit == 'true') }}
217236 run : |
218237 echo "📦 Repacking APK with updated JavaScript bundle using @expo/repack-app..."
219238 # Use the optimized repack script which uses @expo/repack-app
0 commit comments