Skip to content

Commit a1f7d18

Browse files
committed
test
1 parent 8f5b198 commit a1f7d18

File tree

1 file changed

+76
-46
lines changed

1 file changed

+76
-46
lines changed

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

Lines changed: 76 additions & 46 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,10 @@ 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'
4347
foundry-version:
4448
description: Foundry version to install
4549
required: false
@@ -80,36 +84,6 @@ runs:
8084
- run: echo "Setup E2E Environment started"
8185
shell: bash
8286

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-
11387
- name: Setup Node.js
11488
uses: actions/setup-node@v4
11589
with:
@@ -160,7 +134,15 @@ runs:
160134
161135
"$FOUNDRY_BIN/foundryup"
162136
163-
## iOS Setup ##
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 }}
164146

165147
## Ruby Setup & Cache Management
166148
- name: Setup Ruby
@@ -234,16 +216,24 @@ runs:
234216

235217
## Android Setup ##
236218

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
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 }}
245235

246-
## Android Emulator Setup (SDK/NDK pre-installed by self-hosted runner)
236+
## Android SDK Setup
247237

248238
- name: Install required emulator dependencies
249239
if: ${{ inputs.platform == 'android' && runner.os == 'Linux' }}
@@ -258,15 +248,55 @@ runs:
258248
echo "✅ Linux dependencies installed successfully"
259249
shell: bash
260250

261-
- name: Install Android emulator and system images
251+
- name: Install Android SDK packages
262252
if: ${{ inputs.platform == 'android' }}
263253
run: |
264-
echo "Installing emulator and system images..."
265-
"/opt/android-sdk/cmdline-tools/latest/bin/sdkmanager" --install \
254+
echo "Accepting SDK licenses..."
255+
printf 'y\n%.0s' {1..10} | "${ANDROID_HOME}/cmdline-tools/latest/bin/sdkmanager" --licenses
256+
257+
echo "Installing Android SDK components..."
258+
"${ANDROID_HOME}/cmdline-tools/latest/bin/sdkmanager" --install \
259+
"platform-tools" \
260+
"platforms;android-${{ inputs.android-api-level }}" \
261+
"build-tools;34.0.0" \
266262
"emulator" \
267-
"system-images;android-${{ inputs.android-api-level }};google_apis;${{ inputs.android-abi }}"
263+
"system-images;android-${{ inputs.android-api-level }};google_apis;${{ inputs.android-abi }}" \
264+
265+
echo "Updating SDK packages..."
266+
"${ANDROID_HOME}/cmdline-tools/latest/bin/sdkmanager" --update
267+
268+
echo "✅ Android SDK packages installed successfully"
269+
shell: bash
268270

269-
echo "✅ Android emulator components installed successfully"
271+
## NDK Setup
272+
273+
- name: Debug Android SDK Paths
274+
if: ${{ inputs.platform == 'android' }}
275+
run: |
276+
echo "ANDROID_HOME: $ANDROID_HOME"
277+
echo "ANDROID_SDK_ROOT: $ANDROID_SDK_ROOT"
278+
shell: bash
279+
280+
- name: Install Android NDK
281+
if: ${{ inputs.platform == 'android' }}
282+
run: |
283+
"$ANDROID_HOME/cmdline-tools/latest/bin/sdkmanager" "ndk;${{ inputs.ndk-version }}"
284+
shell: bash
285+
286+
- name: Add Android tools to PATH
287+
if: ${{ inputs.platform == 'android' }}
288+
run: |
289+
echo "$ANDROID_HOME/platform-tools" >> "$GITHUB_PATH"
290+
echo "$ANDROID_HOME/emulator" >> "$GITHUB_PATH"
291+
echo "$ANDROID_HOME/cmdline-tools/latest/bin" >> "$GITHUB_PATH"
292+
shell: bash
293+
294+
- name: Add NDK related toolchains to PATH
295+
if: ${{ inputs.platform == 'android' }}
296+
run: |
297+
NDK_TOOLCHAIN="$ANDROID_SDK_ROOT/ndk/${{ inputs.ndk-version }}/toolchains/llvm/prebuilt/linux-x86_64/bin"
298+
echo "$NDK_TOOLCHAIN" >> "$GITHUB_PATH"
299+
echo "$ANDROID_SDK_ROOT/ndk/${{ inputs.ndk-version }}" >> "$GITHUB_PATH"
270300
shell: bash
271301

272302
## Launch AVD
@@ -283,7 +313,7 @@ runs:
283313
run: |
284314
IMAGE="system-images;android-${{ inputs.android-api-level }};google_apis;${{ inputs.android-abi }}"
285315
echo "Creating AVD with image: $IMAGE"
286-
echo "no" | "/opt/android-sdk/cmdline-tools/latest/bin/avdmanager" create avd \
316+
echo "no" | "${ANDROID_HOME}/cmdline-tools/latest/bin/avdmanager" create avd \
287317
--name "${{ inputs.android-avd-name }}" \
288318
--package "$IMAGE" \
289319
--device "${{ inputs.android-device }}"

0 commit comments

Comments
 (0)