-
Notifications
You must be signed in to change notification settings - Fork 385
180 lines (149 loc) · 5.4 KB
/
Copy pathe2e_test.yml
File metadata and controls
180 lines (149 loc) · 5.4 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
name: E2E Tests
on:
workflow_dispatch:
inputs:
android:
description: "Run Android e2e tests"
type: boolean
default: true
ios:
description: "Run iOS e2e tests"
type: boolean
default: true
pull_request:
permissions:
contents: read
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
env:
ALLURE_TOKEN: ${{ secrets.ALLURE_TOKEN }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
GITHUB_PR_NUM: ${{ github.event.pull_request.number }}
jobs:
allure_launch_android:
if: github.event_name != 'workflow_dispatch' || inputs.android
runs-on: ubuntu-latest
timeout-minutes: 10
outputs:
launch_id: ${{ steps.launch.outputs.launch_id }}
steps:
- uses: actions/checkout@v7
- uses: ./.github/actions/allure-launch
id: launch
with:
working-directory: sample_app/android
allure_launch_ios:
if: github.event_name == 'workflow_dispatch' && inputs.ios
runs-on: ubuntu-latest
timeout-minutes: 10
outputs:
launch_id: ${{ steps.launch.outputs.launch_id }}
steps:
- uses: actions/checkout@v7
- uses: ./.github/actions/allure-launch
id: launch
with:
working-directory: sample_app/ios
android:
# Always on pull_request; opt-out via the checkbox on workflow_dispatch.
if: github.event_name != 'workflow_dispatch' || inputs.android
needs: allure_launch_android
runs-on: ubuntu-latest
timeout-minutes: 60
strategy:
fail-fast: false
matrix:
batch: [0, 1]
env:
ANDROID_API_LEVEL: "34"
LAUNCH_ID: ${{ needs.allure_launch_android.outputs.launch_id }}
steps:
- uses: actions/checkout@v7
- uses: ./.github/actions/setup-java
- uses: ./.github/actions/cache-gradle
- uses: ./.github/actions/setup-ruby
- uses: ./.github/actions/setup-flutter
- uses: ./.github/actions/enable-kvm
- name: Use Firebase stubs
run: cp sample_app/pubspec_overrides.e2e.yaml sample_app/pubspec_overrides.yaml
- name: Bootstrap
run: |
flutter pub global activate melos
melos bootstrap
- name: Run e2e (Android emulator)
uses: reactivecircus/android-emulator-runner@v2
with:
api-level: ${{ env.ANDROID_API_LEVEL }}
arch: x86_64
profile: pixel_6
script: cd sample_app/android && bundle exec fastlane run_e2e_test device:emulator-5554 batch:${{ matrix.batch }} batch_count:${{ strategy.job-total }}
- name: Attach videos to failed tests
if: failure()
working-directory: sample_app/android
run: |
sudo apt-get update && sudo apt-get install -y ffmpeg
bundle exec fastlane attach_videos
- name: Upload Allure results
if: env.LAUNCH_ID != '' && (success() || failure())
working-directory: sample_app/android
run: bundle exec fastlane allure_upload launch_id:$LAUNCH_ID
- name: Allure TestOps Launch Removal
if: env.LAUNCH_ID != '' && cancelled()
working-directory: sample_app/android
run: bundle exec fastlane allure_launch_removal launch_id:$LAUNCH_ID
- uses: actions/upload-artifact@v7
if: failure()
with:
name: e2e-android-logs-${{ matrix.batch }}
path: |
sample_app/stream-chat-test-mock-server/logs
sample_app/build/e2e-test.log
ios:
# Only on workflow_dispatch, when the checkbox is ticked.
if: github.event_name == 'workflow_dispatch' && inputs.ios
needs: allure_launch_ios
runs-on: macos-15
timeout-minutes: 60
strategy:
fail-fast: false
matrix:
batch: [0, 1]
env:
IOS_SIMULATOR_VERSION: "26.2"
IOS_SIMULATOR_DEVICE: "iPhone 17"
LAUNCH_ID: ${{ needs.allure_launch_ios.outputs.launch_id }}
steps:
- uses: actions/checkout@v7
- uses: ./.github/actions/setup-flutter
- uses: ./.github/actions/setup-ruby
- name: Use Firebase stubs
run: cp sample_app/pubspec_overrides.e2e.yaml sample_app/pubspec_overrides.yaml
- name: Bootstrap
run: |
flutter precache --ios
flutter config --no-enable-swift-package-manager
flutter pub global activate melos
melos bootstrap
# After Bootstrap so the cache keys hash the resolved pubspec.lock
- uses: ./.github/actions/cache-cocoapods
with:
key-suffix: ${{ runner.os }}
- name: Run e2e (iOS simulator)
working-directory: sample_app/ios
run: bundle exec fastlane run_e2e_test platform:ios ios:"${{ env.IOS_SIMULATOR_VERSION }}" device:"${{ env.IOS_SIMULATOR_DEVICE }}" batch:${{ matrix.batch }} batch_count:${{ strategy.job-total }}
- name: Upload Allure results
if: env.LAUNCH_ID != '' && (success() || failure())
working-directory: sample_app/ios
run: bundle exec fastlane allure_upload launch_id:$LAUNCH_ID
- name: Allure TestOps Launch Removal
if: env.LAUNCH_ID != '' && cancelled()
working-directory: sample_app/ios
run: bundle exec fastlane allure_launch_removal launch_id:$LAUNCH_ID
- uses: actions/upload-artifact@v7
if: failure()
with:
name: e2e-ios-logs-${{ matrix.batch }}
path: |
sample_app/stream-chat-test-mock-server/logs
sample_app/build/e2e-test.log