@@ -40,10 +40,6 @@ inputs:
4040 description : JDK distribution to use (only for Android)
4141 required : false
4242 default : ' temurin'
43- ndk-version :
44- description : NDK version to use (only for Android)
45- required : false
46- default : ' 26.1.10909125'
4743 foundry-version :
4844 description : Foundry version to install
4945 required : false
8480 - run : echo "Setup E2E Environment started"
8581 shell : bash
8682
83+ # # Platform Environment Configuration (must happen first) ##
84+
85+ # Set Android environment variables (self-hosted runner has SDK pre-installed)
86+ - name : Set Android environment variables
87+ if : ${{ inputs.platform == 'android' }}
88+ run : |
89+ echo "ANDROID_HOME=/opt/android-sdk" >> "$GITHUB_ENV"
90+ echo "ANDROID_SDK_ROOT=/opt/android-sdk" >> "$GITHUB_ENV"
91+ shell : bash
92+
93+ - name : Configure Android Signing Certificates
94+ if : ${{ inputs.platform == 'android' && inputs.configure-keystores == 'true' }}
95+ uses : MetaMask/github-tools/.github/actions/configure-keystore@e2e-env-actions
96+ with :
97+ aws-role-to-assume : ${{ inputs.keystore-role-to-assume }}
98+ aws-region : ' us-east-2'
99+ platform : ' android'
100+ environment : ${{ inputs.environment }}
101+
102+ - name : Configure iOS Signing Certificates
103+ if : ${{ inputs.platform == 'ios' && inputs.configure-keystores == 'true' }}
104+ uses : MetaMask/github-tools/.github/actions/configure-keystore@e2e-env-actions
105+ with :
106+ aws-role-to-assume : ${{ inputs.keystore-role-to-assume }}
107+ aws-region : ' us-east-2'
108+ platform : ' ios'
109+ environment : ${{ inputs.environment }}
110+
111+ # # Node.js & JavaScript Dependencies Setup ##
112+
87113 - name : Setup Node.js
88114 uses : actions/setup-node@v4
89115 with :
@@ -134,15 +160,7 @@ runs:
134160
135161 "$FOUNDRY_BIN/foundryup"
136162
137- # # IOS Setup ##
138- - name : Configure iOS Signing Certificates
139- if : ${{ inputs.platform == 'ios' && inputs.configure-keystores == 'true' }}
140- uses : MetaMask/github-tools/.github/actions/configure-keystore@e2e-env-actions
141- with :
142- aws-role-to-assume : ${{ inputs.keystore-role-to-assume }}
143- aws-region : ' us-east-2'
144- platform : ' ios'
145- environment : ${{ inputs.environment }}
163+ # # iOS Setup ##
146164
147165 # # Ruby Setup & Cache Management
148166 - name : Setup Ruby
@@ -216,32 +234,16 @@ runs:
216234
217235 # # Android Setup ##
218236
219- # # JDK Setup
220- - name : Setup Java
221- if : ${{ inputs.platform == 'android' }}
222- uses : actions/setup-java@c5195efecf7bdfc987ee8bae7a71cb8b11521c00
223- with :
224- java-version : ${{ inputs.jdk-version }}
225- distribution : ${{ inputs.jdk-distribution }}
226-
227- - name : Configure Android Signing Certificates
228- if : ${{ inputs.platform == 'android' && inputs.configure-keystores == 'true' }}
229- uses : MetaMask/github-tools/.github/actions/configure-keystore@e2e-env-actions
230- with :
231- aws-role-to-assume : ${{ inputs.keystore-role-to-assume }}
232- aws-region : ' us-east-2'
233- platform : ' android'
234- environment : ${{ inputs.environment }}
235-
236- - name : Enable KVM group perms (Ubuntu only)
237- if : ${{ inputs.platform == 'android' && runner.os == 'Linux' }}
238- run : |
239- echo 'KERNEL=="kvm", GROUP="kvm", MODE="0666", OPTIONS+="static_node=kvm"' | sudo tee /etc/udev/rules.d/99-kvm4all.rules
240- sudo udevadm control --reload-rules
241- sudo udevadm trigger --name-match=kvm
242- shell : bash
237+ # KVM permissions setup - commented out for self-hosted runner
238+ # - name: Enable KVM group perms (Ubuntu only)
239+ # if: ${{ inputs.platform == 'android' && runner.os == 'Linux' }}
240+ # run: |
241+ # echo 'KERNEL=="kvm", GROUP="kvm", MODE="0666", OPTIONS+="static_node=kvm"' | sudo tee /etc/udev/rules.d/99-kvm4all.rules
242+ # sudo udevadm control --reload-rules
243+ # sudo udevadm trigger --name-match=kvm
244+ # shell: bash
243245
244- # # Android SDK Setup
246+ # # Android Emulator Setup (SDK/NDK pre-installed by self-hosted runner)
245247
246248 - name : Install required emulator dependencies
247249 if : ${{ inputs.platform == 'android' && runner.os == 'Linux' }}
@@ -256,55 +258,15 @@ runs:
256258 echo "✅ Linux dependencies installed successfully"
257259 shell : bash
258260
259- - name : Install Android SDK packages
261+ - name : Install Android emulator and system images
260262 if : ${{ inputs.platform == 'android' }}
261263 run : |
262- echo "Accepting SDK licenses..."
263- printf 'y\n%.0s' {1..10} | "${ANDROID_HOME}/cmdline-tools/latest/bin/sdkmanager" --licenses
264-
265- echo "Installing Android SDK components..."
266- "${ANDROID_HOME}/cmdline-tools/latest/bin/sdkmanager" --install \
267- "platform-tools" \
268- "platforms;android-${{ inputs.android-api-level }}" \
269- "build-tools;34.0.0" \
264+ echo "Installing emulator and system images..."
265+ "/opt/android-sdk/cmdline-tools/latest/bin/sdkmanager" --install \
270266 "emulator" \
271- "system-images;android-${{ inputs.android-api-level }};google_apis;${{ inputs.android-abi }}" \
267+ "system-images;android-${{ inputs.android-api-level }};google_apis;${{ inputs.android-abi }}"
272268
273- echo "Updating SDK packages..."
274- "${ANDROID_HOME}/cmdline-tools/latest/bin/sdkmanager" --update
275-
276- echo "✅ Android SDK packages installed successfully"
277- shell : bash
278-
279- # # NDK Setup
280-
281- - name : Debug Android SDK Paths
282- if : ${{ inputs.platform == 'android' }}
283- run : |
284- echo "ANDROID_HOME: $ANDROID_HOME"
285- echo "ANDROID_SDK_ROOT: $ANDROID_SDK_ROOT"
286- shell : bash
287-
288- - name : Install Android NDK
289- if : ${{ inputs.platform == 'android' }}
290- run : |
291- "$ANDROID_HOME/cmdline-tools/latest/bin/sdkmanager" "ndk;${{ inputs.ndk-version }}"
292- shell : bash
293-
294- - name : Add Android tools to PATH
295- if : ${{ inputs.platform == 'android' }}
296- run : |
297- echo "$ANDROID_HOME/platform-tools" >> "$GITHUB_PATH"
298- echo "$ANDROID_HOME/emulator" >> "$GITHUB_PATH"
299- echo "$ANDROID_HOME/cmdline-tools/latest/bin" >> "$GITHUB_PATH"
300- shell : bash
301-
302- - name : Add NDK related toolchains to PATH
303- if : ${{ inputs.platform == 'android' }}
304- run : |
305- NDK_TOOLCHAIN="$ANDROID_SDK_ROOT/ndk/${{ inputs.ndk-version }}/toolchains/llvm/prebuilt/linux-x86_64/bin"
306- echo "$NDK_TOOLCHAIN" >> "$GITHUB_PATH"
307- echo "$ANDROID_SDK_ROOT/ndk/${{ inputs.ndk-version }}" >> "$GITHUB_PATH"
269+ echo "✅ Android emulator components installed successfully"
308270 shell : bash
309271
310272 # # Launch AVD
@@ -321,7 +283,7 @@ runs:
321283 run : |
322284 IMAGE="system-images;android-${{ inputs.android-api-level }};google_apis;${{ inputs.android-abi }}"
323285 echo "Creating AVD with image: $IMAGE"
324- echo "no" | "${ANDROID_HOME} /cmdline-tools/latest/bin/avdmanager" create avd \
286+ echo "no" | "/opt/android-sdk /cmdline-tools/latest/bin/avdmanager" create avd \
325287 --name "${{ inputs.android-avd-name }}" \
326288 --package "$IMAGE" \
327289 --device "${{ inputs.android-device }}"
0 commit comments