-
-
Notifications
You must be signed in to change notification settings - Fork 1.6k
172 lines (138 loc) · 5.95 KB
/
run-e2e-api-specs.yml
File metadata and controls
172 lines (138 loc) · 5.95 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
# This workflow runs API specs tests on iOS simulator.
# API specs are backend API integration tests that use iOS simulator but don't require mobile app UI.
name: API Specs E2E Tests
on:
workflow_call:
workflow_dispatch:
pull_request:
types: [opened, synchronize]
jobs:
api-specs-ios:
name: 'api-specs-ios'
if: false
runs-on: macos-latest-xlarge
continue-on-error: true
env:
METAMASK_ENVIRONMENT: 'dev'
METAMASK_BUILD_TYPE: 'main'
MM_TEST_WALLET_SRP: ${{ secrets.MM_TEST_WALLET_SRP }}
SEGMENT_WRITE_KEY_QA: ${{ secrets.SEGMENT_WRITE_KEY_QA }}
SEGMENT_PROXY_URL_QA: ${{ secrets.SEGMENT_PROXY_URL_QA }}
SEGMENT_DELETE_API_SOURCE_ID_QA: ${{ secrets.SEGMENT_DELETE_API_SOURCE_ID_QA }}
MAIN_IOS_GOOGLE_CLIENT_ID_UAT: ${{ secrets.MAIN_IOS_GOOGLE_CLIENT_ID_UAT }}
MAIN_IOS_GOOGLE_REDIRECT_URI_UAT: ${{ secrets.MAIN_IOS_GOOGLE_REDIRECT_URI_UAT }}
SEGMENT_REGULATIONS_ENDPOINT_QA: ${{ secrets.SEGMENT_REGULATIONS_ENDPOINT_QA }}
MM_SENTRY_DSN_TEST: ${{ secrets.MM_SENTRY_DSN_TEST }}
MM_SOLANA_E2E_TEST_SRP: ${{ secrets.MM_SOLANA_E2E_TEST_SRP }}
steps:
- name: Checkout
uses: actions/checkout@v4
with:
ref: ${{ github.head_ref || github.ref }}
clean: true
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: '20.18.0'
cache: 'yarn'
- name: Enable Corepack and setup Yarn
run: |
corepack enable
corepack prepare yarn@4.10.3 --activate
- name: Install JavaScript dependencies with retry
uses: nick-fields/retry@ce71cc2ab81d554ebbe88c79ab5975992d79ba08 #v3.0.2
env:
NODE_OPTIONS: --max-old-space-size=4096
with:
timeout_minutes: 10
max_attempts: 3
retry_wait_seconds: 30
command: yarn install --immutable
- name: Verify Detox CLI
run: yarn detox --version
- name: Setup Xcode
run: sudo xcode-select -s /Applications/Xcode_16.3.app
- name: Install applesimutils for iOS simulator control
run: |
echo "Installing applesimutils for Detox iOS simulator control..."
brew tap wix/brew && brew install applesimutils
echo "✅ applesimutils installed"
- name: Build Detox framework cache for API specs
run: |
echo "🔧 Building Detox framework cache specifically for API specs..."
# Clean any existing cache first
yarn detox clean-framework-cache
# Build fresh framework cache
yarn detox build-framework-cache
# Verify the framework was built successfully
if [[ -d ~/Library/Detox/ios/framework ]]; then
echo "✅ Detox framework cache built successfully"
find ~/Library/Detox/ios/framework/ -maxdepth 1 -exec ls -la {} \;
else
echo "❌ Failed to build Detox framework cache"
exit 1
fi
- name: Setup pre-built QA app for API specs
run: |
echo "🚀 Setting up pre-built QA app for API specs..."
# Base URL for artifacts
base_url="https://github.com/MetaMask/tmp-bitrise-migration-artifacts/releases/download/test5"
# Create required directory
mkdir -p ios/build/Build/Products/Release-iphonesimulator/
echo "📥 Downloading iOS QA app..."
# Download Release-iphonesimulator.zip
if curl -L --fail -o /tmp/Release-iphonesimulator.zip "${base_url}/Release-iphonesimulator.zip"; then
echo "✅ Downloaded Release-iphonesimulator.zip"
echo "📦 Extracting iOS QA app..."
# Extract preserving directory structure
cd ios/build/Build/Products/Release-iphonesimulator/
unzip -o /tmp/Release-iphonesimulator.zip "MetaMask-QA.app/*"
cd - > /dev/null
# Set proper permissions for the app bundle
chmod -R 755 "ios/build/Build/Products/Release-iphonesimulator/MetaMask-QA.app/" 2>/dev/null || true
else
echo "❌ Failed to download iOS QA app artifacts"
exit 1
fi
# Verify setup
if [[ -f "ios/build/Build/Products/Release-iphonesimulator/MetaMask-QA.app/Info.plist" ]]; then
echo "✅ iOS QA app ready for API specs"
echo "📋 App bundle contents:"
find "ios/build/Build/Products/Release-iphonesimulator/MetaMask-QA.app/" -maxdepth 1 -exec ls -la {} \; | head -10
else
echo "❌ iOS QA app setup failed - Info.plist not found"
echo "📋 Directory contents:"
find "ios/build/Build/Products/Release-iphonesimulator/" -maxdepth 1 -exec ls -la {} \; 2>/dev/null || true
exit 1
fi
- name: Clean environment before API specs
run: |
echo "🧹 Cleaning environment before API specs tests..."
# Clean up any lock files
find . -name "*.lock" -type f -delete 2>/dev/null || true
# Reset Detox lock file
yarn detox reset-lock-file
# Clean any hanging processes
pkill -f "Metro\|node\|npm" 2>/dev/null || true
echo "✅ Environment cleaned and ready for API specs"
- name: Run API Specs tests
run: |
echo "🚀 Running API specs tests..."
echo "Using Detox configuration: ios.sim.apiSpecs"
# Run API specs with retries
yarn test:api-specs --retries 1
echo "✅ API specs tests completed"
- name: Upload API specs test results
if: always()
uses: actions/upload-artifact@v4
with:
name: api-specs-test-results
path: tests/reports/
retention-days: 7
- name: Upload API specs screenshots
if: failure() || cancelled()
uses: actions/upload-artifact@v4
with:
name: api-specs-screenshots
path: tests/artifacts/
retention-days: 7