Skip to content

Commit f0a203e

Browse files
committed
Merge branch 'main' into mikesposito/deps/smart-transactions-controller
2 parents c2a9cb7 + b24f15b commit f0a203e

33 files changed

+1298
-369
lines changed

.github/scripts/generate-regression-slack-summary.mjs

Lines changed: 444 additions & 0 deletions
Large diffs are not rendered by default.

.github/workflows/run-e2e-regression-tests-android.yml

Lines changed: 53 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,14 @@
11
name: Android E2E Regression Tests
22

33
on:
4-
workflow_call:
54
schedule:
6-
- cron: '30 4 * * *' # 4:30 AM UTC
5+
- cron: '0 */3 * * *' # Every 3 hours
76
workflow_dispatch:
7+
inputs:
8+
notify_on_pass:
9+
description: 'Send Slack notification even when all tests pass'
10+
type: boolean
11+
default: false
812

913
permissions:
1014
contents: read
@@ -86,22 +90,6 @@ jobs:
8690
total_splits: 4
8791
secrets: inherit
8892

89-
regression-identity-android:
90-
name: 'Identity Regression (Android) - ${{ matrix.split }}'
91-
needs: [build-android-apks]
92-
strategy:
93-
matrix:
94-
split: [1, 2, 3, 4]
95-
fail-fast: false
96-
uses: ./.github/workflows/run-e2e-workflow.yml
97-
with:
98-
test-suite-name: regression-identity-android-${{ matrix.split }}
99-
platform: android
100-
test_suite_tag: 'RegressionIdentity'
101-
split_number: ${{ matrix.split }}
102-
total_splits: 4
103-
secrets: inherit
104-
10593
regression-accounts-android:
10694
name: 'Accounts Regression (Android) - ${{ matrix.split }}'
10795
needs: [build-android-apks]
@@ -187,11 +175,11 @@ jobs:
187175
runs-on: ubuntu-latest
188176
if: always()
189177
needs:
178+
- build-android-apks
190179
- regression-confirmations-android
191180
- regression-confirmations-redesigned-android
192181
- regression-trade-android
193182
- regression-wallet-platform-android
194-
- regression-identity-android
195183
- regression-accounts-android
196184
- regression-network-abstraction-android
197185
- regression-network-expansion-android
@@ -224,4 +212,49 @@ jobs:
224212
continue-on-error: true
225213
with:
226214
name: android-merged-test-report
227-
path: all-test-results/**/*.xml
215+
path: all-test-results/**/*.xml
216+
217+
- name: Generate Test Summary
218+
id: summary
219+
continue-on-error: true
220+
env:
221+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
222+
run: |
223+
EXIT_CODE=0
224+
{
225+
echo "summary<<EOF"
226+
node .github/scripts/generate-regression-slack-summary.mjs Android || EXIT_CODE=$?
227+
echo "EOF"
228+
} >> "$GITHUB_OUTPUT"
229+
exit $EXIT_CODE
230+
231+
- name: Prepare Slack Payload
232+
if: always() && (steps.summary.outcome == 'failure' || inputs.notify_on_pass == true)
233+
run: |
234+
node -e "
235+
const fs = require('fs');
236+
const message = \`${{ steps.summary.outputs.summary }}\`;
237+
const hasFailed = '${{ steps.summary.outcome }}' === 'failure';
238+
const title = hasFailed ? 'Android E2E Regression Test Failures' : 'Android E2E Regression Test Results';
239+
const payload = {
240+
text: title,
241+
blocks: [
242+
{
243+
type: 'section',
244+
text: {
245+
type: 'mrkdwn',
246+
text: message
247+
}
248+
}
249+
]
250+
};
251+
fs.writeFileSync('/tmp/slack-payload.json', JSON.stringify(payload, null, 2));
252+
"
253+
254+
- name: Send Slack Notification
255+
if: always() && (steps.summary.outcome == 'failure' || inputs.notify_on_pass == true)
256+
uses: slackapi/slack-github-action@91efab103c0de0a537f72a35f6b8cda0ee76bf0a
257+
with:
258+
webhook: ${{ secrets.REGRESSION_E2E_SLACK_WEBHOOK_URL }}
259+
webhook-type: incoming-webhook
260+
payload-file-path: /tmp/slack-payload.json

.github/workflows/run-e2e-regression-tests-ios.yml

Lines changed: 51 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,14 @@
11
name: iOS E2E Regression Tests
22

3-
# TODO: Add schedule once iOS builds are available
43
on:
5-
workflow_call:
4+
schedule:
5+
- cron: '0 */3 * * *' # Every 3 hours
66
workflow_dispatch:
7+
inputs:
8+
notify_on_pass:
9+
description: 'Send Slack notification even when all tests pass'
10+
type: boolean
11+
default: false
712

813
permissions:
914
contents: read
@@ -56,21 +61,6 @@ jobs:
5661
total_splits: 4
5762
secrets: inherit
5863

59-
regression-identity-ios:
60-
name: 'Identity Regression (iOS) - ${{ matrix.split }}'
61-
strategy:
62-
matrix:
63-
split: [1, 2, 3, 4]
64-
fail-fast: false
65-
uses: ./.github/workflows/run-e2e-workflow.yml
66-
with:
67-
test-suite-name: regression-identity-ios-${{ matrix.split }}
68-
platform: ios
69-
test_suite_tag: 'RegressionIdentity'
70-
split_number: ${{ matrix.split }}
71-
total_splits: 4
72-
secrets: inherit
73-
7464
regression-accounts-ios:
7565
name: 'Accounts Regression (iOS) - ${{ matrix.split }}'
7666
strategy:
@@ -154,7 +144,6 @@ jobs:
154144
- regression-confirmations-ios
155145
- regression-trade-ios
156146
- regression-wallet-platform-ios
157-
- regression-identity-ios
158147
- regression-accounts-ios
159148
- regression-network-abstraction-ios
160149
- regression-network-expansion-ios
@@ -187,4 +176,47 @@ jobs:
187176
continue-on-error: true
188177
with:
189178
name: ios-merged-test-report
190-
path: all-test-results/**/*.xml
179+
path: all-test-results/**/*.xml
180+
181+
- name: Generate Test Summary
182+
id: summary
183+
continue-on-error: true
184+
env:
185+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
186+
run: |
187+
EXIT_CODE=0
188+
{
189+
echo "summary<<EOF"
190+
node .github/scripts/generate-regression-slack-summary.mjs iOS || EXIT_CODE=$?
191+
echo "EOF"
192+
} >> "$GITHUB_OUTPUT"
193+
exit $EXIT_CODE
194+
195+
- name: Prepare Slack Payload
196+
if: always() && (steps.summary.outcome == 'failure' || inputs.notify_on_pass == true)
197+
run: |
198+
node -e "
199+
const fs = require('fs');
200+
const message = \`${{ steps.summary.outputs.summary }}\`;
201+
const payload = {
202+
text: 'iOS E2E Regression Test Results',
203+
blocks: [
204+
{
205+
type: 'section',
206+
text: {
207+
type: 'mrkdwn',
208+
text: message
209+
}
210+
}
211+
]
212+
};
213+
fs.writeFileSync('/tmp/slack-payload.json', JSON.stringify(payload, null, 2));
214+
"
215+
216+
- name: Send Slack Notification
217+
if: always() && (steps.summary.outcome == 'failure' || inputs.notify_on_pass == true)
218+
uses: slackapi/slack-github-action@91efab103c0de0a537f72a35f6b8cda0ee76bf0a
219+
with:
220+
webhook: ${{ secrets.REGRESSION_E2E_SLACK_WEBHOOK_URL }}
221+
webhook-type: incoming-webhook
222+
payload-file-path: /tmp/slack-payload.json

app/components/UI/Ramp/Aggregator/sdk/index.tsx

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ import {
1313
RegionsService,
1414
CryptoCurrency,
1515
Payment,
16+
Environment,
1617
} from '@consensys/on-ramp-sdk';
1718
import { getSdkEnvironment } from './getSdkEnvironment';
1819
import { getCaipChainIdFromCryptoCurrency } from '../utils';
@@ -38,13 +39,15 @@ import useActivationKeys from '../hooks/useActivationKeys';
3839
import useRampAccountAddress from '../../hooks/useRampAccountAddress';
3940
import { selectNickname } from '../../../../../selectors/networkController';
4041

42+
const environment = getSdkEnvironment();
43+
4144
const isDevelopment =
4245
process.env.NODE_ENV !== 'production' ||
4346
process.env.RAMP_DEV_BUILD === 'true';
4447
const isInternalBuild = process.env.RAMP_INTERNAL_BUILD === 'true';
45-
const isDevelopmentOrInternalBuild = isDevelopment || isInternalBuild;
46-
47-
const environment = getSdkEnvironment();
48+
const isProduction = environment === Environment.Production;
49+
const isDevelopmentOrInternalBuild =
50+
isDevelopment || isInternalBuild || !isProduction;
4851

4952
let context = Context.Mobile;
5053
if (Device.isAndroid()) {
@@ -115,9 +118,9 @@ interface ProviderProps<T> {
115118
children?: React.ReactNode;
116119
}
117120

118-
export const callbackBaseUrl = isDevelopment
119-
? 'https://on-ramp-content.uat-api.cx.metamask.io/regions/fake-callback'
120-
: 'https://on-ramp-content.api.cx.metamask.io/regions/fake-callback';
121+
export const callbackBaseUrl = isProduction
122+
? 'https://on-ramp-content.api.cx.metamask.io/regions/fake-callback'
123+
: 'https://on-ramp-content.uat-api.cx.metamask.io/regions/fake-callback';
121124

122125
export const callbackBaseDeeplink = 'metamask://';
123126

0 commit comments

Comments
 (0)