Skip to content

Commit 2ead7cb

Browse files
committed
fail fast
1 parent a1f7d18 commit 2ead7cb

File tree

1 file changed

+126
-113
lines changed

1 file changed

+126
-113
lines changed

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

Lines changed: 126 additions & 113 deletions
Original file line numberDiff line numberDiff line change
@@ -84,6 +84,132 @@ runs:
8484
- run: echo "Setup E2E Environment started"
8585
shell: bash
8686

87+
## Android Setup (early for fail-fast) ##
88+
89+
# Set Android environment variables (self-hosted runner has SDK pre-installed)
90+
- name: Set Android environment variables
91+
if: ${{ inputs.platform == 'android' }}
92+
run: |
93+
echo "ANDROID_HOME=/opt/android-sdk" >> "$GITHUB_ENV"
94+
echo "ANDROID_SDK_ROOT=/opt/android-sdk" >> "$GITHUB_ENV"
95+
shell: bash
96+
97+
- name: Configure Android Signing Certificates
98+
if: ${{ inputs.platform == 'android' && inputs.configure-keystores == 'true' }}
99+
uses: MetaMask/github-tools/.github/actions/configure-keystore@e2e-env-actions
100+
with:
101+
aws-role-to-assume: ${{ inputs.keystore-role-to-assume }}
102+
aws-region: 'us-east-2'
103+
platform: 'android'
104+
environment: ${{ inputs.environment }}
105+
106+
## JDK Setup
107+
- name: Setup Java
108+
if: ${{ inputs.platform == 'android' }}
109+
uses: actions/setup-java@c5195efecf7bdfc987ee8bae7a71cb8b11521c00
110+
with:
111+
java-version: ${{ inputs.jdk-version }}
112+
distribution: ${{ inputs.jdk-distribution }}
113+
114+
- name: Install required emulator dependencies
115+
if: ${{ inputs.platform == 'android' && runner.os == 'Linux' }}
116+
run: |
117+
sudo apt-get update
118+
sudo apt-get install -y \
119+
libpulse0 \
120+
libglu1-mesa \
121+
libnss3 \
122+
libxss1
123+
124+
echo "✅ Linux dependencies installed successfully"
125+
shell: bash
126+
127+
## Android SDK Setup
128+
129+
- name: Install Android SDK packages
130+
if: ${{ inputs.platform == 'android' }}
131+
run: |
132+
echo "Accepting SDK licenses..."
133+
printf 'y\n%.0s' {1..10} | "/opt/android-sdk/cmdline-tools/latest/bin/sdkmanager" --licenses
134+
135+
echo "Installing Android SDK components..."
136+
"/opt/android-sdk/cmdline-tools/latest/bin/sdkmanager" --install \
137+
"platform-tools" \
138+
"platforms;android-${{ inputs.android-api-level }}" \
139+
"build-tools;34.0.0" \
140+
"emulator" \
141+
"system-images;android-${{ inputs.android-api-level }};google_apis;${{ inputs.android-abi }}"
142+
143+
echo "Updating SDK packages..."
144+
"/opt/android-sdk/cmdline-tools/latest/bin/sdkmanager" --update
145+
146+
echo "✅ Android SDK packages installed successfully"
147+
shell: bash
148+
149+
## NDK Setup
150+
151+
- name: Debug Android SDK Paths
152+
if: ${{ inputs.platform == 'android' }}
153+
run: |
154+
echo "ANDROID_HOME: $ANDROID_HOME"
155+
echo "ANDROID_SDK_ROOT: $ANDROID_SDK_ROOT"
156+
shell: bash
157+
158+
- name: Install Android NDK
159+
if: ${{ inputs.platform == 'android' }}
160+
run: |
161+
"/opt/android-sdk/cmdline-tools/latest/bin/sdkmanager" "ndk;${{ inputs.ndk-version }}"
162+
shell: bash
163+
164+
- name: Add Android tools to PATH
165+
if: ${{ inputs.platform == 'android' }}
166+
run: |
167+
echo "/opt/android-sdk/platform-tools" >> "$GITHUB_PATH"
168+
echo "/opt/android-sdk/emulator" >> "$GITHUB_PATH"
169+
echo "/opt/android-sdk/cmdline-tools/latest/bin" >> "$GITHUB_PATH"
170+
shell: bash
171+
172+
- name: Add NDK related toolchains to PATH
173+
if: ${{ inputs.platform == 'android' }}
174+
run: |
175+
NDK_TOOLCHAIN="/opt/android-sdk/ndk/${{ inputs.ndk-version }}/toolchains/llvm/prebuilt/linux-x86_64/bin"
176+
echo "$NDK_TOOLCHAIN" >> "$GITHUB_PATH"
177+
echo "/opt/android-sdk/ndk/${{ inputs.ndk-version }}" >> "$GITHUB_PATH"
178+
shell: bash
179+
180+
## Launch AVD
181+
182+
- name: Set ANDROID_AVD_HOME for downstream steps
183+
if: ${{ inputs.platform == 'android'}}
184+
shell: bash
185+
run: |
186+
echo "ANDROID_AVD_HOME=$HOME/.android/avd" >> "$GITHUB_ENV"
187+
mkdir -p "$HOME/.android/avd"
188+
189+
- name: Create Android Virtual Device (AVD)
190+
if: ${{ inputs.platform == 'android'}}
191+
run: |
192+
IMAGE="system-images;android-${{ inputs.android-api-level }};google_apis;${{ inputs.android-abi }}"
193+
echo "Creating AVD with image: $IMAGE"
194+
echo "no" | "/opt/android-sdk/cmdline-tools/latest/bin/avdmanager" create avd \
195+
--name "${{ inputs.android-avd-name }}" \
196+
--package "$IMAGE" \
197+
--device "${{ inputs.android-device }}"
198+
shell: bash
199+
200+
## iOS Platform Setup ##
201+
202+
- name: Configure iOS Signing Certificates
203+
if: ${{ inputs.platform == 'ios' && inputs.configure-keystores == 'true' }}
204+
uses: MetaMask/github-tools/.github/actions/configure-keystore@e2e-env-actions
205+
with:
206+
aws-role-to-assume: ${{ inputs.keystore-role-to-assume }}
207+
aws-region: 'us-east-2'
208+
platform: 'ios'
209+
environment: ${{ inputs.environment }}
210+
211+
## Node.js & JavaScript Dependencies Setup ##
212+
87213
- name: Setup Node.js
88214
uses: actions/setup-node@v4
89215
with:
@@ -135,14 +261,6 @@ runs:
135261
"$FOUNDRY_BIN/foundryup"
136262
137263
## 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 }}
146264

147265
## Ruby Setup & Cache Management
148266
- name: Setup Ruby
@@ -213,108 +331,3 @@ runs:
213331
if: ${{ inputs.platform == 'ios' }}
214332
run: xcrun simctl list devices
215333
shell: bash
216-
217-
## Android Setup ##
218-
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-
## Android SDK Setup
237-
238-
- name: Install required emulator dependencies
239-
if: ${{ inputs.platform == 'android' && runner.os == 'Linux' }}
240-
run: |
241-
sudo apt-get update
242-
sudo apt-get install -y \
243-
libpulse0 \
244-
libglu1-mesa \
245-
libnss3 \
246-
libxss1
247-
248-
echo "✅ Linux dependencies installed successfully"
249-
shell: bash
250-
251-
- name: Install Android SDK packages
252-
if: ${{ inputs.platform == 'android' }}
253-
run: |
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" \
262-
"emulator" \
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
270-
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"
300-
shell: bash
301-
302-
## Launch AVD
303-
304-
- name: Set ANDROID_AVD_HOME for downstream steps
305-
if: ${{ inputs.platform == 'android'}}
306-
shell: bash
307-
run: |
308-
echo "ANDROID_AVD_HOME=$HOME/.android/avd" >> "$GITHUB_ENV"
309-
mkdir -p "$HOME/.android/avd"
310-
311-
- name: Create Android Virtual Device (AVD)
312-
if: ${{ inputs.platform == 'android'}}
313-
run: |
314-
IMAGE="system-images;android-${{ inputs.android-api-level }};google_apis;${{ inputs.android-abi }}"
315-
echo "Creating AVD with image: $IMAGE"
316-
echo "no" | "${ANDROID_HOME}/cmdline-tools/latest/bin/avdmanager" create avd \
317-
--name "${{ inputs.android-avd-name }}" \
318-
--package "$IMAGE" \
319-
--device "${{ inputs.android-device }}"
320-
shell: bash

0 commit comments

Comments
 (0)