forked from rainbow-me/rainbow
-
Notifications
You must be signed in to change notification settings - Fork 0
189 lines (169 loc) Β· 6.18 KB
/
ios-e2e.yml
File metadata and controls
189 lines (169 loc) Β· 6.18 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
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
name: iOS
on:
pull_request:
types: [opened, synchronize, reopened, ready_for_review]
push:
branches: [develop]
issue_comment:
types: [created]
env:
NODE_OPTIONS: "--max-old-space-size=6144"
jobs:
# iOS build job
build:
name: Test Build
if: |
(github.event_name == 'pull_request' && github.event.pull_request.draft == false) ||
github.event_name == 'push' ||
(github.event_name == 'issue_comment' &&
github.event.issue.pull_request != null &&
startsWith(github.event.comment.body, '/e2e') &&
contains(fromJson('["OWNER","MEMBER","COLLABORATOR"]'), github.event.comment.author_association))
runs-on: macos-15-xlarge
concurrency:
group: e2e-ios-${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
timeout-minutes: 45
outputs:
artifact-id: ${{ steps.rock-remote-build-ios.outputs.artifact-id }}
steps:
- name: Checkout repo
uses: actions/checkout@08eba0b27e820071cde6df949e0beb9ba4906955
- name: Set Xcode version
run: sudo xcode-select --switch /Applications/Xcode_16.4.app
- name: Setup env key
uses: ./.github/actions/ssh/
with:
name: env
key: ${{ secrets.DEPLOY_PKEY_DOTENV_REPO }}
- name: Setup scripts key
uses: ./.github/actions/ssh/
with:
name: scripts
key: ${{ secrets.DEPLOY_PKEY_SCRIPTS_REPO }}
- name: Setup sandbox key
uses: ./.github/actions/ssh/
with:
name: sandbox
key: ${{ secrets.DEPLOY_PKEY_SANDBOX_REPO }}
- name: Setup env
env:
SSH_AUTH_SOCK: /tmp/ssh_agent_env.sock
run: |
git clone git@github.com:rainbow-me/rainbow-env.git
mv rainbow-env/dotenv .env
rm -rf rainbow-env
sed -i'' -e "s/IS_TESTING=false/IS_TESTING=true/" .env && rm -f .env-e
echo "1" > is_testing
- name: Setup scripts
env:
CI_SCRIPTS: ${{ secrets.CI_SCRIPTS }}
SSH_AUTH_SOCK: /tmp/ssh_agent_scripts.sock
run: |
eval $CI_SCRIPTS
- name: Get Yarn cache directory path
id: yarn-cache-dir-path
run: echo "dir=$(yarn config get cacheFolder)" >> $GITHUB_OUTPUT
- name: Cache Yarn dependencies
uses: actions/cache@0057852bfaa89a56745cba8c7296529d2fc39830
with:
path: |
${{ steps.yarn-cache-dir-path.outputs.dir }}
.yarn/cache
.yarn/install-state.gz
!.eslintcache
key: yarn-${{ runner.os }}-${{ hashFiles('yarn.lock') }}
restore-keys: |
${{ runner.os }}-yarn-
- name: Install dependencies
env:
SSH_AUTH_SOCK: /tmp/ssh_agent_sandbox.sock
run: yarn install && yarn setup
- name: Rock Remote Build - iOS simulator
id: rock-remote-build-ios
uses: callstackincubator/ios@0bfe6ed5c14bdf3fb88a638d5a19b440e59e845f
env:
SENTRY_AUTH_TOKEN: ${{ secrets.SENTRY_AUTH_TOKEN }}
with:
scheme: Rainbow
destination: simulator
github-token: ${{ secrets.GITHUB_TOKEN }}
configuration: Release
comment-bot: false
re-sign: true
# iOS e2e tests job
e2e-tests:
name: E2E Tests (Shard ${{ matrix.shard-index }})
needs: build
runs-on: macos-15-xlarge
strategy:
fail-fast: false
matrix:
shard-index: [1, 2, 3, 4]
concurrency:
group: e2e-ios-${{ github.workflow }}-${{ github.ref }}-shard-${{ matrix.shard-index }}
cancel-in-progress: false
timeout-minutes: 30
env:
SHARD_TOTAL: 4
SHARD_INDEX: ${{ matrix.shard-index }}
ARTIFACTS_FOLDER: e2e-artifacts
steps:
- name: Checkout repo
uses: actions/checkout@08eba0b27e820071cde6df949e0beb9ba4906955
- name: Setup env key
uses: ./.github/actions/ssh/
with:
name: env
key: ${{ secrets.DEPLOY_PKEY_DOTENV_REPO }}
- name: Setup env
env:
SSH_AUTH_SOCK: /tmp/ssh_agent_env.sock
run: |
git clone git@github.com:rainbow-me/rainbow-env.git
mv rainbow-env/dotenv .env
rm -rf rainbow-env
- name: Install Maestro
run: export MAESTRO_VERSION=2.0.10; curl -fsSL "https://get.maestro.mobile.dev" | bash
- name: Install Anvil
uses: foundry-rs/foundry-toolchain@82dee4ba654bd2146511f85f0d013af94670c4de
with:
version: stable
- name: Download and Unpack IPA artifact
run: |
curl -L -H "Authorization: token ${{ github.token }}" -o artifact.zip "https://api.github.com/repos/${{ github.repository }}/actions/artifacts/${{ needs.build.outputs.artifact-id }}/zip"
unzip artifact.zip -d downloaded-artifacts
ls -l downloaded-artifacts
APP_ARCHIVE_PATH=$(find downloaded-artifacts -name "*.tar.gz" -print -quit)
tar -xzf "$APP_ARCHIVE_PATH" -C downloaded-artifacts
APP_PATH=$(find downloaded-artifacts -name "*.app" -type d | head -n 1)
echo "ARTIFACT_PATH_FOR_E2E=$APP_PATH" >> $GITHUB_ENV
- uses: futureware-tech/simulator-action@dab10d813144ef59b48d401cd95da151222ef8cd
id: simulator
with:
model: "iPhone 16"
os_version: "18.5"
- name: Ensure Simulator is fully booted
run: |
echo "Waiting for simulator to be fully booted..."
timeout=0
while [[ "$(xcrun simctl list | grep "${{ steps.simulator.outputs.udid }}" | grep -o 'Booted')" != "Booted" ]]; do
sleep 5
timeout=$((timeout+5))
echo "Still waiting... ($timeout seconds)"
if [ $timeout -ge 120 ]; then
echo "Timed out waiting for simulator"
exit 1
fi
done
echo "Simulator is ready."
- name: Run Tests
run: ./scripts/e2e-ios-ci.sh
env:
DEVICE_UDID: ${{ steps.simulator.outputs.udid }}
- name: Upload artifacts
if: ${{ always() }}
uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02
with:
name: artifacts-${{ matrix.shard-index }}
path: ${{ env.ARTIFACTS_FOLDER }}